首页 > 解决方案 > Solaris 10 上的 LibreSSL 3.0.2 编译错误:未定义对符号“SHA512Final”的引用

问题描述

我们正在尝试在 Solaris 10 上编译 LibreSSSL 3.0.2。我们正在使用 GNU gcc 4.6.2 并遇到以下问题:

Making all in tests
make[1]: Entering directory `/users/login/e486530/openssh81/libressl-3.0.2/tests'
CCLD     handshake_table
/soft/gnu/lib/gcc/i386-pc-solaris2.10/4.6.2/../../../../i386-pc-solaris2.10/bin/ld: /users/login/e486530/openssh81/libressl-3.0.2/crypto/.libs/libcrypto.a(getentropy_solaris.o): undefined reference to symbol 'SHA512Final'
/soft/gnu/lib/gcc/i386-pc-solaris2.10/4.6.2/../../../../i386-pc-solaris2.10/bin/ld: note: 'SHA512Final' is defined in DSO /lib/libmd.so.1 so try adding it to the linker command line
/lib/libmd.so.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status

错误是“未定义对符号 'SHA512Final 的引用”

提出的命题是'SHA512Final' 在 DSO /lib/libmd.so.1 中定义,因此请尝试将其添加到链接器命令行。但是就在我们遇到错误“/lib/libmd.so.1:无法读取符号:无效操作”之后,显然编译器已经尝试从该库中读取符号而没有成功。

在 Solaris 上成功编译 LibreSSL 有什么想法吗?


我补充一些细节...

编译是在 Solaris 10 for i386上使用 GNU gcc 编译器 4.6.2 进行的。我没有为编译设置位。

GNU gcc 使用选项 -v 显示以下信息

$ gcc -v
Using built-in specs.
COLLECT_GCC=/soft/gnu/bin/gcc
COLLECT_LTO_WRAPPER=/soft/gnu/libexec/gcc/i386-pc-solaris2.10/4.6.2/lto-wrapper
Target: i386-pc-solaris2.10
Configured with: ../gcc-4.6.2/configure --prefix=/soft/gnu --with-gnu-ld --with-gnu-as --with-gmp=/soft/gnu --with-mpc=/soft/gnu --with-mpfr=/soft/gnu
Thread model: posix
gcc version 4.6.2 (GCC)

uname -a 选项显示:

$ uname -a
SunOS yvas0pd0 5.10 Generic_150401-30 i86pc i386 i86pc

我刚刚用标志重新编译:

CC="gcc -m64"
CXX="g++ -m64"

现在的错误是

/soft/gnu/lib/gcc/i386-pc-solaris2.10/4.6.2/../../../../i386-pc-solaris2.10/bin/ld: /users/login/e486530/openssh81/libressl-3.0.2/crypto/.libs/libcrypto.a(getentropy_solaris.o): undefined reference to symbol 'SHA512Final'
/soft/gnu/lib/gcc/i386-pc-solaris2.10/4.6.2/../../../../i386-pc-solaris2.10/bin/ld: note: 'SHA512Final' is defined in DSO /lib/amd64/libmd.so.1 so try adding it to the linker command line
/lib/amd64/libmd.so.1: could not read symbols: Invalid operation

所以现在使用的库是 64 位库,但问题仍然存在...... :-|

希望能帮助到你。目前我们将使用成功编译的 OpenSSL 1.1.1。

问候

标签: compiler-errorslinker-errorssolarislibressl

解决方案


编译中显示的错误

'SHA512Final' is defined in DSO /lib/amd64/libmd.so.1 so try adding it to the linker command line
/lib/amd64/libmd.so.1: could not read symbols: Invalid operation

真的意味着文件 /lib/amd64/libmd.so.1 没有被链接器使用。我误解了真正的意思。

因此,将 -lmd 添加到 LDFLAGS 变量使编译完成

有关信息,我的编译中使用的 LDFLAGS 变量的完整内容如下:

导出 LDFLAGS="-Wl,-disable-new-dtags,-rpath=/opt/openssh-8.1/lib,-lmd"


推荐阅读