Right now I’m trying to compile a project using an SDK from a service on system A. Currently my shared library compiles fine with this SDK, but when I try to move this library to use on system B, I’m noticing now that it’s causing crashes with the program I’m trying to use it with.
For further context:
System A:
uses packages a & b from the SDK
System B:
uses another shared library with packages b & c from the SDK
I want to avoid having to include package a on this system
Right now I’m seeing 2 different crashes at consistent points.
Crashes in the code that never crashed before that are completely unrelated to the SDK what so ever. - And when I recompile the library without the use of the SDK, that code path functions 100% fine again.
Crashes that show the stack related to package c which I have not touched at all (and again this package I do not include in system A during build as it is not needed in my library).
Right now I’m trying to figure out why this new library would be causing crashes to my program. When I try to isolate the library using another program, it works fine. No crashes and functions as expected. But for some reason it looks like when I try to include this library with this existing program, it causes crashes related to the SDK, and even not related to the SDK. I think maybe it’s related with how I am compiling things, or potentially a clash in the libraries? any insight is very appreciated!
This is probably not related to CMake at all.
I’d suspect that somehow you use 2 different versions of some libraries (maybe the SDK itself) on those systems and the libraries are not properly versioned (SONAME), which leads to ABI incompatibility.
Your code may be working by coincidence, but it may already have symbols from the SDK, which may be incompatible with the version you have on system B. Or something more complicated.
Check all te versions first. Also check the output of ldd for any libraries without version suffixes, because those can also be the culprit.
Given what you’ve posted, I’ve now aligned the version used from the SDKs and I’ve checked the library version suffixes, but I’m still seeing this issue.
From here I want to try to compile my libraries and have the shared SDK library b linked and then when I move the compiled library to system B relink it to the library b on that system. However when I check ldd I don’t see library b linked at all.
Strangely enough, the other libraries that I did specify I do see linked under ldd. For context my cmake file I’m using is something along the lines of:
with an absence of entries for `sdk_lib_a` and `sdk_lib_b`.
I’ve tried using PUBLIC as well, and with -DBUILD_SHARED_LIBS=OFF and ON. I also have -DMAKE_BUILD_TYPE=Release, but I don’t think that would have any effect on things. Any output for how to achieve this would be greatly appreciated!