hnswlib icon indicating copy to clipboard operation
hnswlib copied to clipboard

Build error from missing <cassert> header, Ubuntu 18.04, g++

Open jwimberley opened this issue 4 years ago • 2 comments

When I try to build a fresh copy of the library, I encounter the following error:

/path/to/hnswlib/tmp$ cmake ..
/path/to/hnswlib/tmp$ make
Scanning dependencies of target sift_test
[ 16%] Building CXX object CMakeFiles/sift_test.dir/sift_1b.cpp.o
In file included from /path/to/hnswlib/hnswlib/hnswlib.h:88:0,
                 from /path/to/hnswlib/sift_1b.cpp:5:
/path/to/hnswlib/hnswlib/hnswalg.h: In member function 'void hnswlib::HierarchicalNSW<dist_t>::checkIntegrity()':
/path/to/hnswlib//hnswlib/hnswalg.h:1187:25: error: there are no arguments to 'assert' that depend on a template parameter, so a declaration of 'assert' must be available [-fpermissive]
                         assert(data[j] > 0);

I can circumvent this by including in hnswalg.h.

Compiler info:

/path/to/hnswlib/tmp$ c++ --version
c++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0

jwimberley avatar Jul 08 '20 21:07 jwimberley

I have encountered the same problem. Have you solved it?

qxzhou1010 avatar Jul 09 '20 07:07 qxzhou1010

@qxzhou1010 Same problem here. I solved this issue by using develop branch. You can check diff in this link (https://github.com/nmslib/hnswlib/compare/develop).

jeongukjae avatar Jul 23 '20 08:07 jeongukjae