简体   繁体   English

“没有符号版本的版本符号”

[英]“No symbol version section for versioned symbol”

I'm attempting to cross-compile my own shared library (libmystuff.so) against another shared library (libtheirstuff.so) that makes use of the libcurl shared library and am getting the following error: 我试图将我自己的共享库(libmystuff.so)与另一个使用libcurl共享库的共享库(libtheirstuff.so)交叉编译,并收到以下错误:

libmystuff.so: No symbol version section for versioned symbol 
'curl_global_init@@CURL_OPENSSL_3'

Which is then followed by: 然后是:

final link failed: Nonrepresentable section on output.

Going through the code that creates libtheirstuff, I can see that curl_global_init is the first reference to curl. 通过创建libtheirstuff的代码,我可以看到curl_global_init是对curl的第一个引用。

Doing ldd libtheirstuff.so on the target platform (arm5) shows that it can find all of the references. 在目标平台(arm5)上执行ldd libtheirstuff.so ,表明它可以找到所有引用。

What's going on here? 这里发生了什么?

Edit: Here are the calls to gcc 编辑:这是对gcc的调用

arm-none-linux-gnueabi-gcc -fPIC -c mystuff_impl.c -o mystuff_impl.o -I/home/me/arm/include
arm-none-linux-gnueabi-gcc -shared -Wl,soname=libmystuff.so -o libmystuff.so.0.1 mystuff_impl.o -L/home/me/arm/lib -ltheirstuff

链接器获取的版本错误。

This problem ( No symbol version section for versioned symbol 'curl_global_init@@CURL_OPENSSL_3' ) also appears when you are trying to compile a binary that will work on multiple Linux distributions. 当您尝试编译可在多个Linux发行版上运行的二进制文件时,也会出现此问题( No symbol version section for versioned symbol 'curl_global_init@@CURL_OPENSSL_3' )。 You can check for the problem like this: 您可以像这样检查问题:

$ objdump -x mybinary | grep curl_global_init
0... F *UND*  0... curl_global_init@@CURL_OPENSSL_3

The solution in this case is to build on a machine where libcurl has been compiled with ./configure --disable-versioned-symbols . 这种情况下的解决方案是在使用./configure --disable-versioned-symbols编译libcurl的计算机上构建。 Binaries compiled this way will work elsewhere (including on systems which use versioned symbols). 以这种方式编译的二进制文件将在其他地方使用(包括在使用版本化符号的系统上)。 A portable binary should produce output like this (without any @ signs): 一个可移植的二进制文件应该产生这样的输出(不带任何@符号):

$ objdump -x mybinary | grep curl_global_init
0... F *UND*  0... curl_global_init

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM