public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
From: Chris Punches <chris.punches@silogroup.org>
To: crossgcc@sourceware.org
Subject: Using CT-NG generated cross-compiler to compile a native compiler w/ sysroot
Date: Sat, 19 Sep 2020 23:18:34 -0400	[thread overview]
Message-ID: <ea2af96b31416475a35a9444b97ad0b392030f38.camel@silogroup.org> (raw)

Hello,

I've made some progress in my efforts to build a suitable sysroot using CT-NG
but could use some information about how to use CT-NG to use existing crosstools
builds for subsequent builds...

I have built a statically linked gnu cross-compiler toolchain using CT-NG at
`/opt/cross-compiler/${target}/bin/${target}-${tool}`.

I have a link to the project here:

https://github.com/SILO-GROUP/Foster-B

The link to my CT-NG config is here:

https://github.com/SILO-GROUP/Foster-B/blob/master/workspace/sources/ctng.x86_64-multilib.config

I intend on using the crosstoolchain it built at `/opt/cross-compiler` to cross-
compile a native compiler toolchain for ${target} (starting out x86_64 multilib,
but there will be other architectures later), also using CT-NG as the
orchestrator, and this target-native toolchain should reside at
`/opt/sysroot/opt/compiler` and have all of its linked dependencies residing in
the parent `/opt/sysroot` directory tree.

To recap, the `/opt/cross-compiler` set runs on the host/build machine and
compiles for ${target} -- and the `/opt/sysroot/opt/compiler` toolchain should
RUN on the target machine and build for the target machine to populate a SYSROOT
at /opt/sysroot.

My question is -- how would I configure CT-NG to use `/opt/cross-
compiler/${target}/bin/${target}-*` during the compilation of the ${target}
toolchain I hope to create at `/opt/sysroot/opt/compiler`?

I looked in the docs for CT-NG which do not cover these types of things that I
can find.  Any help with setting this up would be appreciated.

I have distilled my main questions to a set of 3:

* 1.  

I see a way to specify the SYSROOT path using the config variables
`CT_SYSROOT_DIR_PREFIX` and `CT_SYSROOT_NAME`.  I am assuming I ought set for
these:

```
CT_SYSROOT_DIR=/opt/
CT_SYSROOT_NAME=sysroot
```
Please correct if I am misreading and that will not produce the specs I've
mentioned for the SYSROOT path as these are in the config file but not in the
official documentation at: https://crosstool-ng.github.io/docs/configuration/

This is somewhat confusing because /opt/sysroot does not exist, so there's
ambiguity about whether this is where it generates its toolchain sysroot or if
this is where it expects one to be.  Ideally in same-architecture scenarios I
should be able to chroot into this sysroot and use these tools at /opt/compiler
within it as if they were part of the system.

* 2. 

As you can see, `CT_TARGET_ALIAS` is set to an empty string currently in the
config yet the crosstools' binaries are being prepended with ${TARGET} for their
binary names, so, adding `/opt/cross-compiler/${target}/bin` to ${PATH} prior to
executing CT-NG will not cause it to use the tools in `/opt/cross-compiler`. 
How do I get CT-NG to use them?  Should I use some setting to prevent the
architecture from being prepended to the tool names and put a shim in path or is
there some other means of getting CT-NG to use them?

* 3.  

I am assuming for the `/opt/sysroot/opt/compiler` generation that this should
not be statically linked and that the CT_PREFIX_DIR should be set to
`/opt/sysroot/opt/compiler`.  If anyone is tracking what I'm trying to do,
please let me know if that is not correct.

The reason I ask this is that the CT_PREFIX_DIR variable in the config sample
this was derived from is more complex than that -- `CT_PREFIX_DIR="${CT_PREFIX:-
${CX_DIR}}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"`

-

This will be a glibc and linux-utils build; any additional insight that anyone
might find useful to communicate would be appreciated as well; lots of ambiguity
here.

Thanks in advance,

-C



             reply	other threads:[~2020-09-20  3:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-20  3:18 Chris Punches [this message]
2020-09-28  4:27 ` Chris Punches

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=ea2af96b31416475a35a9444b97ad0b392030f38.camel@silogroup.org \
    --to=chris.punches@silogroup.org \
    --cc=crossgcc@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).