From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 12 17:02:57 2020 Received: (at submit) by debbugs.gnu.org; 12 Feb 2020 22:02:57 +0000 Received: from localhost ([127.0.0.1]:59148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j205x-0004A0-EA for submit@debbugs.gnu.org; Wed, 12 Feb 2020 17:02:57 -0500 Received: from lists.gnu.org ([209.51.188.17]:44041) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j1zqU-0003mB-7w for submit@debbugs.gnu.org; Wed, 12 Feb 2020 16:46:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52020) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1zqR-0001Th-HC for bug-libtool@gnu.org; Wed, 12 Feb 2020 16:46:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1zqQ-0008UH-3e for bug-libtool@gnu.org; Wed, 12 Feb 2020 16:46:55 -0500 Received: from haggis.mythic-beasts.com ([2a00:1098:0:86:1000:0:2:1]:42217) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j1zqN-0008S3-8c for bug-libtool@gnu.org; Wed, 12 Feb 2020 16:46:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=apebox.org; s=mythic-beasts-k1; h=Date:Subject:From:To; bh=NDgtzF/vjhWNDkwPuTUxViXCPbnkmnGSJrqErxJIyIM=; b=flizfcFD3LWDwYWHiinx0PWklv 65RCfzOlILc/3awiL6GsFHTbhwecmum7PeANTI0UzEdMN161m78eUMcWxz7EKJMLo2c0BpNMzxgHs 7KuwQTFzWM6G3Il0M8Qj8HYPBRewygmnyNSQN4aAEuKIWjQRMnYNsKkwt9JQwZ4e3AZCtHOmgRTyL 1J+XuXl+R2gdBp9HJGfeW76MBdH/IUe2kdzS4gA5Zx7bI25UquGL+EmyyelHe0kfuw1ugQM7xohLl yhWj7DKQ1P16oiOZa49S1Vcaep16Gxt3gH+Kbu0D1cnzJ8Ae2otVZ9xiaEQdmhHzLfi9TdCbZld5l 3SS7vLPA==; Received: from [2001:4898:a800:1010:b9ac:715:15f:52b2] (port=38922 helo=[IPv6:2001:4898:4030:14:3179:715:15f:52b2]) by haggis.mythic-beasts.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1j1zqK-0000w7-Rv for bug-libtool@gnu.org; Wed, 12 Feb 2020 21:46:49 +0000 To: bug-libtool@gnu.org From: Jo Shields Subject: Error with cross-compiling where CCLD is Clang Autocrypt: addr=directhex@apebox.org; keydata= xsBNBEoEKEABCADYZa7mtthSTxQwwlflB/XnvZSyxBrObNypbsr+TnKtgW7k4ojXm9EQgzwN Qm4vKrqA4run0GkPQxsmBOf6BSs9RsKA63wXuSR6TapnJCBY/DHhPXMlFRd0cjdG2dqNp2+f swqJIC6HJENjWt4lr7biMAcnWKYL1Yzgz1HjfOUtaKzZtsIpKosKptRI8pQoCSYxLbTj2iyU +3g7en1qqMve+55cqe/39lcJdgqxI0SSTWtOLp0y+gJQjxwOeA2gnwhZnnAfb0QOayP21zgE W2JgPoKdGL/UZcPGQz0q/CcVgKRxMXu/HzT+aWcnIWWwrH1FeQq+GyDfCneIOYQSXwJHABEB AAHNIUpvIFNoaWVsZHMgPGRpcmVjdGhleEBhcGVib3gub3JnPsLAegQTAQgAJAIbAwIeAQIX gAULCQgHAwUVCgkICwUWAgMBAAUCSrpsRgIZAQAKCRDJD5y5Dh+tDGNFB/92WE10RH9RGFrd 5BjEc+obT0qtLbCCrV1tafCtjBxW/CR1nB6PbjJGI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MHgxu3P1U1hhV3fxYYkwaNkVKaFoIstPvU1CW5h98QA03vQWGR rp4du5TCoXL0EzCyfDm0hVhssmMd+RRsXz3mkizY4IHL1vcgGN5OByn5U56QJ/dfhSRW+lY/ 4i804DjlcLKkwKlb073LIbRDbjloE4vVcX41JSdathMxAMOih0oW8HMwmdNwqkBEp+hgcZTe AIGPofG/vlhClErkj9usmv8Mff6/MgMJMxcGdSBYeXpPNfKLW1inFlCfaw5zoUV+rY171SLA jU3d2u/T9UMCA33uSOGf93uZcZvDe3cjiedZ6tHmjhphstsSJ5c= Message-ID: <4d3d36f9-216a-9153-f92e-08ae327de31e@apebox.org> Date: Wed, 12 Feb 2020 16:46:37 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="AHBfHckjqffYnl4fUp5MgC7tBEROelfEv" X-BlackCat-Spam-Score: -21 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1098:0:86:1000:0:2:1 X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 12 Feb 2020 17:02:55 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --AHBfHckjqffYnl4fUp5MgC7tBEROelfEv Content-Type: multipart/mixed; boundary="CCfes8ShyDj1g8pibyPsx0kitwm1vHPhC" --CCfes8ShyDj1g8pibyPsx0kitwm1vHPhC Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi, I've been working on a project where we cross-compile for aarch64, on an x86_64 host. The compiler we're under orders to use (I have no say here) is Clang. The norm with GCC is for a `triplet-gcc` binary as CC. For Clang, cross-compiling is achieved with a `--target=3Dtriplet` compiler flag - i= =2Ee. `aarch64-linux-gnu-gcc foo.c` vs `clang --target=3Daarch64-linux-gnu foo.c` Critically, this applies even for cases where CC is being used as the linker (i.e. CCLD=3Dclang). If no `--target` is specified, Clang will use= the native (x86_64) linker, not the linker specified in LD. This can be worked around by throwing `-XCClinker --target=3Dtriplet` int= o every linker invocation in every makefile, but it would be nice if instead, ltmain preserved the `--target` parameter in func_mode_link (e.g. the way it does for `--sysroot`) --CCfes8ShyDj1g8pibyPsx0kitwm1vHPhC-- --AHBfHckjqffYnl4fUp5MgC7tBEROelfEv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEwQsMQnGBo0sbxf7dyQ+cuQ4frQwFAl5EckUACgkQyQ+cuQ4f rQyA4Qf+LRTgKkPvDuTS0AwCym8p/Zz3OwQ0PZ0hsvsNDsicJj2hxDzF0D7MPfnU eh/LY4VOrAPKnIkXH4YdvXXyB5XcvWbyzsaeYlhDONmW1v6ONOnYFcP8axI9W6GS BmVJAnFSd/lHu63NSBrejubhAWdGTtyYMjf8wyOfmtzAbT9KNLFxq41zO/gHG+YQ kR36tFRfS1BeU81s5dQFTtQWf4u6V/Wu7HmZaVZi1Gz1gwizznn2sZVn9ewfM+ro Ox7DdDyZcC+/z8Jr/f5Ji3bURAmEJfqcHXjLMbyoMRct4SPIHsBAaIjUsrb9PsBr dE9tHZmqEi3QyTg5Sll2WX8GCc556g== =uHWR -----END PGP SIGNATURE----- --AHBfHckjqffYnl4fUp5MgC7tBEROelfEv-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 12 17:19:47 2020 Received: (at submit) by debbugs.gnu.org; 12 Feb 2020 22:19:48 +0000 Received: from localhost ([127.0.0.1]:59165 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j20MF-0004a5-Ld for submit@debbugs.gnu.org; Wed, 12 Feb 2020 17:19:47 -0500 Received: from lists.gnu.org ([209.51.188.17]:50181) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j20MD-0004Zx-V5 for submit@debbugs.gnu.org; Wed, 12 Feb 2020 17:19:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41497) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j20MC-0005O6-M1 for bug-libtool@gnu.org; Wed, 12 Feb 2020 17:19:45 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j20MB-0001rp-Ad for bug-libtool@gnu.org; Wed, 12 Feb 2020 17:19:44 -0500 Received: from smtp.simplesystems.org ([65.66.246.90]:50239) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j20MA-0001qr-Qn for bug-libtool@gnu.org; Wed, 12 Feb 2020 17:19:43 -0500 Received: from scrappy.simplesystems.org (scrappy.simplesystems.org [65.66.246.73]) by smtp.simplesystems.org (8.14.4+Sun/8.14.4) with ESMTP id 01CMJQZ7019225; Wed, 12 Feb 2020 16:19:26 -0600 (CST) Date: Wed, 12 Feb 2020 16:19:26 -0600 (CST) From: Bob Friesenhahn X-X-Sender: bfriesen@scrappy.simplesystems.org To: Jo Shields Subject: Re: bug#39583: Error with cross-compiling where CCLD is Clang In-Reply-To: <4d3d36f9-216a-9153-f92e-08ae327de31e@apebox.org> Message-ID: References: <4d3d36f9-216a-9153-f92e-08ae327de31e@apebox.org> User-Agent: Alpine 2.20 (GSO 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (smtp.simplesystems.org [65.66.246.90]); Wed, 12 Feb 2020 16:19:27 -0600 (CST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux (Android) [fuzzy] X-Received-From: 65.66.246.90 X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: submit Cc: 39583@debbugs.gnu.org, bug-libtool@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) On Wed, 12 Feb 2020, Jo Shields wrote: > Hi, > > I've been working on a project where we cross-compile for aarch64, on an > x86_64 host. The compiler we're under orders to use (I have no say here) > is Clang. > > The norm with GCC is for a `triplet-gcc` binary as CC. For Clang, > cross-compiling is achieved with a `--target=triplet` compiler flag - i.e. > > `aarch64-linux-gnu-gcc foo.c` > > vs > > `clang --target=aarch64-linux-gnu foo.c` > > Critically, this applies even for cases where CC is being used as the > linker (i.e. CCLD=clang). If no `--target` is specified, Clang will use > the native (x86_64) linker, not the linker specified in LD. > > This can be worked around by throwing `-XCClinker --target=triplet` into > every linker invocation in every makefile, but it would be nice if > instead, ltmain preserved the `--target` parameter in func_mode_link > (e.g. the way it does for `--sysroot`) It is not necessary for Autotools to conform and adapt to this clang option. Instead, developers/users of clang-based cross-compilation configurations should arrange so that program files like 'aarch64-linux-gnu-clang' exist. This tool naming strategy is for the benefit of Autotools and other build scripts and not for the compiler's benefit. It is important to maintain the common conventions which have worked sucessfully for many years. If clang does not have a default cross-compilation target so the paths can be created using symbolic links, then trivial wrapper scripts/programs can be created so that clang is automatically provided with the correct arguments. Bob -- Bob Friesenhahn bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt