From patchwork Wed Aug 7 16:27:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1143590 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=smile.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=smile-fr.20150623.gappssmtp.com header.i=@smile-fr.20150623.gappssmtp.com header.b="EtlNCVgq"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 463cNL6T4nz9s3Z for ; Thu, 8 Aug 2019 02:27:14 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 1724B22767; Wed, 7 Aug 2019 16:27:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sV310KQRV8SN; Wed, 7 Aug 2019 16:27:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id AF7C12280C; Wed, 7 Aug 2019 16:27:09 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id AD23B1BF4E4 for ; Wed, 7 Aug 2019 16:27:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A9ACA876C5 for ; Wed, 7 Aug 2019 16:27:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i3rFYVGtzQPf for ; Wed, 7 Aug 2019 16:27:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by whitealder.osuosl.org (Postfix) with ESMTPS id 185E6876C0 for ; Wed, 7 Aug 2019 16:27:06 +0000 (UTC) Received: by mail-wr1-f49.google.com with SMTP id p13so17419461wru.10 for ; Wed, 07 Aug 2019 09:27:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smile-fr.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ahOpnxUWkjDoxN6R7BSI66eev9onIIxCSTVuuztrh5U=; b=EtlNCVgqQBH3s75bEldOERwpzZmK9ea3FYLtp11vCdwVH+u8DbuVDsru0VDR9dlM06 55b1tYi/iefn/ajHvt7scG540gg2NFe/KXOaTHFBTuz2BvC9goxCtflXOeZfHOdwrGRe /IeweW/pUrA1hJH5ywnsYfcGCTAAKvUCh2CF48xq/8+V0jJPvVvlxyiuC0cA8N5huU/p z32KZ4EIpku/Th3Hy7N/LqrsNwxiTOCrqTiRiTcUK++Q/ZCpKYRLAZ7SxiTruYGbR8Sn FZNLHf6YeciOVEBwfF2RMBhb83DbZNUCj2rgEzIwatS+j7JnLf/B82jXumweeBCQUNOq H3Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ahOpnxUWkjDoxN6R7BSI66eev9onIIxCSTVuuztrh5U=; b=lmEeyG/dECR8N9fUA0JRi/UADf4TOgkE5Q6sQM9zinRUQlvU+38JmaWawC9FOKfDFo F27Fq1Dk0SGKB8VHU0G+cAkL2ZQvcTbYNDc4+XUlswndMotds6lHa8+jsCLipNxdbOx6 5Is97+NuDbOXWllA0tDo7+kXWrENuaQ0o6vPUrgC5GdlxRMmnkDOkrUlYKTEDrunjPmH Cc8WNx363U5TG2zh8y2H/qYtSjHBeMx81F+T5Bw3v2rJTsW3CbJHxey8kuQpkfRWnFY9 S0CnyQgsz/JOejALCEQpgYLxoTyuesX90XzozGRu1YJj4uVoR3FVH3dkY7POjeP+Dm0P /FUw== X-Gm-Message-State: APjAAAXR6yJo8KQ+yJRUUNUpoHw1xYn0VVBgLBsEVwaejf23ypaW4GKT sypImcN5wJkP3nRvNRK3IgSTBRMz5GE= X-Google-Smtp-Source: APXvYqzLApwlbOrQeAzRemYBRPWqOqKXk+dRVtlOj8Jr9b1YixcGHwzUSixuMhdBhd2+ki/SHxWZ2A== X-Received: by 2002:adf:f005:: with SMTP id j5mr11165569wro.251.1565195225240; Wed, 07 Aug 2019 09:27:05 -0700 (PDT) Received: from ASN-evian.nantes.intranet (static-css-ccs-204145.business.bouyguestelecom.com. [176.157.204.145]) by smtp.gmail.com with ESMTPSA id u13sm3203125wrw.45.2019.08.07.09.27.04 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 07 Aug 2019 09:27:04 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Wed, 7 Aug 2019 18:27:01 +0200 Message-Id: <20190807162701.28679-1-romain.naour@smile.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] package/clang: set the path to the sysroot X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Romain Naour , Valentin Korenblit Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" While testing a clang toolchain to build userspace application after building an internal toolchain with Buildroot, the build failed due to host linker being used (/usr/bin/ld). Clang needs some files (libgcc.a, crt*.o) from the gcc toolchain to complete to build. The sysroot is not set when Clang's "Gnu Toolchains driver" try to find the gcc cross-toolchain [1]. The issue is trigged only with the Buildroot's internal toolchain backend. For the toolchain external toolchain, clang is able to guess where to find the cross toolchain (probably because the sysroot is relocated while importing the external toolchain). The issue is fixed by setting path to STAGING_DIR to DEFAULT_SYSROOT. [1] https://github.com/llvm-mirror/clang/blob/release_80/lib/Driver/ToolChains/Gnu.cpp#L1693 Signed-off-by: Romain Naour Cc: Valentin Korenblit --- package/clang/clang.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/clang/clang.mk b/package/clang/clang.mk index 07e7fced2a..3059fb8676 100644 --- a/package/clang/clang.mk +++ b/package/clang/clang.mk @@ -43,6 +43,11 @@ CLANG_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release CLANG_CONF_OPTS += -DCMAKE_CROSSCOMPILING=1 +# Provide the path the the gcc toolchain sysroot (STAGING_DIR) +# otherwise the (host) clang's "Gnu Toolchains driver" will +# fallback to the host's root directory "/". +HOST_CLANG_CONF_OPTS += -DDEFAULT_SYSROOT=$(STAGING_DIR) + # We need to build tools because libclang is a tool HOST_CLANG_CONF_OPTS += -DCLANG_BUILD_TOOLS=ON CLANG_CONF_OPTS += -DCLANG_BUILD_TOOLS=ON