Solaris 10 上的 LibreSSL 3.0.2 编译错误:未定义的符号引用 'SHA512Final'

LibreSSL 3.0.2 compile error on Solaris 10 : undefined reference to symbol '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

错误是"undefined reference to symbol 'SHA512Final"

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

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


我添加一些细节...

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

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,编译成功。

此致

编译中显示的错误

'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变量的完整内容如下:

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