Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include stddef.h as well #18

Closed
wants to merge 1 commit into from
Closed

Include stddef.h as well #18

wants to merge 1 commit into from

Conversation

dustalov
Copy link

@dustalov dustalov commented Mar 4, 2017

Hello! I tried to compile Faiss on Fedora 24 with GCC 6.3.1, but the compilation, unfortunately, failed.

$ make
g++ -fPIC -m64 -Wall -g -O3  -msse4 -mpopcnt -fopenmp -Wno-sign-compare -Dnullptr=NULL -Doverride= -fopenmp -c hamming.cpp -o hamming.o  
<command-line>:0:9: error: 'NULL' was not declared in this scope
<command-line>:0:9: error: 'NULL' was not declared in this scope

I found two options for addressing this problem: to either substitute NULL with the “magical” 0 or to explicitly include stddef.h via command-line. I believe the latter option is more portable. It successfully worked for me on both Fedora 24 and CentOS 7 (GCC 4.8.5).

The present pull request contains the above-mentioned change to makefile.inc.Linux.

@mdouze
Copy link
Contributor

mdouze commented Mar 4, 2017

Hi,

Could you try by removing -Dnullptr=NULL flag?

@dustalov
Copy link
Author

dustalov commented Mar 4, 2017

Removing -Dnullptr=NULL works perfectly on GCC 6.3.1, but fails on GCC 4.8.5.

$ make
g++ -fPIC -m64 -Wall -g -O3  -msse4 -mpopcnt -fopenmp -Wno-sign-compare -Doverride= -fopenmp -c hamming.cpp -o hamming.o  
In file included from hamming.h:33:0,
                 from hamming.cpp:28:
Heap.h:191:9: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat]
         const typename C::T * x = nullptr,
         ^
Heap.h:191:35: error: 'nullptr' was not declared in this scope
         const typename C::T * x = nullptr,

@mdouze
Copy link
Contributor

mdouze commented Mar 4, 2017

Thanks for the report.

I added an entry in the troubleshooting section:

https://github.com/facebookresearch/faiss/wiki/Troubleshooting#nullnullptr0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants