1

We are trying to compile LibreSSSL 3.0.2 on Solaris 10. We are using the GNU gcc 4.6.2 and have the following problem:

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

The error is "undefined reference to symbol 'SHA512Final"

The proposition made is 'SHA512Final' is defined in DSO /lib/libmd.so.1 so try adding it to the linker command line. But just after we have the error "/lib/libmd.so.1: could not read symbols: Invalid operation" so apparently the compiler is trying already to read symbols from this library without succèss.

Any idea to compile LibreSSL on Solaris with succes?


I add some details ...

The compilation is made on Solaris 10 for i386 with the GNU gcc compiler 4.6.2. I don't 'set the bits for compilation.

The GNU gcc shows the following information with the option -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)

And the uname -a option shows:

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

I have just recompiled with the flags:

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

And the error is now

/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

So the library used now is a 64 bit library but the problem remains ... :-|

Hope it helps. For the moment we are going to use OpenSSL 1.1.1, which compiles succesfully.

Regards

Ciges
  • 1,133
  • 11
  • 17
  • Are you doing a 64-bit compile? Because `/lib/libmd.so.1` is a 32-bit library. – Andrew Henle Jan 16 '20 at 12:20
  • The compilation is made on Solaris 10 for **i386** with the GNU gcc compiler 4.6.2. I don't 'set the bits for compilation. – Ciges Jan 20 '20 at 16:01
  • I have just added new details for the compilation. – Ciges Jan 20 '20 at 16:20
  • OK, there's definitely something strange going on. The "invalid operation" is likely because some system call related to `libmd.so.1` in some way returned `EINVAL`. The problem is figuring out what system call failed before you can know why it failed and how to fix it. If you run your make process under `truss` you should be able to identify the failed call: `truss -f -a -vall -w2 -o /path/to/output/file [normal make command]` will give you the information - somewhere. That output file will be large, but near the end will be a system call that failed with `EINVAL` – Andrew Henle Jan 20 '20 at 21:53
  • (cont) That failed system call will almost certainly be right before the error message is emitted. You should be able to find that error message by searching for `/ l i b / a m d 6 4 / l i b m d . s o . 1 :` in the output file. Note the spaces in the string - `truss` output adds an extra space so non-printable character values can be printed as two-byte hex values in the output. Somewhere above that error message being written will be a system call that failed with the `EINVAL` value. That failed call is what's causing your build to fail. – Andrew Henle Jan 20 '20 at 21:55
  • (cont) How old is your system? If it's an older CPU, both `libmd.so.1` libraries may be compiled to use an instruction set that your CPU does not support. That is one of the few things that I can think of right now that might result in an "invalid operation" failure when trying to load a shared object on Solaris. – Andrew Henle Jan 20 '20 at 21:59
  • You can also run `elfdump /lib/libmd.so.1` and compare its output to something that must be working, like `elfdump /lib/libc.so`, especially the header information. – Andrew Henle Jan 20 '20 at 22:05

1 Answers1

2

The error shown in the compilation

'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

Means really that the file /lib/amd64/libmd.so.1 is not being used by the linker. I have misunderstood the real meaning.

So, adding -lmd to the LDFLAGS variable makes the compilation finish

For information, the full content for the LDFLAGS variable used in my compilation is the following:

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

Ciges
  • 1,133
  • 11
  • 17