running the same executable on a different machine returns coredump and ldd coredump

39 Views Asked by At

I built an executable (mybin.out) on my Ubuntu 23.04 and put it and all its dependencies (shared libraries) in a folder (folder name=execfolder). I copied the folder to another Linux machine (Ubuntu 20.04). I tried to run the executable by LD_LIBRARY_PATH=/path/to/execfolder/ ./path/to/execfolder/mybin.out, but all I got was Segmentation fault (core dumped). I was hoping to get a list of shared libraries mybin.out was trying to use by running LD_LIBRARY_PATH=/path/to/execfolder/ ldd ./path/to/execfolder/mybin.out. but again I got Segmentation fault (core dumped)

The executable (mybin.out) runs on my Ubuntu 23.04 perfectly and it uses shared libraries from the same directory as its own's.

Why can't I run the same executable on Ubuntu 20.04 when it has all the shared libraries it needs?

and why is ldd returning Segmentation fault (core dumped)???

1

There are 1 best solutions below

0
Yennefer On

In order to run the same executable with it's libraries on different platforms, you need to have a stable and unchanged ABI. Usually, the ABI is upgraded when switching to a newer platforms, therefore, porting back a binary built for a newer platform will require things that may not be present on the older one.

In order to build on a newer platform and deliver on an older one, you need to compile against the proper target. The core dump comes by mismatching ABI of your modules.

Usually, you compile from source on each platform to avoid such issues. However, if the ABI between the two version hasn't changed, you can build on Ubuntu 20.04 and copying it on Ubuntu 23.04. Keep in mind that Ubuntu 23.04 is not an LTS, therefore the compatibility could be limited.