Ultimaker / libArcus

Communication library between internal components for Ultimaker software

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OSX build failure - seg fault.

devonjones opened this issue · comments

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/Users/devonjones/.pyenv/cura/ -DPYTHON_INCLUDE_DIR=../python3.5 -DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))") -DSIP_INCLUDE_DIR=../../sip-4.19.11 -DBUILD_STATIC=ON -DBUILD_PYTHON=ON -DBUILD_EXAMPLES=OFF ..

-- Found SIP version: 4.19.11
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/devonjones/Dropbox/projects/Software/3d_printer/libArcus/build
(cura) devonjones@devonjones 0 ~/Dropbox/projects/Software/3d_printer/libArcus/build $ make
Scanning dependencies of target Arcus
[ 5%] Building CXX object CMakeFiles/Arcus.dir/src/Socket.cpp.o
[ 11%] Building CXX object CMakeFiles/Arcus.dir/src/SocketListener.cpp.o
[ 17%] Building CXX object CMakeFiles/Arcus.dir/src/MessageTypeStore.cpp.o
[ 23%] Building CXX object CMakeFiles/Arcus.dir/src/PlatformSocket.cpp.o
[ 29%] Building CXX object CMakeFiles/Arcus.dir/src/Error.cpp.o
[ 35%] Linking CXX static library libArcus.a
[ 35%] Built target Arcus
[ 41%] Generating python/sipArcuspart0.cpp, python/sipArcuspart1.cpp, python/sipArcuspart2.cpp, python/sipArcuspart3.cpp, python/sipArcuspart4.cpp, python/sipArcuspart5.cpp, python/sipArcuspart6.cpp, python/sipArcuspart7.cpp

make[2]: *** [python/sipArcuspart0.cpp] Segmentation fault: 11
make[2]: *** Deleting file `python/sipArcuspart0.cpp'
make[1]: *** [CMakeFiles/python_module_Arcus.dir/all] Error 2
make: *** [all] Error 2

Also as a note, instructions for building should tell a person how to tell CMAKE to find python and SIP.

I had to search for an hour or two to figure out
-DPYTHON_INCLUDE_DIR=../python3.5
-DPYTHON_LIBRARY=$(python -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
-DSIP_INCLUDE_DIR=../../sip-4.19.11

Failed on master and on tag 2.7.0

Also as a note, instructions for building should tell a person how to tell CMAKE to find python and SIP.

I'd expect CMake to find the installation on your system by itself. Was that not working? Maybe we need to submit a PR to CMake to add some hints to their Find scripts. The directories that you're indicating though seem to be very specific to your development environment. Normally it's sufficient to then indicate to CMake what the directory is of the PythonInterp project (in the _DIR variable) and it'll find the headers and library itself. That's how CMake normally operates.

Apart from that, it looks like your SIP executable had a segfault. SIP is upstream for us so we can't really debug it that well, but it might help if you are able to get a stack trace from GDB or something. It's very likely that your SIP installation was not made for the Python version that you're using.

I'm not able to reproduce this bug myself. No segfaults on Linux.

I'm having the same problem: building libArcus fails with a segmentation fault.

Cmake did not find sip or python, I ran export CMAKE_INCLUDE_PATH=$CMAKE_INCLUDE_PATH:/usr/include/python3.6m before running cmake .., and this was the only way I could get cmake to succeed.

I do a lot of work in python and have many installs managed by pyenv, but I attempted to force cmake to use the system install by running export PATH=/usr/bin:$PATH before running make

(I am working on a script to build CuraEngine 4.0.0, so I would like to avoid using the gui if possible)

The error I received is copied below:

Scanning dependencies of target Arcus
[  4%] Building CXX object CMakeFiles/Arcus.dir/src/Socket.cpp.o
[  9%] Building CXX object CMakeFiles/Arcus.dir/src/SocketListener.cpp.o
[ 13%] Building CXX object CMakeFiles/Arcus.dir/src/MessageTypeStore.cpp.o
[ 18%] Building CXX object CMakeFiles/Arcus.dir/src/PlatformSocket.cpp.o
[ 22%] Building CXX object CMakeFiles/Arcus.dir/src/Error.cpp.o
[ 27%] Linking CXX shared library libArcus.so
[ 27%] Built target Arcus
[ 31%] Generating python/sipArcuspart0.cpp, python/sipArcuspart1.cpp, python/sipArcuspart2.cpp, python/sipArcuspart3.cpp, python/sipArcuspart4.cpp, python/sipArcuspart5.cpp, python/sipArcuspart6.cpp, python/sipArcuspart7.cpp

CMakeFiles/python_module_Arcus.dir/build.make:65: recipe for target 'python/sipArcuspart0.cpp' failed
make[2]: *** [python/sipArcuspart0.cpp] Segmentation fault
make[2]: *** Deleting file 'python/sipArcuspart0.cpp'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/python_module_Arcus.dir/all' failed
make[1]: *** [CMakeFiles/python_module_Arcus.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2
[ 27%] Built target Arcus
[ 31%] Generating python/sipArcuspart0.cpp, python/sipArcuspart1.cpp, python/sipArcuspart2.cpp, python/sipArcuspart3.cpp, python/sipArcuspart4.cpp, python/sipArcuspart5.cpp, python/sipArcuspart6.cpp, python/sipArcuspart7.cpp

CMakeFiles/python_module_Arcus.dir/build.make:65: recipe for target 'python/sipArcuspart0.cpp' failed
make[2]: *** [python/sipArcuspart0.cpp] Segmentation fault
make[2]: *** Deleting file 'python/sipArcuspart0.cpp'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/python_module_Arcus.dir/all' failed
make[1]: *** [CMakeFiles/python_module_Arcus.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

Any help is appreciated, please let me know if I can provide any other information.

If you don't need the GUI, you might as well turn off the ENABLE_ARCUS CMake option. That would make it a lot easier in your case.

The build seems to be failing because the SIP executable has a segfault while generating the .cpp files that constitute the Python bindings for libArcus. Maybe there is a bug in SIP? Maybe you compiled SIP yourself and that now has a segfault because of that? Maybe that version of SIP was meant for different versions of CPython?

It seems that my problem is with the system installation of python, I've messed it up somehow. I was trying to use the system pip and it gives the error: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. My research suggests that this can happen when you build things from source so I may have tried to overwrite the system installation? I honestly don't know because I just use pyenv now.

Instead of trying to fix my system installation I decided to use a docker container and when I did, libArcus built fine. I would say this isn't a problem with libArcus. Thanks for your help.