My thoughts:
You need a very recent version of gcc.  Not sure which one but the latest
and greatest will have support for 64 bit.  gcc needs the -m64 option.

The wrong ELFCLASS comes up a lot when making new perl modules, it is saying
you are linking against a 32 bit binary, all object files must be 64 bit  so
you either need to find the 64bit version of the object in question or get
the source and make one.

PS Sun's CC is 64 bit compatible as well.  Also, Solaris 5.7 is a bit
trickier to debug 64 bit probs with cause often times it doesn't tell
specifically wrong ELFCLASS, but just gives you some other obscure
complaint.

Hope that helps.


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, December 10, 2002 8:59 AM
Subject: Problems building 64BIT perl on Solaris.


>
> I am trying to compile a 64bit perl 5.8, using GCC 3.2 on solaris. So far
> with
> little success.  I started with a clean perl 5.8, and ran Configure thus:
>
> # sh Configure -Dcc=gcc -des -Duse64bitall > Configure.log 2>&1
>
> And then I ran (gnu) make:
>
> # /usr/local/bin/make
>
> This ended with the following error:
>
> <last few lines of output from make...>
>
> `sh  cflags "optimize='-O'" opmini.o`  -DPERL_EXTERNAL_GLOB opmini.c
>           CCCMD =  gcc -DPERL_CORE -c -mcpu=v9 -m64 -Wa,-xarch=v9
> -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O -Wall
> rm -f opmini.c
> gcc -L/usr/local/lib -L/usr/lib/sparcv9  -o miniperl \
>     miniperlmain.o opmini.o libperl.a -lsocket -lnsl -ldl -lm -lc
> ld: fatal: file miniperlmain.o: wrong ELF class: ELFCLASS64
> ld: fatal: File processing errors. No output written to miniperl
> collect2: ld returned 1 exit status
> make: *** [miniperl] Error 1
> <end output>
>
> What seems to happen here is that ld complains about some of the object
> files. They are 64BIT (what a surprise) but ld aparently doesn't expect
> this. To find out why I ran gcc with the -v option.
>
>
> # gcc -v -L/usr/local/lib -L/usr/lib/sparcv9  -o miniperl \
>      miniperlmain.o opmini.o libperl.a -lsocket -lnsl -ldl -lm -lc
> Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/specs
> Configured with: ../configure --with-as=/usr/ccs/bin/as
> --with-ld=/usr/ccs/bin/ld --disable-nls
> Thread model: posix
> gcc version 3.2
>  /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/collect2 -V -Y
> P,/usr/ccs/lib:/usr/lib -Qy -o miniperl
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/crt1.o
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/crti.o
> /usr/ccs/lib/values-Xa.o
>
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/crtbegin.o -L/usr/local/lib
> -L/usr/lib/sparcv9 -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2
> -L/usr/ccs/bin -L/usr/ccs/lib
> -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/../../.. miniperlmain.o
> opmini.o libperl.a -lsocket -lnsl -ldl -lm -lc -lgcc -lgcc_eh -lc -lgcc
> -lgcc_eh -lc /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/crtend.o
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/crtn.o
> ld: Software Generation Utilities - Solaris Link Editors: 5.8-1.273
> ld: fatal: file miniperlmain.o: wrong ELF class: ELFCLASS64
> ld: fatal: File processing errors. No output written to miniperl
> collect2: ld returned 1 exit status
>
> And the problem became clear. The collect2 seems to "collect" the wrong
> modules. The modules in usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/
are
> 32BIT modules. We need to tell gcc to link against what lives in the
sparcv9
> subdir. Adding -m64 seems to do the trick...
>
> # gcc -v -L/usr/local/lib -L/usr/lib/sparcv9  -o miniperl \
>        miniperlmain.o opmini.o libperl.a -lsocket -lnsl -ldl -lm -lc -m64
> Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/specs
> Configured with: ../configure --with-as=/usr/ccs/bin/as
> --with-ld=/usr/ccs/bin/ld --disable-nls
> Thread model: posix
> gcc version 3.2
>  /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/collect2 -V -Y
> P,/usr/lib/sparcv9 -Qy -o miniperl
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/sparcv9/crt1.o
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/sparcv9/crti.o
> /usr/lib/sparcv9/values-Xa.o
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/sparcv9/crtbegin.o
> -L/usr/local/lib -L/usr/lib/sparcv9
> -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/sparcv9
> -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2 -L/usr/ccs/bin/sparcv9
> -L/usr/ccs/bin -L/usr/ccs/lib/sparcv9 -L/usr/ccs/lib
> -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/../../../sparcv9
> -L/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/../../.. -L/lib/sparcv9
> -L/usr/lib/sparcv9 miniperlmain.o opmini.o
libperl.a -lsocket -lnsl -ldl -lm
> -lc -lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/sparcv9/crtend.o
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/sparcv9/crtn.o
> ld: Software Generation Utilities - Solaris Link Editors: 5.8-1.273
>
> See how gcc now takes the correct libraries...
>
> I guess the hints file for solaris needs updating...
>
> So I went back to the start and re-ran Configure with a couple of ectra
> options, thus:
>
> sh Configure -Dcc=gcc -des -Duse64bitall -Aldflags="-mcpu=v9 -m64"\
>               -Alddlflags="-mcpu=v9 -m64" > Configure.log 2>&1
>
> I ran make and saw that my previous problems were aparently solved...
>
> But then after a while this happens:
>
> <more make output>
> cp B/makeliblinks ../../lib/B/makeliblinks
> make[2]: Entering directory
> `/export/home/bit/perl/perl_base/perl-5.8.0/ext/B/C'
> ../../../miniperl "-I../../../lib" "-I../../../lib"
> ../../../lib/ExtUtils/xsubpp  -typemap ../../../lib/ExtUtils/typemap  C.xs
>
> C.xsc && mv C.xsc C.c
> gcc -c   -mcpu=v9 -m64 -Wa,-xarch=v9 -fno-strict-aliasing
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O   -DVERSION=\"1.01\"
> -DXS_VERSION=\"1.01\" -fPIC "-I../../.."   C.c
> Running Mkbootstrap for B::C ()
> chmod 644 C.bs
> rm -f ../../../lib/auto/B/C/C.so
> LD_RUN_PATH="" gcc  -mcpu=v9 -m64 -L/usr/local/lib -L/usr/lib/sparcv9 C.o
> -o ../../../lib/auto/B/C/C.so
> Undefined                       first referenced
>  symbol                             in file
> Perl_safesysmalloc                  C.o
> Perl_sv_free                        C.o
> Perl_hv_store_ent                   C.o
> Perl_get_sv                         C.o
> Perl_sv_setiv                       C.o
> Perl_sv_setref_iv                   C.o
> Perl_despatch_signals               C.o
> PL_op                               C.o
> PL_stack_sp                         C.o
> PL_sig_pending                      C.o
> Perl_sv_2pv_flags                   C.o
> PL_stack_base                       C.o
> Perl_get_hv                         C.o
> Perl_newSViv                        C.o
> PL_runops                           C.o
> main
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/sparcv9/crt1.o
> Perl_croak                          C.o
> PL_tainted                          C.o
> PL_markstack_ptr                    C.o
> Perl_form                           C.o
> PL_sv_yes                           C.o
> ld: fatal: Symbol referencing errors. No output written to
> ../../../lib/auto/B/C/C.so
> collect2: ld returned 1 exit status
> make[2]: *** [../../../lib/auto/B/C/C.so] Error 1
> make[2]: Leaving directory
> `/export/home/bit/perl/perl_base/perl-5.8.0/ext/B/C'
> make[1]: *** [subdirs] Error 2
> make[1]: Leaving directory
> `/export/home/bit/perl/perl_base/perl-5.8.0/ext/B'
> make: *** [lib/auto/B/B.so] Error 2
> <end make output>
>
> And here I am currently stuck.
>
> Looking at the missing symbols I guess that some fundamental part of perl
> isn't included in the linking. But what?
>
> Thanks in advance,
>
> Krist van Besien
>
>
> ---
> Krist van Besien
> Unix Specialist BZBD
> Bundesamt für Informatik und Telekommunikation BIT
> Monbijoustrasse 74, CH-3003 Bern
> Tel. +41 31 322 24 46
>
> added interaction www.informatik.admin.ch

Reply via email to