aewallin / opencamlib

open source computer aided manufacturing algorithms library
http://www.anderswallin.net/CAM
GNU Lesser General Public License v2.1
409 stars 138 forks source link

Build failing on current master branch. #156

Closed sliptonic closed 1 year ago

sliptonic commented 1 year ago

Trying to build on PopOS.

[100%] Linking CXX shared module ../ocl.so /usr/bin/c++ -fPIC -fopenmp -O3 -DNDEBUG -flto -fno-fat-lto-objects -shared -o ../ocl.so CMakeFiles/ocl.dir/pythonlib/ocl_cutters.cpp.o CMakeFiles/ocl.dir/pythonlib/ocl_geometry.cpp.o CMakeFiles/ocl.dir/pythonlib/ocl_algo.cpp.o CMakeFiles/ocl.dir/pythonlib/ocl_dropcutter.cpp.o CMakeFiles/ocl.dir/pythonlib/ocl.cpp.o ../libocl_common.a ../libocl_dropcutter.a ../libocl_cutters.a ../libocl_geo.a ../libocl_algo.a /usr/lib/x86_64-linux-gnu/libboost_python310.a /usr/lib/gcc/x86_64-linux-gnu/11/libgomp.so /usr/lib/x86_64-linux-gnu/libpthread.a lto-wrapper: warning: using serial compilation of 11 LTRANS jobs /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python310.a(builtin_converters.o): warning: relocation against _ZTIi@@CXXABI_1.3' in read-only section.text' /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libboost_python310.a(list.o): relocation R_X86_64_PC32 against undefined symbol `PyList_Type' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status make[2]: [src/CMakeFiles/ocl.dir/build.make:172: ocl.so] Error 1 make[1]: [CMakeFiles/Makefile2:192: src/CMakeFiles/ocl.dir/all] Error 2 make: *** [Makefile:156: all] Error 2

vespakoen commented 1 year ago

Your boost ist not compiled to allow for static linking, you can use the install.sh script to download a precompiled boost version for you or compile it yourself with static linking support

see: https://github.com/vespakoen/boost-python-precompiled

petterreinholdtsen commented 1 year ago

I solved this by switching to the dynamic library using this patch.

--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -99,7 +99,7 @@ endif()
 include_directories(${CMAKE_CURRENT_BINARY_DIR})

 set(Boost_DEBUG ON CACHE BOOL "boost-debug")
-set(Boost_USE_STATIC_LIBS ON CACHE BOOL "boost-use-static-libs")
+#set(Boost_USE_STATIC_LIBS ON CACHE BOOL "boost-use-static-libs")
 if(DEFINED ENV{BOOST_ROOT} OR DEFINED BOOST_ROOT)
   set(Boost_NO_SYSTEM_PATHS ON)
 endif()
vespakoen commented 1 year ago

Great!

We should probably be adding an option for that to our CMakeLists.txt ;)

petterreinholdtsen commented 1 year ago

[Koen Schmeets]

We should probably be adding an option for that to our CMakeLists.txt ;)

I am trying to prepare an upload of opencamlib to Debian, and such option would be useful. Have met quite a few obstacles in the build process, this was just the first of them. :)

I am on IRC, #debian-science on irc.debain.org, if someone want to help out. :)

-- Happy hacking Petter Reinholdtsen