gpt4 book ai didi

running the same executable on a different machine returns coredump and ldd coredump(在不同的机器上运行相同的可执行文件将返回coredump和ldd coredump。)

翻译 作者:bug小助手 更新时间:2023-10-26 22:46:43 32 4
gpt4 key购买 nike



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)

我在我的Ubuntu23.04上构建了一个可执行文件(mybin.out),并将它和它的所有依赖项(共享库)放在一个文件夹中(文件夹名=exec文件夹)。我将文件夹复制到另一台Linux机器(Ubuntu 20.04)上。我试图通过以下命令运行可执行文件:LD_LIBRARY_PATH=/PATH/TO/EXECFORDER/./PATH/TO/EXECFORDER/mybin.out,但我得到的只是段错误(内核转储)。我希望通过运行LD_LIBRARY_PATH=/PATH/to/execolder/ldd./PATH/to/execfolder/mybin.out获得mybin.out试图使用的共享库的列表。但我又一次遇到了分段故障(核心转储)


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

这个可执行文件(mybin.out)在我的Ubuntu 23.04上运行得很好,它使用的共享库与它自己的库来自同一个目录。


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

当Ubuntu 20.04拥有所有需要的共享库时,为什么我不能在Ubuntu 20.04上运行相同的可执行文件?


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

为什么LDD返回分段故障(核心转储)?


更多回答
优秀答案推荐

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.

为了在不同的平台上运行相同的可执行文件及其库,您需要有一个稳定且不变的ABI。通常,ABI在切换到较新的平台时会进行升级,因此,移植回为较新的平台构建的二进制代码将需要一些可能在较旧的平台上不存在的东西。


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.

为了在较新的平台上构建并在较旧的平台上交付,您需要针对适当的目标进行编译。核心转储是由于模块的ABI不匹配造成的。


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.

通常,您在每个平台上从源代码进行编译以避免此类问题。然而,如果两个版本之间的ABI没有改变,你可以在Ubuntu 20.04上构建,并在Ubuntu 23.04上复制它。请记住,Ubuntu 23.04不是LTS,因此兼容性可能会受到限制。


更多回答

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com