Trying to build crosscompiler for Sparc Solaris 8 -> Sparc Solaris 10 (& others)...

Aaron Gaudio agaudio@eng.mc.xerox.com
Tue Apr 5 20:05:00 GMT 2005


(CCing this to gcc@... due to potential build bugs...)

I'm encountering more woes than my original message (quoted below),
which I figure are either bugs in the build mechanism or bugs in the
user (me); either way if someone can enlighten me it would be much
appreciated...

I suspended my efforts in building against Sparc Solaris 10 to see how
far x86 Solaris 10 got. Once again, binutils compiled and installed
without a hitch. 

When building gcc for the "i586-sun-solaris2.10" target, the first error
I encountered was in trying to build gcrt1.o. The sample output below
indicates my result:

sed -e '/^!/d' <../../gcc-3.4.3/gcc/config/i386/sol2-gc1.asm >gcrt1.s
as -o gcrt1.o gcrt1.s
gcrt1.s: Assembler messages:
gcrt1.s:13: Error: Unknown opcode: `pushl'
gcrt1.s:14: Error: Unknown opcode: `pushl'
(and a bunch of other bad opcodes)

I figured that make was using 'as' (which was built for target sparc-
sun-solaris2.8) instead of i586-sun-solaris2.10-as. Sure enough, in
gcc-3.4.3/gcc/config/i386/t-sol2 the gcrt1.o target uses $(AR). When I
changed that to $(AR_FOR_TARGET), make got further...

Then later on I noticed as the make output whizzed by a bunch of errors
like this: 

( ` if [ -f ./nm ] ; then echo ./nm ; elif [ -
f /vobs/java/gnu/buildroot/gcc-build/gcc/../binutils/nm-new ] ; then
echo /vobs/java/gnu/buildroot/gcc-build/gcc/../binutils/nm-new ; else if
[ "sparc-sun-solaris2.8" = "i586-sun-solaris2.10" ] ; then echo nm; else
t='s,^,i586-sun-solaris2.10-,;'; echo nm | sed -e  ; fi; fi` -pg
libgcc/./_subvsi3.o | gawk 'NF == 3 && $2 !~ /^[UN]$/ { print
"     .hidden", $3 }'; cat libgcc//stacknote.s ) |  ./xgcc -B./ -
B/vobs/java/gnu/i586-sun-solaris2.10/bin/ -isystem /vobs/java/gnu/i586-
sun-solaris2.10/include -isystem /vobs/java/gnu/i586-sun-
solaris2.10/sys-include -L/vobs/java/gnu/buildroot/gcc-build/gcc/../ld -
O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-
prototypes -Wmissing-prototypes -Wold-style-definition  -
isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -
D__GCC_FLOAT_NOT_NEEDED   -r -nostdinc -nostdlib -o libgcc/./_subvsi3.oS
libgcc/./_subvsi3.o -xassembler -
sed: option requires an argument -- e

Make did not complain though, it kept going. 

Turns out this bit of code is apparently executed within the mklibgcc
script, and defined in libgcc.mk:

libgcc/./libgcc.map: ../../gcc-3.4.3/gcc/mkmap-symver.awk ../../gcc-3.4.3/gcc/libgcc-std.ver  libgcc/./_muldi3.o libgcc/./_negdi2.o libgcc/./_lshrdi3.o libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgcc/./_cmpdi2.o libgcc/./_ucmpdi2.o libgcc/./_floatdidf.o libgcc/./_floatdisf.o libgcc/./_fixunsdfsi.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfdi.o libgcc/./_fixdfdi.o libgcc/./_fixunssfdi.o libgcc/./_fixsfdi.o libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o libgcc/./_floatdixf.o libgcc/./_fixunsxfsi.o libgcc/./_fixtfdi.o libgcc/./_fixunstfdi.o libgcc/./_floatditf.o libgcc/./_clear_cache.o libgcc/./_enable_execute_stack.o libgcc/./_trampoline.o libgcc/./__main.o libgcc/./_absvsi2.o libgcc/./_absvdi2.o libgcc/./_addvsi3.o libgcc/./_addvdi3.o libgcc/./_subvsi3.o libgcc/./_subvdi3.o libgcc/./_mulvsi3.o libgcc/./_mulvdi3.o libgcc/./_negvsi2.o libgcc/./_negvdi2.o libgcc/./_ctors.o libgcc/./_ffssi2.o libgcc/./_ffsdi2.o libgcc/./_clz.o libgcc/./_clzsi2.o libgcc/./_clzdi2.o libgcc/./_ctzsi2.o libgcc/./_ctzdi2.o libgcc/./_popcount_tab.o libgcc/./_popcountsi2.o libgcc/./_popcountdi2.o libgcc/./_paritysi2.o libgcc/./_paritydi2.o libgcc/./_divdi3.o libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc/./_umoddi3.o libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o  libgcc/./unwind-dw2.o libgcc/./unwind-dw2-fde.o libgcc/./unwind-sjlj.o libgcc/./gthr-gnat.o libgcc/./unwind-c.o
	{ $(NM_FOR_TARGET) -pg  libgcc/./_muldi3.o libgcc/./_negdi2.o libgcc/./_lshrdi3.o libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgcc/./_cmpdi2.o libgcc/./_ucmpdi2.o libgcc/./_floatdidf.o libgcc/./_floatdisf.o libgcc/./_fixunsdfsi.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfdi.o libgcc/./_fixdfdi.o libgcc/./_fixunssfdi.o libgcc/./_fixsfdi.o libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o libgcc/./_floatdixf.o libgcc/./_fixunsxfsi.o libgcc/./_fixtfdi.o libgcc/./_fixunstfdi.o libgcc/./_floatditf.o libgcc/./_clear_cache.o libgcc/./_enable_execute_stack.o libgcc/./_trampoline.o libgcc/./__main.o libgcc/./_absvsi2.o libgcc/./_absvdi2.o libgcc/./_addvsi3.o libgcc/./_addvdi3.o libgcc/./_subvsi3.o libgcc/./_subvdi3.o libgcc/./_mulvsi3.o libgcc/./_mulvdi3.o libgcc/./_negvsi2.o libgcc/./_negvdi2.o libgcc/./_ctors.o libgcc/./_ffssi2.o libgcc/./_ffsdi2.o libgcc/./_clz.o libgcc/./_clzsi2.o libgcc/./_clzdi2.o libgcc/./_ctzsi2.o libgcc/./_ctzdi2.o libgcc/./_popcount_tab.o libgcc/./_popcountsi2.o libgcc/./_popcountdi2.o libgcc/./_paritysi2.o libgcc/./_paritydi2.o libgcc/./_divdi3.o libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc/./_umoddi3.o libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o  libgcc/./unwind-dw2.o libgcc/./unwind-dw2-fde.o libgcc/./unwind-sjlj.o libgcc/./gthr-gnat.o libgcc/./unwind-c.o; echo %%; \
	  cat ../../gcc-3.4.3/gcc/libgcc-std.ver \
	    | sed -e '/^[   ]*#/d' \
	          -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
	    | $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES)  -E -xassembler-with-cpp -; \
	} | $(AWK) -f ../../gcc-3.4.3/gcc/mkmap-symver.awk  > libgcc/./tmp-libgcc.map
	mv 'libgcc/./tmp-libgcc.map' $@


NM_FOR_TARGET is defined in gcc/Makefile as this:

NM_FOR_TARGET = ` \
  if [ -f ./nm ] ; then \
    echo ./nm ; \
  elif [ -f $(objdir)/../binutils/nm-new ] ; then \
    echo $(objdir)/../binutils/nm-new ; \
  else \
    if [ "$(host)" = "$(target)" ] ; then \
      echo nm; \
    else \
       t='$(program_transform_name)'; echo nm | sed -e $$t ; \
    fi; \
  fi`


Which looks correct, but in mklibgcc, the '$$t' appears to get lost in
translation. My guess is that it's being passed as a shell environment
variable with improper quoting, rather than just resolving the variable
before executing the script. Whatever it is, it is certainly an error
right now.

Also, shouldn't the script exit prematurely when something like this
fails?

Please advise...

(below is my original note to gcc-help)

