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

MacOS 10.12.1 build #10

Closed
scbarton opened this issue Nov 20, 2016 · 3 comments
Closed

MacOS 10.12.1 build #10

scbarton opened this issue Nov 20, 2016 · 3 comments

Comments

@scbarton
Copy link

Hi, I'm trying to build for MacOS using homebrew to install swig. I get through the unit tests, but make install fails because a bunch of python symbols are not found:

[ 83%] Linking CXX shared module _Custom.so
cd /Users/scott/Documents/Code/git/KMCLib/c++/build/wrap && /usr/local/Cellar/cmake/3.6.2/bin/cmake -E cmake_link_script CMakeFiles/_Custom.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++   -O3 -fPIC -Wall -Wextra -Werror -pedantic -stdlib=libc++  -std=c++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -bundle -Wl,-headerpad_max_install_names  -o _Custom.so CMakeFiles/_Custom.dir/customPYTHON_wrap.cxx.o -framework python ../custom/libcustom.a ../src/libsrc.a 
Undefined symbols for architecture x86_64:
  "_PyInstanceMethod_New", referenced from:
      SWIG_PyInstanceMethod_New(_object*, _object*) in customPYTHON_wrap.cxx.o
  "_PyModule_Create2", referenced from:
      _PyInit__Custom in customPYTHON_wrap.cxx.o
  "_PyUnicode_Concat", referenced from:
      SwigPyObject_repr(SwigPyObject*) in customPYTHON_wrap.cxx.o
  "_PyUnicode_DecodeUTF8", referenced from:
      SWIG_From_std_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in customPYTHON_wrap.cxx.o
  "_PyUnicode_FromFormat", referenced from:
      SwigPyObject_repr(SwigPyObject*) in customPYTHON_wrap.cxx.o
      SwigPyPacked_repr(SwigPyPacked*) in customPYTHON_wrap.cxx.o
      SwigPyPacked_str(SwigPyPacked*) in customPYTHON_wrap.cxx.o
  "_PyUnicode_FromString", referenced from:
      SWIG_Python_GetSwigThis(_object*) in customPYTHON_wrap.cxx.o
      SWIG_Python_NewPointerObj(_object*, void*, swig_type_info*, int) in customPYTHON_wrap.cxx.o
      SWIG_Python_DestroyModule(_object*) in customPYTHON_wrap.cxx.o
      SwigPyPacked_str(SwigPyPacked*) in customPYTHON_wrap.cxx.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [wrap/_Custom.so] Error 1
make[1]: *** [wrap/CMakeFiles/_Custom.dir/all] Error 2
make: *** [all] Error 2

I installed swig using homebrew and not macports, and I wonder if something is missing?

@scbarton
Copy link
Author

I resolved my own issue. The problem was the python library location, which was set to the system python library and I was using a homebrew-installed python library.

After running cmake, I used ccmake to set the library to the proper path before running make.

@scbarton
Copy link
Author

I will add, however, that this only worked using Python 2.7. I tried building with Python 3.5 and obtained similar errors.

@PytLab
Copy link
Contributor

PytLab commented Dec 8, 2016

I built it successfully on ubuntu with Python.h(python3) included when building, so it may still be the problem of your python include or library path.
By the way, according to my knowledge about KMCLib, the python front end interfaces are written in Python2.x without compatibility with python 3, so it's better to use it with python2.7 only I think :)

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