public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem compiling for other platform
@ 2011-08-09 22:04 Brian Ipsen
  2011-08-09 22:08 ` Bryan Ischo
  2011-08-10  1:44 ` Ian Lance Taylor
  0 siblings, 2 replies; 6+ messages in thread
From: Brian Ipsen @ 2011-08-09 22:04 UTC (permalink / raw)
  To: gcc-help

Hi

 I am trying to compile gcc 3.2 (based on RHEL RPM source) with a build-environment used for creating Synology 3rd-part applications (since I need libstdc++.so.5).

I start building with (target is an Intel Atom CPU):

CC=/usr/local/i686-linux-gnu/bin/i686-linux-gnu-gcc AS=/usr/local/i686-linux-gnu/bin/i686-linux-gnu-as ASFLAGS+=--32 CCFLAGS="-I/usr/local/i686-linux-gnu/include/ -m32" LDFLAGS=-L/usr/local/i686-linux-gnu/lib/   rpmbuild -bc --target=i686 compat-gcc-32.spec

But during compiling, it fails with:

./xgcc -B./ -B/usr/i686-redhat-linux/bin/ -isystem /usr/i686-redhat-linux/include -isystem /usr/i686-redhat-linux/sys-include -O2 -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include  -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/config -I../../gcc/../include  -g0 -finhibit-size-directive -fno-inline-functions -fno-exceptions -fno-omit-frame-pointer \
           -c ../../gcc/crtstuff.c -DCRT_END \
          -o crtend.o
/tmp/ccrc3fSw.s: Assembler messages:
/tmp/ccrc3fSw.s:37: Error: suffix or operands invalid for `push'
/tmp/ccrc3fSw.s:50: Error: suffix or operands invalid for `call'
/tmp/ccrc3fSw.s:76: Error: suffix or operands invalid for `push'
/tmp/ccrc3fSw.s:82: Error: suffix or operands invalid for `pop'
/tmp/ccrc3fSw.s:101: Error: suffix or operands invalid for `call'
/tmp/ccrc3fSw.s:104: Error: suffix or operands invalid for `pop'

I wonder if this is caused by an incorrect assembler being called - or with wrong parameters ?

gcc -v (with above environment variables) gives:

Using built-in specs.
Target: i686-linux-gnu
Configured with: /synosrc/source_backup/crosstool-0.43/build/i686-linux-gnu/gcc-4.2.1/configure --target=i686-linux-gnu --host=i686-host_pc-linux-gnu --prefix=/usr/local/i686-linux-gnu --with-arch=pentium3 --with-tune=pentium4 --with-headers=/usr/local/i686-linux-gnu/i686-linux-gnu/include --with-local-prefix=/usr/local/i686-linux-gnu/i686-linux-gnu --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.2.1

Any ideas on how I proceed in order to try to get the library created ?

Regards
Brian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem compiling for other platform
  2011-08-09 22:04 Problem compiling for other platform Brian Ipsen
@ 2011-08-09 22:08 ` Bryan Ischo
  2011-08-10  1:44 ` Ian Lance Taylor
  1 sibling, 0 replies; 6+ messages in thread
From: Bryan Ischo @ 2011-08-09 22:08 UTC (permalink / raw)
  To: gcc-help

On 08/09/11 15:03, Brian Ipsen wrote:
> Hi
>
>   I am trying to compile gcc 3.2 (based on RHEL RPM source) with a build-environment used for creating Synology 3rd-part applications (since I need libstdc++.so.5).
>
> I start building with (target is an Intel Atom CPU):
>
> CC=/usr/local/i686-linux-gnu/bin/i686-linux-gnu-gcc AS=/usr/local/i686-linux-gnu/bin/i686-linux-gnu-as ASFLAGS+=--32 CCFLAGS="-I/usr/local/i686-linux-gnu/include/ -m32" LDFLAGS=-L/usr/local/i686-linux-gnu/lib/   rpmbuild -bc --target=i686 compat-gcc-32.spec
>
> But during compiling, it fails with:
>
> ./xgcc -B./ -B/usr/i686-redhat-linux/bin/ -isystem /usr/i686-redhat-linux/include -isystem /usr/i686-redhat-linux/sys-include -O2 -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include  -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/config -I../../gcc/../include  -g0 -finhibit-size-directive -fno-inline-functions -fno-exceptions -fno-omit-frame-pointer \
>             -c ../../gcc/crtstuff.c -DCRT_END \
>            -o crtend.o
> /tmp/ccrc3fSw.s: Assembler messages:
> /tmp/ccrc3fSw.s:37: Error: suffix or operands invalid for `push'
> /tmp/ccrc3fSw.s:50: Error: suffix or operands invalid for `call'
> /tmp/ccrc3fSw.s:76: Error: suffix or operands invalid for `push'
> /tmp/ccrc3fSw.s:82: Error: suffix or operands invalid for `pop'
> /tmp/ccrc3fSw.s:101: Error: suffix or operands invalid for `call'
> /tmp/ccrc3fSw.s:104: Error: suffix or operands invalid for `pop'
>
> I wonder if this is caused by an incorrect assembler being called - or with wrong parameters ?
>
> gcc -v (with above environment variables) gives:
>
> Using built-in specs.
> Target: i686-linux-gnu
> Configured with: /synosrc/source_backup/crosstool-0.43/build/i686-linux-gnu/gcc-4.2.1/configure --target=i686-linux-gnu --host=i686-host_pc-linux-gnu --prefix=/usr/local/i686-linux-gnu --with-arch=pentium3 --with-tune=pentium4 --with-headers=/usr/local/i686-linux-gnu/i686-linux-gnu/include --with-local-prefix=/usr/local/i686-linux-gnu/i686-linux-gnu --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
> Thread model: posix
> gcc version 4.2.1
>
> Any ideas on how I proceed in order to try to get the library created ?
>
> Regards
> Brian
>

