Build errors on x86_64 Mac OS X 10.8
Closed this issue · 3 comments
From @stephen-soltesz:
While attempting to build m-lab.libraries on a x86_64 Mac os x system, I encountered the following build errors. I've included tool versions that may be relevant.
$ cmake --version
cmake version 2.8.10
$ make --version
GNU Make 3.81
This program built for i386-apple-darwin11.3.0
$ uname -a
Darwin stephens-imac-5.lan 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
$ cmake -D CMAKE_BUILD_TYPE=Release CMakeLists.txt && make
-- The C compiler identification is Clang 4.1.0
-- The CXX compiler identification is Clang 4.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PythonInterp: /opt/local/bin/python (found version "2.7.3")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Found SWIG: /opt/local/bin/swig (found version "2.0.8")
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found version "2.7.2")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/soltesz/Downloads/m-lab.libraries/trunk
Scanning dependencies of target mlab
[ 3%] Building CXX object CMakeFiles/mlab.dir/src/client_socket.cc.o
[ 6%] Building CXX object CMakeFiles/mlab.dir/src/host.cc.o
[ 10%] Building CXX object CMakeFiles/mlab.dir/src/http.cc.o
[ 13%] Building CXX object CMakeFiles/mlab.dir/src/log.cc.o
[ 16%] Building CXX object CMakeFiles/mlab.dir/src/mlab.cc.o
[ 20%] Building CXX object CMakeFiles/mlab.dir/src/ns.cc.o
[ 23%] Building CXX object CMakeFiles/mlab.dir/src/server_socket.cc.o
[ 26%] Building CXX object CMakeFiles/mlab.dir/src/socket.cc.o
Linking CXX static library lib/libmlab.a
[ 26%] Built target mlab
Scanning dependencies of target mlabc
[ 30%] Building CXX object CMakeFiles/mlabc.dir/src/mlab.cc.o
Linking CXX static library lib/libmlabc.a
[ 30%] Built target mlabc
Scanning dependencies of target gtest
[ 33%] Building CXX object third_party/gtest-1.6.0/CMakeFiles/gtest.dir/src/gtest-all.cc.o
Linking CXX static library ../../lib/libgtest.a
[ 33%] Built target gtest
Scanning dependencies of target gtest_main
[ 36%] Building CXX object third_party/gtest-1.6.0/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
Linking CXX static library ../../lib/libgtest_main.a
[ 36%] Built target gtest_main
Scanning dependencies of target json-cpp
[ 40%] Building CXX object third_party/json-cpp/CMakeFiles/json-cpp.dir/src/lib_json/json_reader.cpp.o
[ 43%] Building CXX object third_party/json-cpp/CMakeFiles/json-cpp.dir/src/lib_json/json_value.cpp.o
[ 46%] Building CXX object third_party/json-cpp/CMakeFiles/json-cpp.dir/src/lib_json/json_writer.cpp.o
Linking CXX static library lib/libjson-cpp.a
[ 46%] Built target json-cpp
[ 50%] Swig source
Scanning dependencies of target _mlabpy
[ 50%] Swig source
[ 53%] Building CXX object swig/CMakeFiles/_mlabpy.dir/mlabPYTHON_wrap.cxx.o
/Users/soltesz/Downloads/m-lab.libraries/trunk/swig/mlabPYTHON_wrap.cxx:2386:23: error: explicitly assigning a variable of type
'int' to itself [-Werror,-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
/Users/soltesz/Downloads/m-lab.libraries/trunk/swig/mlabPYTHON_wrap.cxx:2389:23: error: explicitly assigning a variable of type
'int' to itself [-Werror,-Wself-assign]
res = SWIG_AddCast(res);
~~~ ^ ~~~
/Users/soltesz/Downloads/m-lab.libraries/trunk/swig/mlabPYTHON_wrap.cxx:5383:3: error: expression result unused; should this
cast be to 'void'? [-Werror,-Wunused-value](void *)clientdata;
^ ~
3 errors generated.
make[2]: *** [swig/CMakeFiles/_mlabpy.dir/mlabPYTHON_wrap.cxx.o] Error 1
make[1]: *** [swig/CMakeFiles/_mlabpy.dir/all] Error 2
make: *** [all] Error 2
This is a known issue with swig, python, and osx 10.8. There are a few solutions floating around but most involve changing the system rather than the code.
I believe this comes down to using one Python for the dylib and one for headers. Try passing -DPYTHON_INCLUDE_DIR=/some/path to cmake to force the headers to be the matching ones.
Also, just for completeness:
-DPYTHON_LIBRARY=/usr/lib/libpython2.7.dylib -DPYTHON_INCLUDE_DIR=/usr/include/python2.7