SDK: Remove dynamic linking to OpenCV libraries

Hi,

our software depends on a different version of OpenCV than HemiStereo SDK does. This makes it impossible for our software to link against the HemiStereo SDK. Can the OpenCV dependency be removed or maybe static linking helps?

Thanks

André

Hi André,

thanks for the feedback. Static linking seems to be a good idea to prevent version conflicts. Currently, we still have some issues with static linking which have to be fixed first. I will try to provide an update soon.

Best regards,
Markus

Hi André,

we just released a new version of the SDK which is linked statically against OpenCV. Please try it again with the new release and let me know, if this fixes your issue.

Best regards,
Markus

Hi Markus,

thanks for the fast response.

The OpenCV problem seems to be fixed. But now there is a problem with Qt5.
I get the following error:

libosp_calib.so: symbol __cxa_throw_bad_array_new_length version Qt_5 not defined in file libQt5Gui.so.5 with link time reference

The system libraries of Qt5 have the same version as the Qt5 libraries shipped with the SDK (5.11.2).

Note: I only use libosp_core.so, libosp_calib.so and libosp_sdk.so from the SDK.

When I also use the Qt5 libraries form the SDK, I get

qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

IMO best solution would be to remove Qt5 dependency from lisosp_calib (and libosp_sdk).

André

Can you try it after creating a file qt.conf next to your executable with the following content, please?

[Paths]
Prefix="<HEMISTEREO_SDK_INSTALL_DIR>/thirdparty/Qt5"

Please replace <HEMISTEREO_SDK_INSTALL_DIR> with the SDK installation path. If you use CMake, you can also use the following function to generate the file automatically:

osp_generate_qt_conf(<DIRECTORY_WHICH_CONTAINS_YOUR_EXECUTABLE>)

The dependency comes from OpenCV (libopencv_highgui) which is compiled with Qt support. I will check if the dependency can be removed.

Using the qt.conf file results in fatal protobuf errors.

I think, this is not a Qt related error. Can you post the error message? libosp_sdk.so is linked statically against protobuf. Do you use protobuf in your application? If yes, do you use static or shared libs? Maybe you can try the static version provided by the SDK?

Yes, shared protobuf is used in my application. There is no easy way to switch to static protobuf because of the application structure.

Here is the error message

[libprotobuf ERROR google/protobuf/descriptor_database.cc:58] File already exists in database: google/protobuf/any.proto
[libprotobuf FATAL google/protobuf/descriptor.cc:1358] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size): 

Was the previous version of libosp_sdk.so already linked statically against protobuf?

Yes, the previous version was also linked statically against protobuf.
I compiled the SDK again using protobuf-lite. You can find it here. Could you try it and check, if this solves your issue, please?

This new version fixes the issue. Thanks.

Perfect! If you do not encounter any problems, we will ship it officially in the next release.

Everything seems to work, so far.

Have you tried to remove the opencv_highgui dependency from osp_calib and osp_sdk?

Yes I tried, but there is still some work to do. I will try to prepare a new release in the next week. I hope you can use the shipped Qt version in the meanwhile.

Hi André,

I was able to remove the Qt dependency from libosp_calib.so. Could you try this release, please?

Regards,
Markus

1 Like

Thanks. It’s working. Now qt.conf is no longer needed.