[erlang-questions] build 64bit Erlang on Solairs
Mikael Pettersson
mikpe@REDACTED
Thu May 1 16:18:32 CEST 2008
Raymond Xiong writes:
> 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
>
> >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:
But the command above is not ld but gcc, and gcc requires -m64 to
produce a 64-bit executable if its default is 32-bit. What happens
is that gcc passes more options to ld than just the object file names,
and typically one of those options selects the executable format.
Hence gcc needs to be told if you want a non-default format.
[snip]
> 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?
env CFLAGS='-m64 -O2' LDFLAGS=-m64 ./configure ; make
also works; I just did that to build R12B-2 on a Solaris 10 box.
The advantage of "env CC=gcc64 ./configure; make" is that
you don't have to worry about missing some *FLAGS variable.
/Mikael
More information about the erlang-questions
mailing list