Linux console app built with binary library works on my machine, but not on others with same Linux version

Viewed 63

I have a Linux application written in C++ with proprietary source code so this question is about any mechanisms that could cause what I describe below to happen.

Anyway, the application uses some library functions that perform some data processing and spits out a result. On my machine, I get the expected result. On others, the app either segfaults or outputs nonsense.

It is distributed as a bit of source code and a static library, built on my machine, which can then be built with make and run (and possibly distributed). The OS environment is Ubuntu 18.04.4 LTS (WSL1) and is essentially the same on all of the machines.

The ldd utility indicates that the same libraries are being used and the Ubuntu and g++ versions are identical as well.

The application was run in gdb on one of the machines where it segfaults and it turned out that a specific buffer hadn't been allocated and was nullptr. The size parameter being passed to the constructor in this case is a #define macro.

I am aware that the preferred approach on Linux is to distribute source code, not precompiled binaries, but for IP protection purposes, that might not always be possible. I have also read that there could be subtle library version or kernel-level incompatibilities that can cause this kind of weirdness, but like I said, that doesn't seem to be the case here.

Q: Does anybody know why I might be observing this strange behavior?

0 Answers
Related