Building gcc for solaris on sparc64 from linux on x86

David Cournapeau
Thu Nov 2 02:09:00 GMT 2006

Kai Ruottu wrote:
> David Cournapeau wrote:
>>    Then, I used this toolchain to build on M1 a "native" solaris gcc: 
>> I used a scheme analog to the cross compiler, except that I set host 
>> and target to sparc-sun-solaris2.9, and build to i686-pc-gnu. The 
>> compilation went Ok too, but I cannot make this new compiler work on 
>> M2. I installed all the programs with the prefix $HOME/solaris/local/ 
>> on M2, and added $HOME/solaris/local/bin in my PATH.
> Generally a crosscompiler produces "identical" stuff with the native 
> compiler... BESIDES when runs that
> '*gcc -dumpspecs' to produce the 'specs' !   This is one of the 
> mistakes people usually do, they trust the
> cross-compiler produced 'specs' to work on the native system too!
> So I would check this "stupid mistake" :-) first  !
(sorry for the double posting, I mistakely send the email to Kai only first)

I understand that compiling with a cross compiler to M2 and a native 
compiler on M2 will produce the same programs more or less; 
unfortunately, I want to compile python for M2, which configuration 
needs to run on M2. That's the justification for building a native 
compiler for M2.

Now, I am not sure to understand the dumpspecs stuff, and how it 
matters. Where (eg which step) is it used, and for what purpose ?

Here is the specs for the "native" gcc I built (with host and target for 

--traditional-format %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} 
%{Wa,*:%*} -s %{fpic|fpie|fPIC|fPIE:-K PIC} %(asm_cpu)



%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}

%{!S:-o %|.s |
as %(asm_options) %|.s %A }

%(cpp_cpu) %(cpp_arch) %(cpp_endian) %(cpp_subtarget)

%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} 
%{w} %{f*} %{g*:%{!g0:%{!fno-working-directory:-fworking-directory}}} 
%{O*} %{undef} %{save-temps:-fpch-preprocess}


%{C|CC:%{!E:%eGCC does not support -C or -CC without -E}} %{!Q:-quiet} 
%{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I %{MD:-MD 
%{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} 
%{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ 
%*}}}}} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i 
%{fmudflap:-D_MUDFLAP -include mf-runtime.h} %{fmudflapth:-D_MUDFLAP 
-D_MUDFLAPTH -include mf-runtime.h} %{E|M|MM:%W{o*}}

cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}

%{sun4:} %{target:} %{mcypress:-mcpu=cypress} 
%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} 
%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} %{m32:%{m64:%emay not 
use both -m32 and -m64}} %{m64:-mptr64 -mstack-bias -mno-v8plus   

%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are 
incompatible}} %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*} 
%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}} 
%{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs} %{v:-version} 
%{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{--help:--help} 
%{--target-help:--target-help} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o 
%b.s}}} %{fsyntax-only:-o %j} %{-param*} 
%{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}


%G %L %G %L

%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}    crtend.o%s 

%{h*} %{v:-V}    %{b} %{Wl,*:%*}    %{static:-dn -Bstatic}    
%{shared:-G -dy %{!mimpure-text:-z text}}    %{symbolic:-Bsymbolic -G 
-dy -z text}    %(link_arch)    %{Qy:} %{!Qn:-Qy}

%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio}    %{!shared:     
%{!symbolic:       %{pthreads:-lpthread}        
%{!pthreads:%{threads:-lthread}}        %{p|pg:-ldl} -lc}}

%{static: %{fmudflap|fmudflapth:  --wrap=malloc --wrap=free 
--wrap=calloc --wrap=realloc --wrap=mmap --wrap=munmap --wrap=alloca} 
%{fmudflapth: --wrap=pthread_create --wrap=pthread_join 
--wrap=pthread_exit}} %{fmudflap|fmudflapth: --wrap=main}

%{fmudflap|fmudflapth: -export-dynamic}

-lgcc_eh}%{shared-libgcc:-lgcc_s -lgcc}}%{shared:-lgcc_s}}}

%{!shared:              %{!symbolic:               
%{p:mcrt1.o%s}                           %{!p:                         
%{pg:gcrt1.o%s gmon.o%s}                             %{!pg:crt1.o%s}}}} 
           crti.o%s %(startfile_arch)             crtbegin.o%s




. !m32 !m64;sparcv7:. m32 !m64;sparcv9:sparcv9 !m32 m64;


So if 0 is really false, it looks like the specs say it is not a cross 
compiler, right ?



For unsubscribe information see

More information about the crossgcc mailing list