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

Per Hedeland <>
Sat Nov 21 00:35:25 CET 2009


Chandru <> wrote:
>>
>Here is the output of nm on the build Peter is working on.
>
>> nm crypto_drv.so

>                 U _exit

>                 U atexit

>                 U exit

>                 U main

The presence of any of those seem seriously broken for a shared object I
think - FWIW, our build of ancient but working R10B-10, 32-bit,
gcc-3.4.3, Solaris 10, has none of them. I believe they're from crt1.o,
which should only be linked into an executable. Our build log (lines
folded):

gcc -c -o ../priv/obj/sparc-sun-solaris2.10/crypto_drv.o -g -O2 \
  -I/export/home/lab/build/otp/erts/sparc-sun-solaris2.10 \
  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64   -fPIC -I/usr/sfw/include \
  -I/export/home/lab/build/otp/erts/emulator/beam \
  -I/export/home/lab/build/otp/erts/emulator/sys/unix crypto_drv.c
/usr/ucb/install -c -d ../priv/lib/sparc-sun-solaris2.10
ld -G -L/usr/sfw/lib -R/usr/sfw/lib \
  -o ../priv/lib/sparc-sun-solaris2.10/crypto_drv.so \
  ../priv/obj/sparc-sun-solaris2.10/crypto_drv.o  -lcrypto

Those are likely *not* correct for current versions or 64-bit though.
And I believe Björn-Egil has a point about -G vs -shared - but -G is a
(Solaris) 'ld' option (and so is -R, though GNU ld may do the right
thing with it if you are lucky), while -shared is a gcc (and GNU ld)
option.  I.e.  basically 'ld -G -L<path> -R<path>' may need to be
replaced with something like 'gcc -shared -L<path> -Wl,-R,<path>',
assuming that you are using Solaris ld (which I think is the norm for
gcc on Solaris). Certainly switching from ld <mumble> to gcc -shared for
building shared objects has worked well for us on some more modern
*nixes.

--Per


More information about the erlang-questions mailing list