Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenPNP MacOS 10.14 - Seg fault when starting the stream with Cap_openStream() #73

Open
Amanda-M-UK opened this issue May 3, 2024 · 0 comments

Comments

@Amanda-M-UK
Copy link

Amanda-M-UK commented May 3, 2024

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,-ld_classic" to set_target_properties() in CMakeLists.txt. Adding the ld_classic statement means that dynamic_cast<> can be used.

Amanda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant