Open mmichaelzhang opened 7 years ago
Yes I am facing the same issue. Any resolution found?
So far no good news. I chose to run pypoisson on a linux system, which separated my code into two parts.
Hope you good luck :)
I wanted it for R tool support. So I switched to lower version of R and resolved the issues.
I just ran into this problem, I will try to find a solution by my own. But if anyone got a solution in the meantime, I am interested :)
find this solved my problem https://daijiang.name/en/2017/06/21/fopenmp-option-of-clang-error/
Same issue.
I just tried to install the package as well from a mac. I managed to install but am still not able to run the examples.
I have previously installed gcc and g++ with homebrew. Then, exporting and aliasing them, as export CC=/usr/local/bin/gcc-8 export CXX=/usr/local/bin/g++-8 alias gcc=‘/usr/local/bin/gcc-8’ alias g++=‘/usr/local/bin/g++-8’
enables me to succesfully run
python setup.py build python setup.py install
after modifying the first line of pypoisson.pyx,
to
However, running python test.py halts to the error
Traceback (most recent call last):
File "test.py", line 1, in
and so far I haven't been able to advance from here. When it says this has been tried on OSX, I wonder how and what is the environment like?
I tested 5 years ago so sorry I don’t remember the last exact environment I used.
Thanks for the quick reply!
I actually just gor forward. The issue was solved by changing the line extra_link_args=["-fopenmp"] to (in my case, since I'm using gcc version 8) extra_link_args=["-fopenmp",'-Wl,-rpath,/usr/local/opt/gcc/lib/gcc/8/'] in setup.py (and rebuilding/installing) This has been mentioned in e.g. https://github.com/lesgourg/class_public/issues/208
(After this, example/test.py yields segmentation fault 11, I'll check out the other issue thread)
I believe I did with gcc 5.x version.
Thanks for the reply! I was able to install with the above modifications, but for some reason the example segfaults (this does not change when changing e.g. depth in the program, just changes the time it takes before the segfault).
Here's another solution I found (with clang llvm installed):
brew install llvm libomp
# Using compiler of clang with llvm installed
os.environ["CC"] = "/usr/local/opt/llvm/bin/clang"
os.environ["CXX"] = "/usr/local/opt/llvm/bin/clang++"
# Add include/link dirs, and modify the stdlib to libc++
exts = [Extension("pypoisson", sources,
include_dirs=["/usr/local/opt/llvm/include"],
library_dirs=["/usr/local/opt/llvm/lib"],
language="c++",
extra_compile_args=["-w", "-fopenmp", '-stdlib=libc++'],
extra_link_args=["-fopenmp", '-stdlib=libc++']
)]
@zehongs
I added this your code but It doen't work
In file included from src/PoissonRecon_v6_13/src/PlyFile.cpp:40: In file included from src/PoissonRecon_v6_13/src/Ply.h:220: In file included from src/PoissonRecon_v6_13/src/Geometry.h:390: src/PoissonRecon_v6_13/src/Geometry.inl:342:3: error: use of undeclared identifier 'iter' iter=edgeMap.find(e); ^ src/PoissonRecon_v6_13/src/Geometry.inl:343:6: error: use of undeclared identifier 'iter' if(iter==edgeMap.end())
here's what worked for me (haven't tested yet, but it compiles \o/)
brew reinstall gcc
brew reinstall libomp
export CC=/usr/local/bin/gcc-10
export CXX=/usr/local/bin/g++-10
In the file Geometry.inl
I changed this at line 328:
// #ifdef __linux__
// hash_map<long long,int>::iterator iter;
// #elif _WIN32
// std::map<long long, int>::iterator iter;
// #endif
std::map<long long, int>::iterator iter;
In the file Geometry.h
I added this at line 41:
#include <stdio.h>
After that, python setup.py build
and python setup.py install
work fine : )
...too bad, python test.py
fails with Segmentation fault: 11
there are several issues here.
the code requires a compiler that supports -fopenmp
. natively available clang does not.
-fopenmp
-- you need to specify CC=<path_to_gcc> CXX=<path_to_g++> python setup.py build
(simply passing CC
will not work).@you6878 's issue of not finding the right headers is because the code needs an additional macro. @r03ert0 's solution works but is not a great idea because it breaks the code on window. you should pass the __linux__
macro. see here.
Finally, the segfault that @r03ert0 and @patomaki reported may be related to this
Hi there,
I tried to run order "python setup.py build" on Mac OS 10.12.3, and got the error clang: error: unsupported option '-fopenmp'
I tried export CC=/usr/bin/gcc, gcc-6, clang or llvm-gcc, they all don't work.
for gcc-6 case, I got different error: gcc-6: error: unrecognized command line option '-Wshorten-64-to-32'
Has anyone encountered the same issue?
Thanks, Michael