clang++ - Boost.Python Link Error with Python3 and virtualenv -
i got following error when tried compile .cpp
file clang++
.
ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation)
i set python
, boost-python
follows.
python
i installed python 3.6.0 using pyenv-virtualenv
(via homebrew
)
boost-python
i used homebrew
in python 3 environment.
$ source activate py36 $ brew install boost-python --with-python3 --without-python
~/.bash_profile
my ~/.bash_profile
looks this:
export pyenv_root="/usr/local/var/pyenv" export pyenv_virtualenv_disable_prompt=1 export cplus_include_path="$cplus_include_path:/usr/local/var/pyenv/versions/3.6.0/include/python3.6m/" if pyenv > /dev/null; eval "$(pyenv init -)"; fi if pyenv-virtualenv-init > /dev/null; eval "$(pyenv virtualenv-init -)" ; fi
test cpp
this file tried compile , failed (saved test.cpp
).
#define boost_python_static_lib #include <boost/python.hpp> using namespace boost::python; char const* say(){ return "hello, world"; } boost_python_module( hello ){ boost::python::def( "say", ); }
makefile
cc = clang++ include = -i`python -c 'from distutils.sysconfig import *; print(get_python_inc())’` boost = -lboost_python3.6 -lboost_serialization fmath = -fomit-frame-pointer -fno-operator-names -msse2 -mfpmath=sse -march=native cflags = -std=c++11 -l/usr/local/lib -o3 cflags_so = -shared -fpic -std=c++11 -l/usr/local/lib -o3 link = -l/usr/local/cellar/boost-python/1.64.0/lib/ install: $(cc) test.cpp -o hello.so $(include) $(boost) $(link) $(fmath) $(cflags_so)
error
make install
returns error.
clang++ test.cpp -o hello.so -i`python -c 'from distutils.sysconfig import *; print(get_python_inc())’` -lboost_python3.6 -lboost_serialization -l/usr/local/cellar/boost-python/1.64.0/lib/ -fomit-frame-pointer -fno-operator-names -msse2 -mfpmath=sse -march=native -shared -fpic -std=c++11 -l/usr/local/lib -o3 -v /bin/sh: command substitution: line 0: unexpected eof while looking matching `'' /bin/sh: command substitution: line 1: syntax error: unexpected end of file apple llvm version 8.1.0 (clang-802.0.42) target: x86_64-apple-darwin16.6.0 thread model: posix installeddir: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin clang -cc1 version 8.1.0 (clang-802.0.42) default target x86_64-apple-darwin16.6.0 ignoring nonexistent directory "-lboost_python3.6" ignoring nonexistent directory "/usr/include/c++/v1" #include "..." search starts here: #include <...> search starts here: . /usr/local/var/pyenv/versions/3.6.0/include/python3.6m /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../include/c++/v1 /usr/local/include /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../lib/clang/8.1.0/include /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/include /usr/include /system/library/frameworks (framework directory) /library/frameworks (framework directory) end of search list. "/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/ld" -demangle -lto_library /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/lib/liblto.dylib -dynamic -dylib -arch x86_64 -macosx_version_min 10.12.0 -o hello.so -l/usr/local/cellar/boost-python/1.64.0/lib/ -l/usr/local/lib /var/folders/rm/qv81g4ss29j_gv1b366rl2080000gp/t/test-16790a.o -lboost_serialization -lc++ -lsystem /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/../lib/clang/8.1.0/lib/darwin/libclang_rt.osx.a undefined symbols architecture x86_64: <lines omitted> ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) make: *** [install] error 1
Comments
Post a Comment