All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] Using cross tools without knowing the cross prefix
Date: Mon, 12 Feb 2018 13:39:33 +0100	[thread overview]
Message-ID: <CAAXf6LU9ZkpV+3wbjM_Ybb6F0DKsMY+8MUAd2SQi2ap2PnZ55A@mail.gmail.com> (raw)

Hi,

The cross tools installed/extracted by Buildroot are in
$(HOST_DIR)/bin/ and are called
<prefix>-gcc, <prefix>-gdb, etc. where <prefix> could e.g.
mips64-octeon-linux-gnu-

When working with many different Buildroot repositories and some
common wrapper logic external to Buildroot (which I believe is not
uncommon, at least in corporate environments) one does not always know
the prefix upfront. One typically knows the path the Buildroot
repository and the defconfig it should use, but all other details are
supposed to be internal to Buildroot.

As such, there is not really a simple way to refer to these cross
tools. One has to guess/determine the correct prefix.

Things become even more complex when tools could be named differently
depending on whether they originate from an external toolchain, or are
built by Buildroot, like gdb. As can be seen from the comment and
logic in method setup_gdb_wrapper in (rejected) patch [1], there are
several cases to consider:

For internal toolchains:
 - if BR2_PACKAGE_HOST_GDB is set, gdb is built by buildroot and a real file at
   $(TARGET_CROSS)gdb ( == $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-gdb )
For external toolchains:
 - if BR2_PACKAGE_HOST_GDB is not set, gdb is provided by the external
   toolchain and $(TARGET_CROSS)gdb is a symlink.
 - if BR2_PACKAGE_HOST_GDB is set, gdb is built by buildroot and a real file at
   $(HOST_DIR)/usr/bin/$(GNU_TARGET_NAME)-gdb


Today, in our local tree, we add a symlink
output/host/usr/bin/cross-gdb that points to the correct one. The
external script then can point to that common path without having to
know the underlying prefix.
Using something like 'output/host/usr/bin/*-gdb' does not work
reliably because the external toolchain could provide an (old) gdb and
Buildroot could build one as well (typically a newer one).


While I'm currently mostly interested in cross-gdb, the problem is
generic for cross-gcc, cross-g++, ... as well. Can we create a
mechanism that solves this problem generically, for example by
adding links cross-<tool> for every useful tool inside $(HOST_DIR)/bin?
Or alternatively, use a second directory tree like:
$(HOST_DIR)/bin/cross/{gcc,gdb,nm,readelf} etc. ?

Thanks for your input,
Thomas


[1] http://lists.busybox.net/pipermail/buildroot/2016-April/160055.html

             reply	other threads:[~2018-02-12 12:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12 12:39 Thomas De Schampheleire [this message]
2018-02-14 16:55 ` [Buildroot] Using cross tools without knowing the cross prefix Matthew Weber

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=CAAXf6LU9ZkpV+3wbjM_Ybb6F0DKsMY+8MUAd2SQi2ap2PnZ55A@mail.gmail.com \
    --to=patrickdepinguin@gmail.com \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.