public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Vincent Fortier <th0ma7@gmail.com>
To: gdb@sourceware.org
Subject: Bug when cross-compiling for ppc
Date: Tue, 12 Sep 2023 12:42:09 -0400	[thread overview]
Message-ID: <CALAySu+QEeH=g4=g34BVLG3CB9Rh_Ax-rChg4M-a6okY4U1_4A@mail.gmail.com> (raw)

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 :)

             reply	other threads:[~2023-09-12 16:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-12 16:42 Vincent Fortier [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALAySu+QEeH=g4=g34BVLG3CB9Rh_Ax-rChg4M-a6okY4U1_4A@mail.gmail.com' \
    --to=th0ma7@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).