在Debian 9上编译了一个应用程序,当我尝试在CentosOS上运行时,我得到了
./app: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./app)
./app: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./app)
./app: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./app)
ldd ./app show
bash-4.2$ ldd app
./app: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./app)
./app: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./app)
./app: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./app)
linux-vdso.so.1 => (0x00007fff24901000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f45a97ff000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f45a94f8000)
libm.so.6 => /lib64/libm.so.6 (0x00007f45a91f5000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f45a8fdf000)
libc.so.6 => /lib64/libc.so.6 (0x00007f45a8c12000)
/lib64/ld-linux-x86-64.so.2 (0x00007f45a9a25000)
答案 0 :(得分:3)
您的程序可能隐式使用cgo
并生成一个可执行文件,该可执行文件取决于正在进行编译的主机的C++ ABI versions(Debian 9)。不幸的是,您的执行目标(CentOS 7)似乎具有不兼容的ABI。
您可以通过禁用cgo进行编译来验证,例如:
$ CGO_ENABLED=0 go build -o ./app ./app-folder
该命令可能会失败,因此您的选择可能会:
另请参阅Application binary interface (ABI)和GCC ABI Compatibility。