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

Building on OS X 10.9 fails at "python setup.py build_ext --inplace" #16

Closed
chenosaurus opened this issue Feb 26, 2015 · 11 comments
Closed

Comments

@chenosaurus
Copy link

running build_ext
building 'opensfm.csfm' extension
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include/eigen3 -Iopensfm/src/third_party -Iopensfm/src/third_party/akaze/lib -Iopensfm/src/third_party/vlfeat -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c opensfm/src/csfm.cc -o build/temp.macosx-10.6-intel-2.7/opensfm/src/csfm.o -std=c++11
In file included from opensfm/src/csfm.cc:12:
In file included from opensfm/src/bundle.h:12:
In file included from /usr/local/include/ceres/ceres.h:37:
In file included from /usr/local/include/ceres/autodiff_cost_function.h:134:
In file included from /usr/local/include/ceres/sized_cost_function.h:41:
In file included from /usr/local/include/ceres/types.h:42:
/usr/local/include/ceres/internal/port.h:62:7: error: no member named 'shared_ptr' in namespace 'std'; did you mean 'boost::shared_ptr'?
using std::shared_ptr;
^~~~~
/usr/local/include/boost/smart_ptr/shared_ptr.hpp:722:36: note: 'boost::shared_ptr' declared here
template friend class shared_ptr;
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1

@paulinus
Copy link
Member

thanks for reporting. I have no osx 10.9 close to debug. According to this, it seems related to clang using libstdc++.

Can you try compiling with the option -stdlib=libc++ ?

@chenosaurus
Copy link
Author

hmm, a different error that doesn't really make sense ;( Running that command directly works tho. It only fails when running thru "python setup.py build_ext --inplace"

running build_ext
building 'opensfm.csfm' extension
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include/eigen3 -Iopensfm/src/third_party -Iopensfm/src/third_party/akaze/lib -Iopensfm/src/third_party/vlfeat -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c opensfm/src/csfm.cc -o build/temp.macosx-10.6-intel-2.7/opensfm/src/csfm.o -stdlib=libc++
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
error: command '/usr/bin/clang' failed with exit status 1

@paulinus
Copy link
Member

It seems the -std=c++11 is missing on the last command. Try using both -std=c++11 and -stdlib=libc++

@chenosaurus
Copy link
Author

I updated setup.py ln 107 to be:
extra_compile_args=['-std=c++11', '-stdlib=libc++'],

still getting same error.

$ python setup.py build_ext --inplace
running build_ext
building 'opensfm.csfm' extension
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include/eigen3 -Iopensfm/src/third_party -Iopensfm/src/third_party/akaze/lib -Iopensfm/src/third_party/vlfeat -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c opensfm/src/csfm.cc -o build/temp.macosx-10.6-intel-2.7/opensfm/src/csfm.o -std=c++11 -stdlib=libc++
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
error: command '/usr/bin/clang' failed with exit status 1

@chenosaurus
Copy link
Author

Perhaps OS X is not the best env for working on this, I will try this in linux

@paulinus
Copy link
Member

We do use OS X, should be no problem. It is weird that running the compilation line manually works, and not within setup.py. Can you try building with cmake?

@chenosaurus
Copy link
Author

This fixed the issue:

extra_compile_args=['-std=c++11', '-stdlib=libc++', '-mmacosx-version-min=10.7'],

now hitting a missing library, should be easier to fix:

/usr/bin/clang++ -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-2.7/opensfm/src/csfm.o -L/usr/local/lib -Lbuild/temp.macosx-10.6-intel-2.7 -lceres -lglog -lgflags -lboost_python -lvl -lmv -lakaze -o /Users/dchen/workspace/3rd-party/OpenSfM/opensfm/csfm.so
ld: library not found for -lvl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang++' failed with exit status 1

@chenosaurus
Copy link
Author

Do you have any information on installing visualization library in os x?

@paulinus
Copy link
Member

So vl is one of the static libraries generated by setup.py itself. Should be build when running

python setup.py build_clib

before

python setup.py build_ext --inplace

@chenosaurus
Copy link
Author

Ah gotcha, got it built, thank you for the assistance!

@paulinus
Copy link
Member

Cool, I've added the flags. Thanks for reporting!

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