On Tue, 2005-04-05 at 12:15 -0400, Aaron Gaudio wrote: 
> As the subject suggests, I'm attempting to build a cross-compiler on a
> Sparc Solaris 8 host system with a target of Sparc Solaris 10. Once I
> can get this, I plan on building a cross-compiler for i386 Solaris 10
> (so my attempt is not purely academic).
> 
> I have already installed binutils 2.15 and gcc 3.4.5 native Solaris 8
> verisons in the prefix /vobs/java/gnu and added this directory to my
> path, so that those are the tools being used for building the cross-
> compiler environment.
> 
> I've unpacked the Solaris 10 libraries and headers
> to /vobs/java/gnu/sparc-sun-solaris-2.10.
> 
> I'm building Solaris 10 binutils 2.15, configured via 
> 
> configure --prefix=/vobs/java/gnu --target=sparc-sun-solaris2.10 --with-
> sysroot=/vobs/java/gnu/sparc-sun-solaris-2.10
> 
> (note that I don't see any reference to --with-sysroot in the binutils
> configure scripts, so I'm not sure that's even doing anything) and with
> 
> LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/ccs/lib:/usr/local/lib"
> 
> (/usr/local/lib is where libiconv.so.2 is)
> 
> binutils builds and installs without problem.
> 
> Then I try to build gcc 3.4.3 (from /vobs/java/gnu/buildroot/gcc-build)
> using 
> 
> ../gcc-3.4.3/configure --prefix=/vobs/java/gnu --target=sparc-sun-
> solaris2.10 --enable-languages=c,c++ --with-gnu-ld --with-gnu-as --with-
> sysroot=/vobs/java/gnu/sparc-sun-solaris-2.10
> 
> Make ends up failing on the following command:
> /vobs/java/gnu/buildroot/gcc-build/gcc/xgcc -B/vobs/java/gnu/buildroot/gcc-build/gcc/ -B/vobs/java/gnu/sparc-sun-solaris2.10/bin/ -B/vobs/java/gnu/sparc-sun-solaris2.10/lib/ -isystem /vobs/java/gnu/sparc-sun-solaris2.10/include -isystem /vobs/java/gnu/sparc-sun-solaris2.10/sys-include -O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc/sparcv9/libgcc.map -o sparcv9/libgcc_s.so.1.tmp  -m64  libgcc/sparcv9/_muldi3.o libgcc/sparcv9/_negdi2.o libgcc/sparcv9/_lshrdi3.o libgcc/sparcv9/_ashldi3.o libgcc/sparcv9/_ashrdi3.o libgcc/sparcv9/_cmpdi2.o libgcc/sparcv9/_ucmpdi2.o libgcc/sparcv9/_floatdidf.o libgcc/sparcv9/_floatdisf.o libgcc/sparcv9/_fixunsdfsi.o libgcc/sparcv9/_fixunssfsi.o libgcc/sparcv9/_fixunsdfdi.o libgcc/sparcv9/_fixdfdi.o libgcc/sparcv9/_fixunssfdi.o libgcc/sparcv9/_fixsfdi.o libgcc/sparcv9/_fixxfdi.o libgcc/sparcv9/_fixunsxfdi.o libgcc/sparcv9/_floatdixf.o libgcc/sparcv9/_fixunsxfsi.o libgcc/sparcv9/_fixtfdi.o libgcc/sparcv9/_fixunstfdi.o libgcc/sparcv9/_floatditf.o libgcc/sparcv9/_clear_cache.o libgcc/sparcv9/_enable_execute_stack.o libgcc/sparcv9/_trampoline.o libgcc/sparcv9/__main.o libgcc/sparcv9/_absvsi2.o libgcc/sparcv9/_absvdi2.o libgcc/sparcv9/_addvsi3.o libgcc/sparcv9/_addvdi3.o libgcc/sparcv9/_subvsi3.o libgcc/sparcv9/_subvdi3.o libgcc/sparcv9/_mulvsi3.o libgcc/sparcv9/_mulvdi3.o libgcc/sparcv9/_negvsi2.o libgcc/sparcv9/_negvdi2.o libgcc/sparcv9/_ctors.o libgcc/sparcv9/_ffssi2.o libgcc/sparcv9/_ffsdi2.o libgcc/sparcv9/_clz.o libgcc/sparcv9/_clzsi2.o libgcc/sparcv9/_clzdi2.o libgcc/sparcv9/_ctzsi2.o libgcc/sparcv9/_ctzdi2.o libgcc/sparcv9/_popcount_tab.o libgcc/sparcv9/_popcountsi2.o libgcc/sparcv9/_popcountdi2.o libgcc/sparcv9/_paritysi2.o libgcc/sparcv9/_paritydi2.o libgcc/sparcv9/_divdi3.o libgcc/sparcv9/_moddi3.o libgcc/sparcv9/_udivdi3.o libgcc/sparcv9/_umoddi3.o libgcc/sparcv9/_udiv_w_sdiv.o libgcc/sparcv9/_udivmoddi4.o  libgcc/sparcv9/unwind-dw2.o libgcc/sparcv9/unwind-dw2-fde.o libgcc/sparcv9/unwind-sjlj.o libgcc/sparcv9/gthr-gnat.o libgcc/sparcv9/unwind-c.o -lc && rm -f libgcc_s_sparcv9.so && if [ -f sparcv9/libgcc_s.so.1 ]; then mv -f sparcv9/libgcc_s.so.1 sparcv9/libgcc_s.so.1.`basename `; else true; fi && mv sparcv9/libgcc_s.so.1.tmp sparcv9/libgcc_s.so.1 && ln -s sparcv9/libgcc_s.so.1 libgcc_s_sparcv9.so
> /vobs/java/gnu/sparc-sun-solaris2.10/bin/ld: values-Xa.o: No such file: No such file or directory
> collect2: ld returned 1 exit status
> make[2]: *** [sparcv9/libgcc_s_sparcv9.so] Error 1
> make[2]: Leaving directory `/vobs/java/gnu/buildroot/gcc-build/gcc'
> make[1]: *** [stmp-multilib] Error 2
> make[1]: Leaving directory `/vobs/java/gnu/buildroot/gcc-build/gcc'
> make: *** [all-gcc] Error 2
> 
> I have both the Solaris 8 values-Xa.o (in /usr/ccs/lib and /usr/lib) and
> the Solaris 10 values-Xa.o (in /vobs/java/gnu/sparc-sun-
> solaris2.10/usr/ccs/lib and /vobs/java/gnu/sparc-sun-
> solaris2.10/usr/lib).
> 
> 
> 
-- 
Aaron Gaudio           agaudio @ eng.mc.xerox.com           585-422-6876
               madcap @ irc://rockhopper.eng.mc.xerox.com
 OpenPGP fingerprint: 74B3 1018 08EB 1B3F E7C7  B944 11B1 E0C3 949C 8906
             "Every man is a mob, a chain gang of idiots." 
                     - Jonathan Nolan, /Memento Mori/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20050405/f19e9eda/attachment.sig>


More information about the Gcc-help mailing list