[erlang-questions] Erlang crypto_drv in R13B02/03 fails to load on amd64-Solaris2.10

Peter-Henry Mander <>
Mon Nov 23 16:58:53 CET 2009


The wrapper script detects the presence of -64 and -G flags, and
substitutes the Solaris 'ld' for any occurances of 'gcc' where these
flags exist:

Original: /Software/Tools-64/gcc \
  -64 -G \
  -o ../priv/lib/i386-pc-solaris2.10/crypto_drv.so \
  ../priv/obj/i386-pc-solaris2.10/crypto_drv.o \
  /Software/openssl-0.9.8i/lib/libcrypto.a
Modified: /usr/ccs/bin/ld   \
  -64 -G \
  -o ../priv/lib/i386-pc-solaris2.10/crypto_drv.so \
  ../priv/obj/i386-pc-solaris2.10/crypto_drv.o \
  /Software/openssl-0.9.8i/lib/libcrypto.a

The build completes without error, but the original problem remains:
> ~/R13B03/bin/erl
Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:8:8] [rq:8]
[async-threads:0] [kernel-poll:false]

Eshell V5.7.4  (abort with ^G)
1> application:start(crypto).
{error,{shutdown,{crypto_app,start,[normal,[]]}}}

=ERROR REPORT==== 23-Nov-2009::15:39:29 ===
Unable to load crypto_drv. Failed with error:
"ld.so.1: beam.smp: fatal: relocation error: R_AMD64_32: file
/Software/R13B03/lib/erlang/lib/crypto-1.6.3/priv/lib/crypto_drv.so:
symbol (unknown): value 0xfffffd7ffd6582d0 does not fit"
OpenSSL might not be installed on this system.
2>
=INFO REPORT==== 23-Nov-2009::15:39:29 ===
    application: crypto
    exited: {shutdown,{crypto_app,start,[normal,[]]}}
    type: temporary

Going through the motions manually:

3> PrivDir = code:priv_dir(crypto).
"/Software/R13B03/lib/erlang/lib/crypto-1.6.3/priv"
4> LibDir1 = filename:join([PrivDir, "lib"]).
"/Software/R13B03/lib/erlang/lib/crypto-1.6.3/priv/lib"
5> erl_ddll:load_driver(LibDir1, crypto_drv).
{error,{open_error,-11}}
6> erl_ddll:format_error({open_error,-11}).
"ld.so.1: beam.smp: fatal: relocation error: R_AMD64_32: file
/Software/R13B03/lib/erlang/lib/crypto-1.6.3/priv/lib/crypto_drv.so:
symbol (unknown): value 0xfffffd7ffd7582d0 does not fit"


677> /bin/file /Software/R13B03/lib/erlang/lib/crypto-1.6.3/priv/lib/crypto_drv.so
/Software/R13B03/lib/erlang/lib/crypto-1.6.3/priv/lib/crypto_drv.so:
 ELF 64-bit LSB dynamic lib AMD64 Version 1, dynamically linked, not
stripped
678>  /bin/file /Software/R13B03/lib/erlang/erts-5.7.4/bin/beam
/Software/R13B03/lib/erlang/erts-5.7.4/bin/beam:        ELF 64-bit LSB
executable AMD64 Version 1, dynamically linked, not stripped
679>  /bin/file /Software/R13B03/lib/erlang/erts-5.7.4/bin/beam.smp
/Software/R13B03/lib/erlang/erts-5.7.4/bin/beam.smp:    ELF 64-bit LSB
executable AMD64 Version 1, dynamically linked, not stripped

682> /usr/xpg4/bin/nm
/Software/R13B03/lib/erlang/lib/crypto-1.6.3/priv/lib/crypto_drv.so |
sed -n '/UNDEF/p'
( This does not show any references to 'main' nor 'exit' as pointer
out by Per. This time it looks as if the linker did the correct thing.
)

So, I do suspect that the configure script is getting confused by
which linker is suitable to use, but also the "relocation error:
R_AMD64_32 ... symbol (unknown): value 0xfffffd7ffd7582d0 does not
fit" is not strictly to do with the way crypto_drv.so is linked, but
something to do with the point raised by Wallentin Dahlberg on Friday:
The AMD ABI small/medium/large memory model.

Is it at all possible to regress the crypto_drv.so 'C' source back to
the one in R12B? Is the API compatible? It may have bugs that are
mended in R13B, but it didn't seem to suffer from the R_AMD64_32
error. Could this be due to changes in the way pointer arithmetic is
done in crypto_drv.c version 1.5.3 vs. version 1.6.3?

Pete.

On Mon, Nov 23, 2009 at 2:13 PM, Peter-Henry Mander
<> wrote:
> Well, this didn't work:
> LD=/usr/ccs/bin/ld ./configure --without-gnu-ld --with-ld=/usr/ccs/bin/ld
>
> Now I'm going to create a wrapper to gcc to replace the -64 with -m64
> and -G with -shared.
>
> Pete.
>
> On Mon, Nov 23, 2009 at 1:59 PM, Peter-Henry Mander
> <> wrote:
>
>> I'm going to try ./configure --without-gnu-ld
>> --with-ld=/usr/ccs/bin/ld just to see if this hint is picked up by the
>> configure script.
>


More information about the erlang-questions mailing list