From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from host02.dmghosting.com (host.dmghosting.com [69.16.219.106]) by sourceware.org (Postfix) with ESMTPS id A2797385700D for ; Sun, 20 Sep 2020 03:18:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A2797385700D Received: from cpe-71-65-85-222.cinci.res.rr.com ([71.65.85.222]:38326 helo=forge.silogroup.lan) by host02.dmghosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kJps2-0005Pz-Vf for crossgcc@sourceware.org; Sat, 19 Sep 2020 23:18:35 -0400 Message-ID: Subject: Using CT-NG generated cross-compiler to compile a native compiler w/ sysroot From: Chris Punches To: crossgcc@sourceware.org Date: Sat, 19 Sep 2020 23:18:34 -0400 Organization: SILO GROUP, LLC Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host02.dmghosting.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - silogroup.org X-Get-Message-Sender-Via: host02.dmghosting.com: authenticated_id: chris.punches@silogroup.org X-Authenticated-Sender: host02.dmghosting.com: chris.punches@silogroup.org X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: crossgcc@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: crossgcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Sep 2020 03:18:38 -0000 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