Segmentation fault when running BasicApp sample on Mac OS X

Hi all,

I just compiled Cinder from the master branch in Debug mode on Mac OS X using the clang compiler, following the CMake instructions at https://libcinder.org/docs/branch/master/guides/cmake/cmake.html.

When I compile and run the BasicApp sample, I get a segmentation fault. The output from the lldb debugger is as follows:

dedmunds ~/postdoc/libraries/Cinder_build/Debug/BasicApp/BasicApp.app/Contents/MacOS $ lldb BasicApp
(lldb) target create "BasicApp"
Current executable set to ‘BasicApp’ (x86_64).
(lldb) run
Process 25083 launched: ‘/Users/dedmunds/postdoc/libraries/Cinder_build/Debug/BasicApp/BasicApp.app/Contents/MacOS/BasicApp’ (x86_64)
error: libcinder.a(Platform.cpp.o) failed to load objfile for /Users/dedmunds/postdoc/libraries/Cinder/lib/macosx/Debug/libcinder.a
error: libcinder.a(PlatformCocoa.cpp.o) failed to load objfile for /Users/dedmunds/postdoc/libraries/Cinder/lib/macosx/Debug/libcinder.a
Process 25083 stopped

  • thread #1: tid = 0x117176, 0x000000010000e0bb BasicAppboost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*) + 27, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x000000010000e0bb BasicAppboost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*) + 27
    BasicApp`boost::filesystem::detail::status:
    -> 0x10000e0bb <+27>: testb $0x1, (%r15)
    0x10000e0bf <+31>: jne 0x10000e0c7 ; <+39>
    0x10000e0c1 <+33>: leaq 0x1(%r15), %rdi
    0x10000e0c5 <+37>: jmp 0x10000e0cb ; <+43>

It looks like boost::filesystem::path is making a bad memory access. Is this a known issue?

Kind regards,

Dave

Mostly likely you didn’t do a recursive clone that your boost submodule is not downloaded? It should reside in include/boost folder.

Hi seph,

Thanks, you’re right, a full recursive clone fixed it!

Dave

Hi,

I am having the exact same problem but with Ubuntu.
This is the tutorial that I followed: Cinder on Ubuntu
After entering

./Debug/BasicApp/BasicApp

I got the error message:

Segmentation fault (core dumped)

I also tried these fixes but didn’t work :sob:

Any advice on fixing this? thanks in advance!

Fred

Hi,

a crash report should ideally contain, at the very least, your exact OS version and a backtrace of the segfault in debug mode in order to be more helpful.

In any case, make sure that you remove completely the boost include folder that ships with Cinder in case you did a recursive clone before enabling the CINDER_BOOST_USE_SYSTEM option. Other than that I cannot think of something else if you have the development versions of boost-system and boost-filesystem installed through apt.

If this doesn’t work please provide the additional info and hopefully we can see what is happening there.

HTH,
Petros

Hi Petros,

Thank you for your reply, I am using Ubuntu 16.04 LTS. I am using Parallels to run Ubuntu.

These are the steps that I followed:

  1. git clone --recursive GitHub - cinder/Cinder: Cinder is a community-developed, free and open source library for professional-quality creative coding in C++.
  2. cd include && rm -rf boost
  3. cd …
  4. mkdir build
  5. cd build && cmake … -DCINDER_BOOST_USE_SYSTEM:BOOL=true

– The C compiler identification is GNU 5.4.0
– The CXX compiler identification is Clang 3.8.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
– Detecting C compile features
– Detecting C compile features - 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
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
– Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
– Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
– Looking for gethostbyname
– Looking for gethostbyname - found
– Looking for connect
– Looking for connect - found
– Looking for remove
– Looking for remove - found
– Looking for shmat
– Looking for shmat - found
– Looking for IceConnectionNumber in ICE
– Looking for IceConnectionNumber in ICE - found
– Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
– Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version “1.2.8”)
– Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version “7.47.0”)
– Found PkgConfig: /usr/bin/pkg-config (found version “0.29.1”)
– Checking for module ‘fontconfig’
– Found fontconfig, version 2.11.94
– Found Fontconfig: /usr/lib/x86_64-linux-gnu/libfontconfig.so
– Found MPG123: /usr/lib/x86_64-linux-gnu/libmpg123.so (found version “1.22.4”)
– using MPG123 headers at: /usr/include
– Found SNDFILE: /usr/lib/x86_64-linux-gnu/libsndfile.so (found version “1.0.25”)
– using SNDFILE headers at: /usr/include
– Found GLIB: /usr/include/glib-2.0;/usr/lib/x86_64-linux-gnu/glib-2.0/include (found version “2.48.2”)
– Checking for module ‘gstreamer-1.0’
– Found gstreamer-1.0, version 1.8.3
– Checking for module ‘gstreamer-base-1.0’
– Found gstreamer-base-1.0, version 1.8.3
– Checking for module ‘gstreamer-app-1.0’
– Found gstreamer-app-1.0, version 1.8.3
– Checking for module ‘gstreamer-audio-1.0’
– Found gstreamer-audio-1.0, version 1.8.3
– Checking for module ‘gstreamer-fft-1.0’
– Found gstreamer-fft-1.0, version 1.8.3
– Checking for module ‘gstreamer-gl-1.0’
– Found gstreamer-gl-1.0, version 1.8.3
– Checking for module ‘gstreamer-mpegts-1.0>=1.4.0’
– Found gstreamer-mpegts-1.0, version 1.8.3
– Checking for module ‘gstreamer-pbutils-1.0’
– Found gstreamer-pbutils-1.0, version 1.8.3
– Checking for module ‘gstreamer-tag-1.0’
– Found gstreamer-tag-1.0, version 1.8.3
– Checking for module ‘gstreamer-video-1.0’
– Found gstreamer-video-1.0, version 1.8.3
– Found GStreamer: GSTREAMER_INCLUDE_DIRS;GSTREAMER_LIBRARIES;GSTREAMER_VERSION;GSTREAMER_BASE_INCLUDE_DIRS;GSTREAMER_BASE_LIBRARIES
– Boost version: 1.55.0
– Found the following Boost libraries:
– system
– filesystem
– Performing Test COMPILER_SUPPORTS_CXX14
– Performing Test COMPILER_SUPPORTS_CXX14 - Success
– Performing Test COMPILER_SUPPORTS_CXX11
– Performing Test COMPILER_SUPPORTS_CXX11 - Success
– Configuring done
– Generating done
– Build files have been written to: /home/parallels/Cinder/build

  1. make -j4
  2. cd …
  3. cd samples/BasicApp/proj/cmake
  4. mkdir build && cd build
  5. cmake …

– The C compiler identification is GNU 5.4.0
– The CXX compiler identification is Clang 3.8.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
– Detecting C compile features
– Detecting C compile features - 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
– Detecting CXX compile features
– Detecting CXX compile features - done
– Configuring done
– Generating done
– Build files have been written to: /home/parallels/Cinder/samples/BasicApp/proj/cmake/build

  1. make

Scanning dependencies of target BasicApp
[ 50%] Building CXX object CMakeFiles/BasicApp.dir/home/parallels/Cinder/samples/BasicApp/src/BasicApp.cpp.o
[100%] Linking CXX executable Debug/BasicApp/BasicApp
/usr/bin/ld: warning: libboost_system.so.1.58.0, needed by //usr/lib/x86_64-linux-gnu/libmirclient.so.9, may conflict with libboost_system.so.1.55.0
/usr/bin/ld: warning: libboost_filesystem.so.1.58.0, needed by //usr/lib/x86_64-linux-gnu/libmircommon.so.7, may conflict with libboost_filesystem.so.1.55.0
[100%] Built target BasicApp

  1. ./Debug/BasicApp/BasicApp

Rendering with OpenGL Core Profile 3.2
(glfw:error): error=65543, desc=GLX: An OpenGL profile requested but GLX_ARB_create_context_profile is unavailable
Segmentation fault (core dumped)

Hi Fred,

This is a completely different game and issue, not related to Boost at all. The problem here lies on context creation due to the fact that you are trying to run the app inside the VM. Are you sure that Parallels supports OpenGL Core Profile on the Guest OS?

VirtualBox for example did not, last time I checked and VMWare does after following a few steps that are described in this wiki. The Compiling Cinder part is out-of-date so you can ignore that and follow the official guide but the notes for setting up VMWare with Core Profile support should be still relevant.

HTH,
Petros

P.S Irrelevant with the issue at hand but it seems also that you have multiple versions of Boost installed i.e 1.55 & 1.58 - Ideally you should pick one and stick with it.

Just to jump in here. I found this a few years ago (though using parallels and windows vm). It was because parallels didnt support the OpenGL version cinder required (as Petros mentioned). I switched to VMware Fusion for virtualisation and I could compile cinder projects fine after that.

There may be a way to manually target the lower version of OpenGL that parallels supports (see cinder RendererGl::Options().version options in the app macro). But I cant remember having much success with parallels so just switched.

NB. It may also be something else entirely as I haven’t used Cinder with linux but Parallels should definitely be an amber flag.

Thanks felixfiare and petros! It worked on VMware :smile:

1 Like