[erlang-questions] build 64bit Erlang on Solairs

Raymond Xiong <>
Thu May 1 14:51:39 CEST 2008

On 05/01/08, Raymond Xiong wrote:
> I am trying to build 64bit Erlang on Soalris, but encountered
> some issue. Below are the details, thanks for any suggestion
> in advance.
> I used the following commands(especially, I used -m64 flag to
> tell gcc to generate 64bit code, and used "-R/usr/lib/64
> -L/usr/lib/64" to tell ld use 64bit lib):
> # echo $ENV
> CC=gcc CFLAGS=-m64 LDFLAGS="-R/usr/lib/64 -L/usr/lib/64" CPPFLAGS="-I /usr/include/gd2" CXX=g++
> # env $ENV configure --with-ssl=/usr/sfw --enable-dynamic-ssl-lib
> # env $ENV gmake install 
> The above command could generate 64bit .o object files
> successfully, but it failed when trying to generate beam.bmp
> executable file. Here is the log:
> gcc -o /export/erlang/usr/src/cmd/erlang/root/otp_src_R12B-1/bin/sparc-sun-solaris2.11/beam.smp -R/usr/lib/64 -L/usr/lib/64 obj/sparc-sun-solaris2.11/opt/smp/erl_main.o ...(snipped)
> ld: fatal: file obj/sparc-sun-solaris2.11/opt/smp/erl_main.o:
> wrong ELF class: ELFCLASS64

A bit more information on this. The above command was due to 
the following rules in erts/emulator/Makefile.in:


As you see, user specified CFLAGS value(-m64, in this case) is
not used. So I have actually two questions:

1) Do we need to add CFLAGS in above command? (if ld can
determince 32bit/64bit mode itself, maybe this is not necessary.
The issue is, in my experiments on Solaris, ld couldn't get it 
right. I guess it might be due to ssl lib, but I am not sure)

2) How to configure to use 64bit ssl lib?

Thanks for any help.


> From what I know, the above error message means that ld was
> trying to generate 32bit binary file, but found the object
> files passed to it were 64bit files.
> According to ld(1) man page on Solaris, ld can guess to generate
> 32bit binary file or 64bit binary file: 
>      "No command-line option is  required  to  distinguish 32-bit
>      objects  or  64-bit  objects.  The  link-editor uses the ELF
>      class of the first relocatable object on the command-line to
>      govern  the  mode  in which to operate." 
> But why in this case it didn't get it right? I guess(I am not
> sure, it is just my guess) it was due to the fact that ssl 
> encryption library I specified on configure command line was 
> 32bit.
> Solaris does have 64bit ssl lib, it is under /usr/sfw/lib/64.
> But since Erlang use --with-ssl for both lib and header files, I
> cannot specify "--with-ssl=/usr/sfw/lib/64".
> How can I specify to use 64bit ssl lib? 
> I guess there must be many people who compile 64bit Erlang on
> Solaris, I googled this but only found this thread, which
> sugested to hard code gcc to "gcc -m64": 
>     http://www.erlang.org/pipermail/erlang-questions/2006-July/021336.html
> I suppose there must be a better way than that?
> Thanks,
> Raymond
> _______________________________________________
> erlang-questions mailing list
> http://www.erlang.org/mailman/listinfo/erlang-questions


More information about the erlang-questions mailing list