* Bug when cross-compiling for ppc
@ 2023-09-12 16:42 Vincent Fortier
2023-09-14 2:25 ` Simon Marchi
2023-09-14 6:24 ` Andreas Schwab
0 siblings, 2 replies; 5+ messages in thread
From: Vincent Fortier @ 2023-09-12 16:42 UTC (permalink / raw)
To: gdb
As introduction, I part of SynoCommunity who maintains free software
packages that can be installed on synology NAS. Multiple archs are
supported from armv5, v7, v8, ppc, i686 and x64. I am able to build
gdb for all archs with exception of ppc, more specifically qoriq arch
using gcc-4.9.3 from Synology provided toolchain.
github PR available here: https://github.com/SynoCommunity/spksrc/pull/5879
I was finally able to figure out why (now needs to know how to fix it)
gdb fails to cross-compile for ppc. I am able to reproduce this
problem on both gdb-7.12.1 and latest 13.2.
Basically, when it goes into the configure script under sim/ppc at a
certain point it tests the "build" c compiler:
checking for i686-pc-linux-gcc... gcc
checking whether the C compiler works... no
configure: error: in
`/home/spksrc/qoriq-debug/spksrc/cross/gdb-latest/work-qoriq-6.2.4/gdb-13.2/sim/ppc/build.4119280':
configure: error: C compiler cannot create executables
See `config.log' for more details
mv: cannot stat 'config.h': No such file or directory
The end-result way later on is that build-config.h is then missing:
fatal error: build-config.h: No such file or directory
23 | #include "build-config.h"
| ^~~~~~~~~~~~~~~~
compilation terminated.
As at the end of sim/ppc/configure it does a mv config.h
../build-config.h but config.h was not generated in the first place.
What I ended-up doing is commenting out the tmpdir removal from that
configure script:
CFLAGS="${saved_CFLAGS}"
mv config.h ../build-config.h
cd ..
###rm -rf $tempdir
Which allowed me to keep track of the real error happening in background:
configure:2482: checking whether the C compiler works
configure:2504: gcc -g -O
-I/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include
-mcpu=8548 -mhard-float -mfloat-gprs=double
-I/home/spksrc/qoriq-debug/spksrc/cross/gdb-latest/work-qoriq-6.2.4/install/usr/local/gdb/include
conftest.c >&5
gcc: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
gcc: error: unrecognized command-line option '-mfloat-gprs=double'
configure:2508: $? = 1
configure:2546: result: no
When testing the "build" compiler it includes the "target" flags which
includes -mcpu=8548 -mhard-float -mfloat-gprs=double. In turns these
flags should never get used on with "build" compiler making it to
fail.
Now the question is, how to fix that? Help would be much welcomed :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug when cross-compiling for ppc
2023-09-12 16:42 Bug when cross-compiling for ppc Vincent Fortier
@ 2023-09-14 2:25 ` Simon Marchi
2023-09-14 2:30 ` Simon Marchi
2023-09-14 6:24 ` Andreas Schwab
1 sibling, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2023-09-14 2:25 UTC (permalink / raw)
To: Vincent Fortier, gdb
On 9/12/23 12:42, Vincent Fortier via Gdb wrote:
> As introduction, I part of SynoCommunity who maintains free software
> packages that can be installed on synology NAS. Multiple archs are
> supported from armv5, v7, v8, ppc, i686 and x64. I am able to build
> gdb for all archs with exception of ppc, more specifically qoriq arch
> using gcc-4.9.3 from Synology provided toolchain.
>
> github PR available here: https://github.com/SynoCommunity/spksrc/pull/5879
>
> I was finally able to figure out why (now needs to know how to fix it)
> gdb fails to cross-compile for ppc. I am able to reproduce this
> problem on both gdb-7.12.1 and latest 13.2.
>
> Basically, when it goes into the configure script under sim/ppc at a
> certain point it tests the "build" c compiler:
>
> checking for i686-pc-linux-gcc... gcc
> checking whether the C compiler works... no
> configure: error: in
> `/home/spksrc/qoriq-debug/spksrc/cross/gdb-latest/work-qoriq-6.2.4/gdb-13.2/sim/ppc/build.4119280':
> configure: error: C compiler cannot create executables
> See `config.log' for more details
> mv: cannot stat 'config.h': No such file or directory
>
> The end-result way later on is that build-config.h is then missing:
>
> fatal error: build-config.h: No such file or directory
> 23 | #include "build-config.h"
> | ^~~~~~~~~~~~~~~~
> compilation terminated.
>
> As at the end of sim/ppc/configure it does a mv config.h
> ../build-config.h but config.h was not generated in the first place.
>
> What I ended-up doing is commenting out the tmpdir removal from that
> configure script:
>
> CFLAGS="${saved_CFLAGS}"
> mv config.h ../build-config.h
> cd ..
> ###rm -rf $tempdir
>
> Which allowed me to keep track of the real error happening in background:
>
> configure:2482: checking whether the C compiler works
> configure:2504: gcc -g -O
> -I/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include
> -mcpu=8548 -mhard-float -mfloat-gprs=double
> -I/home/spksrc/qoriq-debug/spksrc/cross/gdb-latest/work-qoriq-6.2.4/install/usr/local/gdb/include
> conftest.c >&5
> gcc: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
> gcc: error: unrecognized command-line option '-mfloat-gprs=double'
> configure:2508: $? = 1
> configure:2546: result: no
>
> When testing the "build" compiler it includes the "target" flags which
> includes -mcpu=8548 -mhard-float -mfloat-gprs=double. In turns these
> flags should never get used on with "build" compiler making it to
> fail.
>
> Now the question is, how to fix that? Help would be much welcomed :)
Not a way to fix it but to circumvent it. Do you need sim support (it's
a simulator hosted inside GDB)? If not, you can configure with
--disable-sim, it will skip configuring/building the sim directory.
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug when cross-compiling for ppc
2023-09-14 2:25 ` Simon Marchi
@ 2023-09-14 2:30 ` Simon Marchi
0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2023-09-14 2:30 UTC (permalink / raw)
To: Vincent Fortier, gdb
On 9/13/23 22:25, Simon Marchi via Gdb wrote:
> On 9/12/23 12:42, Vincent Fortier via Gdb wrote:
>> As introduction, I part of SynoCommunity who maintains free software
>> packages that can be installed on synology NAS. Multiple archs are
>> supported from armv5, v7, v8, ppc, i686 and x64. I am able to build
>> gdb for all archs with exception of ppc, more specifically qoriq arch
>> using gcc-4.9.3 from Synology provided toolchain.
>>
>> github PR available here: https://github.com/SynoCommunity/spksrc/pull/5879
>>
>> I was finally able to figure out why (now needs to know how to fix it)
>> gdb fails to cross-compile for ppc. I am able to reproduce this
>> problem on both gdb-7.12.1 and latest 13.2.
>>
>> Basically, when it goes into the configure script under sim/ppc at a
>> certain point it tests the "build" c compiler:
>>
>> checking for i686-pc-linux-gcc... gcc
>> checking whether the C compiler works... no
>> configure: error: in
>> `/home/spksrc/qoriq-debug/spksrc/cross/gdb-latest/work-qoriq-6.2.4/gdb-13.2/sim/ppc/build.4119280':
>> configure: error: C compiler cannot create executables
>> See `config.log' for more details
>> mv: cannot stat 'config.h': No such file or directory
>>
>> The end-result way later on is that build-config.h is then missing:
>>
>> fatal error: build-config.h: No such file or directory
>> 23 | #include "build-config.h"
>> | ^~~~~~~~~~~~~~~~
>> compilation terminated.
>>
>> As at the end of sim/ppc/configure it does a mv config.h
>> ../build-config.h but config.h was not generated in the first place.
>>
>> What I ended-up doing is commenting out the tmpdir removal from that
>> configure script:
>>
>> CFLAGS="${saved_CFLAGS}"
>> mv config.h ../build-config.h
>> cd ..
>> ###rm -rf $tempdir
>>
>> Which allowed me to keep track of the real error happening in background:
>>
>> configure:2482: checking whether the C compiler works
>> configure:2504: gcc -g -O
>> -I/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include
>> -mcpu=8548 -mhard-float -mfloat-gprs=double
>> -I/home/spksrc/qoriq-debug/spksrc/cross/gdb-latest/work-qoriq-6.2.4/install/usr/local/gdb/include
>> conftest.c >&5
>> gcc: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
>> gcc: error: unrecognized command-line option '-mfloat-gprs=double'
>> configure:2508: $? = 1
>> configure:2546: result: no
>>
>> When testing the "build" compiler it includes the "target" flags which
>> includes -mcpu=8548 -mhard-float -mfloat-gprs=double. In turns these
>> flags should never get used on with "build" compiler making it to
>> fail.
>>
>> Now the question is, how to fix that? Help would be much welcomed :)
>
> Not a way to fix it but to circumvent it. Do you need sim support (it's
> a simulator hosted inside GDB)? If not, you can configure with
> --disable-sim, it will skip configuring/building the sim directory.
Also, what does you full configure line looks like?
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug when cross-compiling for ppc
2023-09-12 16:42 Bug when cross-compiling for ppc Vincent Fortier
2023-09-14 2:25 ` Simon Marchi
@ 2023-09-14 6:24 ` Andreas Schwab
2023-09-14 20:34 ` Vincent Fortier
1 sibling, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2023-09-14 6:24 UTC (permalink / raw)
To: Vincent Fortier via Gdb; +Cc: Vincent Fortier
On Sep 12 2023, Vincent Fortier via Gdb wrote:
> Now the question is, how to fix that? Help would be much welcomed :)
You need to set CFLAGS_FOR_BUILD (to something non-empty), so it does
not default to $CFLAGS (which is questionable in the first place).
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug when cross-compiling for ppc
2023-09-14 6:24 ` Andreas Schwab
@ 2023-09-14 20:34 ` Vincent Fortier
0 siblings, 0 replies; 5+ messages in thread
From: Vincent Fortier @ 2023-09-14 20:34 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Vincent Fortier via Gdb
Le jeu. 14 sept. 2023, à 02 h 24, Andreas Schwab <schwab@suse.de> a écrit :
>
> On Sep 12 2023, Vincent Fortier via Gdb wrote:
>
> > Now the question is, how to fix that? Help would be much welcomed :)
>
> You need to set CFLAGS_FOR_BUILD (to something non-empty), so it does
> not default to $CFLAGS (which is questionable in the first place).
>
> --
> Andreas Schwab, SUSE Labs, schwab@suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."
For a start, I ended-up disabling sim entirely for PPC and now it's
building just fine. I had found a ticket from openwrt having a
somewhat similar issue that was disabling it as well. So I used that
option too.
I've tried that by setting CFLAGS_FOR_BUILD='-O2' just for the sake of
it not being empty but I'm still getting errors:
compilation terminated.
make[7]: *** [Makefile:660: table.o] Error 1
In file included from ./gen-icache.c:22:
./misc.h:23:10: fatal error: build-config.h: No such file or directory
23 | #include "build-config.h"
| ^~~~~~~~~~~~~~~~
Further looking into the logs there's this hidden in a temporary
directory (once rm of it is commented out)
configure:2482: checking whether the C compiler works
configure:2504: gcc -O2
-I/home/spksrc/qoriq-debug/spksrc/toolchain/syno-qoriq-6.2.4/work/powerpc-e500v2-linux-gnuspe/powerpc-e500v2-linux-gnuspe/sysroot/usr/include
-mcpu=8548 -mhard-float -mfloat-gprs=double
-I/home/spksrc/qoriq-debug/spksrc/cross/gdb-latest/work-qoriq-6.2.4/install/usr/local/gdb/include
conftest.c >&5
gcc: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
gcc: error: unrecognized command-line option '-mfloat-gprs=double'
configure:2508: $? = 1
configure:2546: result: no
The exec string from sim/ppc is
$ .././configure --enable-languages=all
--target=powerpc-e500v2-linux-gnuspe --host=i686-pc-linux
--build=i686-pc-linux
But as you can see I believe it refers to the "build" C compiler
instead of the"target" compiler OR uses the "target" flags instead of
the "build" flags (wonder why it would?).
Anyhow, disabling sim/ppc fixed things for now.
Migrating gdb to cmake using toolchain files or meson would
potentially remove these issues and simplify cross-compiling while
reducing build time. But that's unrelated...
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-14 20:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-12 16:42 Bug when cross-compiling for ppc Vincent Fortier
2023-09-14 2:25 ` Simon Marchi
2023-09-14 2:30 ` Simon Marchi
2023-09-14 6:24 ` Andreas Schwab
2023-09-14 20:34 ` Vincent Fortier
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).