Open briefnotion opened 4 weeks ago
Hello!
I'm actually not quite sure about this error. The issue seems to stem from a conflict between the versions of the httplib
library used by both ollama-hpp
and chromadb-cpp
, which results in mutex clashes when both libraries are included.
I found a (very dirty) workaround that resolves the assertion failure. Here’s how to implement it:
include
in your project root.ollama.hpp
into the include
directory.
CMakeLists.txt
file to include the new header directory. Ensure it looks like this:
# ...
include_directories( ../include )
target_include_directories(chatapi PRIVATE ../include ${ChromaDB_INCLUDE_DIR} ${OpenSSL_INCLUDE_DIR} )
3. **Modify the `ollama.hpp` File**
- Open the `ollama.hpp` file and remove the section related to `httplib`. Specifically, delete everything from line **_24792_** to the end of the file. This prevents the potential conflicts caused by multiple definitions or mutex handling from both libraries.
4. **Build** with `./cmak.sh` and `./m`
I will further investigate the issue to find a cleaner and more sustainable solution.
I'm still working on my mutex problem. I followed your instructions and I am not able to complete the 3rd step because we may be looking at different things. You said I should "delete everything from line 24792 to the end of the file," According to my ollama.hpp source "ollama.hpp" only has 1046 lines. I suspect you may be looking at all the code as one file, but I can't say for sure.
When I refer to ollama.hpp, I’m talking about the single-header include file, which you can find here: https://github.com/jmont-dev/ollama-hpp/blob/master/singleheader/ollama.hpp
I just realized that this solution won't work either, I'll try to find another way
Awesome. Thank you. I'll keep checking back here to see if it was resolved.
Hello. Your ChromaDB looks very interesting and I spent a good amount of time trying to pull it into my little hobby project. Unfortunately, I'm at that point where the error is beyond my comprehension.
After trying numerous things, such as, modifying the CMakeFile.txt, isolating the libraries, and commenting out most of the program to just a few lines of code, I was able to isolate my problem to:
#include "ollama.hpp"
and
chromadb::Client client("http", "localhost", "8000");
seems that if the library ollama.hpp is not included, or commented out, I can get expected results of:
from:
but if I #include "ollama.hpp"
the results are:
Fatal glibc error: pthread_mutex_lock.c:94 (___pthread_mutex_lock): assertion failed: mutex->__data.__owner == 0
Would you happen to know if this is a fault in my code, ollama.hpp, or chromadb-cpp.
You are welcomed to look at my code in the github repo titled "ollama_chat" if you think it would help. Please, don't judge.