[erlang-questions] build 64bit Erlang on Solairs
Raymond Xiong
Raymond.Xiong@REDACTED
Thu May 1 17:37:09 CEST 2008
On 05/01/08, Mikael Pettersson wrote:
> >
> > 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.
Mikael,
Thanks for the information, I had thought gcc just let ld to
decide that.
If so, however, isn't it better to add CFLAGS in the follwing
line in erts/emulator/Makefile.in?
$(BINDIR)/$(EMULATOR_EXECUTABLE): $(INIT_OBJS) $(OBJS)
$(PURIFY) $(LD) -o $(BINDIR)/$(EMULATOR_EXECUTABLE) \
$(HIPEBEAMLDFLAGS) $(LDFLAGS) $(DEXPORT) $(INIT_OBJS) $(OBJS) $(LIBS)
>
> [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.
Yes, I believe it would work(I haven't try it on my SPARC box yet,
because the machine is slow and it takes more than half an hour
to finish).
However, I doubt if you can enable ssl support. I expect the
following command would fail because mixing of 32-bit objects
and 64-bit objects is not permitted:
env CFLAGS='-m64 -O2' LDFLAGS=-m64 ./configure --with-ssl=/usr/sfw \
--enable-dynamic-ssl-lib ; make
64bit ssl lib is under /usr/sfw/lib/64, do you have any suggestion
on how to let Erlang use 64bit ssl lib under that subdir(but header
files are still under /usr/sfw/include of course)?
>
> The advantage of "env CC=gcc64 ./configure; make" is that
> you don't have to worry about missing some *FLAGS variable.
>
Yes, as a user I understand that, but I am building a package
for OpenSolaris, so I need a more formal way.
Thanks for your help!
--
Regards,
Raymond
More information about the erlang-questions
mailing list