I am fairly certain that I saw that same error while developing a script 
for building a cross-compiler, and the way I solved it was to upgrade 
the version of gcc that I was using to build the cross-compiler (i.e. 
the system compiler that you are using while building gcc).  But since I 
never figured out what the exact root cause was I don't know what other 
solutions might be possible.

Bryan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem compiling for other platform
  2011-08-09 22:04 Problem compiling for other platform Brian Ipsen
  2011-08-09 22:08 ` Bryan Ischo
@ 2011-08-10  1:44 ` Ian Lance Taylor
  2011-08-10  5:18   ` Brian Ipsen
  2011-08-10  5:46   ` Brian Ipsen
  1 sibling, 2 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2011-08-10  1:44 UTC (permalink / raw)
  To: Brian Ipsen; +Cc: gcc-help

Brian Ipsen <brian.ipsen@ryesgade47c.dk> writes:

> /tmp/ccrc3fSw.s: Assembler messages:
> /tmp/ccrc3fSw.s:37: Error: suffix or operands invalid for `push'
> /tmp/ccrc3fSw.s:50: Error: suffix or operands invalid for `call'
> /tmp/ccrc3fSw.s:76: Error: suffix or operands invalid for `push'
> /tmp/ccrc3fSw.s:82: Error: suffix or operands invalid for `pop'
> /tmp/ccrc3fSw.s:101: Error: suffix or operands invalid for `call'
> /tmp/ccrc3fSw.s:104: Error: suffix or operands invalid for `pop'

