I have implemented the openpnp-capture library for both Linux and MacOS. Linux works perfectly as does macOS ARM64 and macOS Ventura x86-64. However, when I test on 10.14 (the earliest macOS that my application supports), I get a seg fault when running Cap_openStream().
I initialise the library in the constructor of my class by using:
On macOS 10.14 the line above causes a segmentation fault. Unfortunately, my debugger is not giving me any further information. I have made absolutely sure that I am building the library with CMAKE_OSX_DEPLOYMENT_TARGET=10.14
Is there any help you can offer?
EDIT:
I have traced the seg to the following function in platfromstream.mm
I have stopped the seg fault by changing dynamic_cast<> to use a C cast (platformDeviceInfo*)device
Not sure why this should have stopped the crash though.
EDIT 3
For anybody is else experiencing this problem, the best solution is to _LINK_FLAGS "-Wl,-ldclassic" to set_target_properties() in CMakeLists.txt. Adding the ld_classic statement means that dynamic_cast<> can be used.
I have implemented the openpnp-capture library for both Linux and MacOS. Linux works perfectly as does macOS ARM64 and macOS Ventura x86-64. However, when I test on 10.14 (the earliest macOS that my application supports), I get a seg fault when running Cap_openStream().
I initialise the library in the constructor of my class by using:
Cap_setLogLevel(9) Cap_openStream
Afterwards, in another method, I call
m_stream_id = Cap_openStream(m_ctx, m_camera_id, 0);
On macOS 10.14 the line above causes a segmentation fault. Unfortunately, my debugger is not giving me any further information. I have made absolutely sure that I am building the library with CMAKE_OSX_DEPLOYMENT_TARGET=10.14
Is there any help you can offer?
EDIT:
I have traced the seg to the following function in platfromstream.mm
platformDeviceInfo *dinfo = dynamic_cast<platformDeviceInfo*>(device);
EDIT 2
I have stopped the seg fault by changing dynamic_cast<> to use a C cast (platformDeviceInfo*)device
Not sure why this should have stopped the crash though.
EDIT 3
For anybody is else experiencing this problem, the best solution is to _LINK_FLAGS "-Wl,-ldclassic" to set_target_properties() in CMakeLists.txt. Adding the ld_classic statement means that dynamic_cast<> can be used.
Amanda