develooper Front page | perl.perl5.porters | Postings from November 2003

RE: [perl #24439] 64 bit build failure on Solaris 9

From:
Berger, Daniel
Date:
November 21, 2003 02:05
Subject:
RE: [perl #24439] 64 bit build failure on Solaris 9
Message ID:
AEB584A22DA94547847EC196AE7393BE02341E54@minntex003.interprise.com
> -----Original Message-----
> From: Andy Dougherty [mailto:perlbug-followup@perl.org] 
> Sent: Thursday, November 20, 2003 7:38 AM
> To: djberge@qwest.com
> Subject: Re: [perl #24439] 64 bit build failure on Solaris 9
> 
> 
> On Mon, 10 Nov 2003, Alan Burlison wrote:
> 
> > Berger, Daniel (via RT) wrote:
> >
> > > 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
> > > *** Error code 1
> > > make: Fatal error: Command failed for target `miniperl'
> >
> > I don't use gcc, but from looking at the gcc flags and the linker 
> > error mrssage it appears that you are building libperl as LP64 
> > (64-bit) but building miniperlmain as LP32 (32 bit).
> 
> Yes, I think that's almost it.  Looking closely at the 
> command line issued
> 
>     gcc -o miniperl miniperlmain.o opmini.o libperl.a [ . . .]
> 
> miniperlmain.o is the first object file mentioned.  By the 
> time ld gets to it, ld complains
> 
>     ld: fatal: file miniperlmain.o: wrong ELF class: ELFCLASS64
> 
> That means that ld has seen something earlier that was LP32.  
> I'll bet it was a gcc-specific crt1.o or crtbegin.o.  If I 
> recall correctly, gcc adds those start-up files to the ld 
> command line.  If they are 32-bit, then you'll get the error 
> message above.
> 
> If I'm right, the culprit is this bit in the current 
> hints/solaris_2.sh
> file:
> 		# no changes to ld flags, as (according to man ld):
> 		#
>    		# There is no specific option that tells ld to 
> link 64-bit
> 		# objects; the class of the first object that 
> gets processed
> 		# by ld determines whether it is to perform a 
> 32-bit or a
> 
> The problem is that $ldflags are sent to $ld, which is 
> actually $cc on Solaris (as well as on most modern Unix 
> systems).  (It really was ld on SunOS 4.1.3, where this part 
> of Configure was designed, and the name has stuck.)
> 
> In brief, although /usr/ccs/bin/ld doesn't need any specific 
> flags, gcc does need to know which set of start-up files to 
> send to /usr/ccs/bin/ld, so gcc *does* need a flag.
> 
> I don't have gcc-3.3 to test (my Solaris gcc installation is 
> still 2.8.1), but I think the following patch should fix it:
> 
> --- perl-5.8.2/hints/solaris_2.sh	Mon Oct 27 12:27:29 2003
> +++ perl-5.8.2-andy/hints/solaris_2.sh	Thu Nov 20 09:24:38 2003
> @@ -516,14 +516,13 @@
>  	        loclibpth="/usr/lib/sparcv9 $loclibpth"
>  		ccflags="$ccflags -mcpu=v9 -m64"
>  		if test X`getconf XBS5_LP64_OFF64_CFLAGS 
> 2>/dev/null` != X; then
> +		    # This adds in -Wa,-xarch=v9.  I suspect 
> that's superfluous,
> +		    # since the -m64 above should do that 
> already.  Someone
> +		    # with gcc-3.x.x, please test with gcc -v.  
>  A.D. 20-Nov-2003
>  		    ccflags="$ccflags -Wa,`getconf 
> XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
>  		fi
> -		# no changes to ld flags, as (according to man ld):
> -		#
> -   		# There is no specific option that tells ld to 
> link 64-bit
> -		# objects; the class of the first object that 
> gets processed
> -		# by ld determines whether it is to perform a 
> 32-bit or a
> -		# 64-bit link edit.
> +		ldflags="$ldflags -m64"
> +		lddlflags="$lddlflags -m64"
>  		;;
>  	    *)
>  		ccflags="$ccflags `getconf 
> XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
> 
> 
> Hope this helps,
> 
> -- 
>     Andy Dougherty		doughera@lafayette.edu


Thanks Andy.  I made the changes you suggested.  We're getting further,
but now it's choking on 'B':

        Making B (dynamic)
Writing Makefile for B::C
Writing Makefile for B
cp B/Stash.pm ../../lib/B/Stash.pm
cp B/Asmdata.pm ../../lib/B/Asmdata.pm
cp B/C.pm ../../lib/B/C.pm
cp B/Deparse.pm ../../lib/B/Deparse.pm
cp B/Debug.pm ../../lib/B/Debug.pm
cp B/cc_harness ../../lib/B/cc_harness
cp B.pm ../../lib/B.pm
cp B/Bblock.pm ../../lib/B/Bblock.pm
cp B/Assembler.pm ../../lib/B/Assembler.pm
cp B/Terse.pm ../../lib/B/Terse.pm
cp B/CC.pm ../../lib/B/CC.pm
cp O.pm ../../lib/O.pm
cp B/Concise.pm ../../lib/B/Concise.pm
cp B/Lint.pm ../../lib/B/Lint.pm
cp B/Showlex.pm ../../lib/B/Showlex.pm
cp B/Bytecode.pm ../../lib/B/Bytecode.pm
cp B/Disassembler.pm ../../lib/B/Disassembler.pm
cp B/assemble ../../lib/B/assemble
cp B/Xref.pm ../../lib/B/Xref.pm
cp B/Stackobj.pm ../../lib/B/Stackobj.pm
cp B/disassemble ../../lib/B/disassemble
cp B/makeliblinks ../../lib/B/makeliblinks
../../../miniperl "-I../../../lib" "-I../../../lib"
/usr/local/src/perl-5.8.2/lib/ExtUtils/xsubpp  -typemap
../../../lib/ExtUtils/typemap  C.xs > C.xsc && mv C.xsc C.c
gcc -c    -D_REENTRANT -mcpu=v9 -m64 -fno-strict-aliasing
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O   
-DVERSION=\"1.02\"  -DXS_VERSION=\"1.02\" -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  -m64 -L/usr/lib/sparcv9 -L/usr/local/lib C.o  -o
../../../lib/auto/B/C/C.so      
Undefined                       first referenced
 symbol                             in file
Perl_safesysmalloc                  C.o
Perl_Tmarkstack_ptr_ptr             C.o
Perl_Tstack_sp_ptr                  C.o
Perl_sv_free                        C.o
Perl_hv_store_ent                   C.o
Perl_get_sv                         C.o
Perl_sv_setiv                       C.o
Perl_Isig_pending_ptr               C.o
Perl_sv_setref_iv                   C.o
Perl_despatch_signals               C.o
Perl_Tstack_base_ptr                C.o
Perl_Irunops_ptr                    C.o
Perl_sv_2pv_flags                   C.o
Perl_Ttainted_ptr                   C.o
Perl_get_hv                         C.o
Perl_newSViv                        C.o
Perl_Iregex_pad_ptr                 C.o
main                               
/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/sparcv9/crt1.o
Perl_Top_ptr                        C.o
Perl_Gthr_key_ptr                   C.o
Perl_croak                          C.o
Perl_Isv_yes_ptr                    C.o
Perl_form                           C.o
ld: fatal: Symbol referencing errors. No output written to
../../../lib/auto/B/C/C.so
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target
`../../../lib/auto/B/C/C.so' Current working directory
/usr/local/src/perl-5.8.2/ext/B/C
*** Error code 1
make: Fatal error: Command failed for target `subdirs'
Current working directory /usr/local/src/perl-5.8.2/ext/B
*** Error code 1
make: Fatal error: Command failed for target `lib/auto/B/B.so'

The only warning I saw during the build that I thought might be
significant was this one:

gcc -m64 -L/usr/lib/sparcv9 -L/usr/local/lib -o miniperl \
    miniperlmain.o opmini.o libperl.a -lsocket -lnsl -ldl -lm -lpthread
-lc ./miniperl -w -Ilib -MExporter -e '<?>' || make minitest
*** Error code 1 (ignored)

I also tried commenting out the -Wa, -xarch stuff in the solaris hint
file, but that (unsurprisingly) didn't matter.

Any ideas?  Something about crt1.o again?

Regards,

Dan

(Sorry if this is a repeat - mail problems here)



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About