You are using a compiler generating 32-bit code with an assembler that
defaults to expecting 64-bit code.  You need to use an assembler which
defaults to 32-bit mode, or tell your compiler to pass -32 to the
assembler.

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Problem compiling for other platform
  2011-08-10  1:44 ` Ian Lance Taylor
@ 2011-08-10  5:18   ` Brian Ipsen
  2011-08-10  5:46   ` Brian Ipsen
  1 sibling, 0 replies; 6+ messages in thread
From: Brian Ipsen @ 2011-08-10  5:18 UTC (permalink / raw)
  To: gcc-help

Ian Lance Taylor <iant@google.com> writes:

>> /tmp/ccrc3fSw.s: Assembler messages:
>> /tmp/ccrc3fSw.s:37: Error: suffix or operands invalid for `push'
>> /tmp/ccrc3fSw.s:50: Error: suffix or operands invalid for `call'
>> /tmp/ccrc3fSw.s:76: Error: suffix or operands invalid for `push'
>> /tmp/ccrc3fSw.s:82: Error: suffix or operands invalid for `pop'
>> /tmp/ccrc3fSw.s:101: Error: suffix or operands invalid for `call'
>> /tmp/ccrc3fSw.s:104: Error: suffix or operands invalid for `pop'
>
>You are using a compiler generating 32-bit code with an assembler that defaults to expecting 64-bit code.  You need to use an assembler which defaults to 32-bit mode, or tell your compiler to pass -32 to the assembler.

Well - the question is then whether the xgcc command uses the AS specified assembler (/usr/local/i686-linux-gnu/bin/i686-linux-gnu-as)  - or the default assembler on the system (GNU assembler version 2.20.51.0.2 (x86_64-redhat-linux) using BFD version version 2.20.51.0.2-5.11.el6 20091009).

Is there a way to make sure, that the one in /usr/local/i686-linux-gnu/bin/i686-linux-gnu-as will be used?

I have tried to build for x86_64 instead, but in this case the make fails with:

stage1/xgcc -Bstage1/ -B/usr/x86_64-redhat-linux/bin/ -DIN_GCC    -O2 -g -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long  -DHAVE_CONFIG_H -DGENERATOR_FILE  -o genflags \
         genflags.o rtl.o read-rtl.o bitmap.o ggc-none.o gensupport.o print-rtl.o errors.o ../libiberty/libiberty.a
/usr/bin/ld: i386 architecture of input file `../libiberty/libiberty.a(hashtab.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `../libiberty/libiberty.a(safe-ctype.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `../libiberty/libiberty.a(xmalloc.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `../libiberty/libiberty.a(xstrdup.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `../libiberty/libiberty.a(xexit.o)' is incompatible with i386:x86-64 output

Regards
/Brian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Problem compiling for other platform
  2011-08-10  1:44 ` Ian Lance Taylor
  2011-08-10  5:18   ` Brian Ipsen
@ 2011-08-10  5:46   ` Brian Ipsen
  2011-08-10 16:00     ` Ian Lance Taylor
  1 sibling, 1 reply; 6+ messages in thread
From: Brian Ipsen @ 2011-08-10  5:46 UTC (permalink / raw)
  To: gcc-help

> >> /tmp/ccrc3fSw.s: Assembler messages:
> >> /tmp/ccrc3fSw.s:37: Error: suffix or operands invalid for `push'
> >> /tmp/ccrc3fSw.s:50: Error: suffix or operands invalid for `call'
> >> /tmp/ccrc3fSw.s:76: Error: suffix or operands invalid for `push'
> >> /tmp/ccrc3fSw.s:82: Error: suffix or operands invalid for `pop'
> >> /tmp/ccrc3fSw.s:101: Error: suffix or operands invalid for `call'
> >> /tmp/ccrc3fSw.s:104: Error: suffix or operands invalid for `pop'
> >
> >You are using a compiler generating 32-bit code with an assembler that
> defaults to expecting 64-bit code.  You need to use an assembler which
> defaults to 32-bit mode, or tell your compiler to pass -32 to the assembler.

Update - I modfied the Makefile, so that the right assembler will be called.. Things looks a bit different now, when building, the build fails with:

/usr/local/i686-linux-gnu/bin/i686-linux-gnu-gcc -c -DIN_GCC    -O2 -g -march=i686 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes   -DHAVE_CONFIG_H    -I. -Icp -I../../gcc -I../../gcc/cp -I../../gcc/config -I../../gcc/../include ../../gcc/cp/decl.c -o cp/decl.o
../../gcc/cp/decl.c: In function 'push_binding_level':
../../gcc/cp/decl.c:510: error: lvalue required as left operand of assignment

Any hints ?

/Brian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problem compiling for other platform
  2011-08-10  5:46   ` Brian Ipsen
@ 2011-08-10 16:00     ` Ian Lance Taylor
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2011-08-10 16:00 UTC (permalink / raw)
  To: Brian Ipsen; +Cc: gcc-help

Brian Ipsen <brian.ipsen@ryesgade47c.dk> writes:

>> >> /tmp/ccrc3fSw.s: Assembler messages:
>> >> /tmp/ccrc3fSw.s:37: Error: suffix or operands invalid for `push'
>> >> /tmp/ccrc3fSw.s:50: Error: suffix or operands invalid for `call'
>> >> /tmp/ccrc3fSw.s:76: Error: suffix or operands invalid for `push'
>> >> /tmp/ccrc3fSw.s:82: Error: suffix or operands invalid for `pop'
>> >> /tmp/ccrc3fSw.s:101: Error: suffix or operands invalid for `call'
>> >> /tmp/ccrc3fSw.s:104: Error: suffix or operands invalid for `pop'
>> >
>> >You are using a compiler generating 32-bit code with an assembler that
>> defaults to expecting 64-bit code.  You need to use an assembler which
>> defaults to 32-bit mode, or tell your compiler to pass -32 to the assembler.
>
> Update - I modfied the Makefile, so that the right assembler will be called.. Things looks a bit different now, when building, the build fails with:
>
> /usr/local/i686-linux-gnu/bin/i686-linux-gnu-gcc -c -DIN_GCC    -O2 -g -march=i686 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes   -DHAVE_CONFIG_H    -I. -Icp -I../../gcc -I../../gcc/cp -I../../gcc/config -I../../gcc/../include ../../gcc/cp/decl.c -o cp/decl.o
> ../../gcc/cp/decl.c: In function 'push_binding_level':
> ../../gcc/cp/decl.c:510: error: lvalue required as left operand of assignment
>
> Any hints ?

You need to edit the gcc source code so that it will compile with a
newer version of gcc.  Take a look at that line.  It's probably a macro.
Compare it to the same lines in more recent versions of gcc.

Why are you trying to build such an old version of gcc?

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-10 16:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-09 22:04 Problem compiling for other platform Brian Ipsen
2011-08-09 22:08 ` Bryan Ischo
2011-08-10  1:44 ` Ian Lance Taylor
2011-08-10  5:18   ` Brian Ipsen
2011-08-10  5:46   ` Brian Ipsen
2011-08-10 16:00     ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).