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

Unable to compile on Mac OS Sierra #3

Closed
cniedotus opened this issue May 26, 2017 · 2 comments
Closed

Unable to compile on Mac OS Sierra #3

cniedotus opened this issue May 26, 2017 · 2 comments

Comments

@cniedotus
Copy link
Contributor

python setup.py build_ext --inplace

gave the following output:

running build_ext
building '_BLP' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/chengnie/anaconda/include -arch x86_64 -I/Users/chengnie/anaconda/include/python3.5m -c _BLP.c -o build/temp.macosx-10.7-x86_64-3.5/_BLP.o -fopenmp
"TERMCAP", line 20, col 1, terminal 'SC': Missing separator
clang: error: unsupported option '-fopenmp'
error: command 'gcc' failed with exit status 1

Is it because it is a Intel processor on Mac? I saw in the file name has amd64 in it.

Is there some way I can use it on Mac?

BTW, I really enjoy reading your beautiful code.

@cniedotus
Copy link
Contributor Author

cniedotus commented May 26, 2017

Fixed it.

FIrst of all, the default gcc on MacOS is from Xcode, which does not support openmp. Therefore, I installed a newer (4.8.5) version of gcc using:

conda install -c anaconda gcc

Then, I run the installation again:
python setup.py build_ext --inplace

It would have the following error:

running build_ext
building '_BLP' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/chengnie/anaconda/include -arch x86_64 -I/Users/chengnie/anaconda/include/python3.5m -c _BLP.c -o build/temp.macosx-10.7-x86_64-3.5/_BLP.o -fopenmp
_BLP.c:453:31: fatal error: numpy/arrayobject.h: No such file or directory
#include "numpy/arrayobject.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1

Then I modified the setup.py file by adding the following line to Line 23:

include_dirs=[numpy.get_include()],

Now I can install the package and run it without any issue. It was way faster than the Matlab code. Thank you, @joonro !

@joonro
Copy link
Owner

joonro commented May 27, 2017

Hi -

Thank you very much for the kind words. I'm glad it was useful for you.

@joonro joonro closed this as completed May 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants