Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id BC0A0E00C37; Thu, 7 Apr 2016 08:01:39 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] X-Greylist: delayed 528 seconds by postgrey-1.32 at yocto-www; Thu, 07 Apr 2016 08:01:35 PDT Received: from can05.de (can05.de [217.172.166.169]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 1484FE007C5 for ; Thu, 7 Apr 2016 08:01:35 -0700 (PDT) Received: from localhost.localdomain (unknown [194.95.250.53]) (Authenticated sender: web372p3) by can05.de (can05.de) with ESMTPA id 4E3171C2B1E; Thu, 7 Apr 2016 16:52:45 +0200 (CEST) From: Thomas Elste To: yocto@yoctoproject.org Date: Thu, 7 Apr 2016 16:52:32 +0200 Message-Id: <1460040752-9058-1-git-send-email-thomas.elste@imms.de> X-Mailer: git-send-email 2.4.10 Subject: [eclipse-poky][PATCH] org.yocto.sdk.ide: Use CFLAGS from CC variable in cmake toolchain file X-BeenThere: yocto@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Discussion of all things Yocto Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2016 15:01:39 -0000 The CC and CXX variables imported from the Yocto build environment may contain additional compiler flags after the compiler name. Extract those and add them to cmake toolchain file variables, too. Signed-off-by: Thomas Elste --- Hi, using the Yocto plugin for Eclipse to generate CMake based C projects I've encountered a problem. I'm using a standalone armhf toolchain (ADT) for building the project. Compiling works fine but linkings fails due to a mismatch in the FP ABI of object files and target sysroot libraries. This happens as the compiler is not called with all the flags necessary. The flags which appear in the environment file of the ADT in the CC/CXX variable are not present. For example CC for my toolchain looks like this: export CC="arm-poky-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=$SDKTARGETSYSROOT" Everything after the compiler name does not get integrated into the CMake toolchain file generated by the Eclipse plugin (which in case of the float-abi flag leads to the previous mentioned build error). So I propose the attached patch, which adds everything found (except sysroot entries) after the compiler name in the C/CXX build environment variable to the CMake toolchain file (OECMAKE_C_FLAGS, etc.). Best regards Thomas .../ide/natures/YoctoSDKCMakeProjectNature.java | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java index b3d0f2c..44ccfe6 100644 --- a/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java +++ b/plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/natures/YoctoSDKCMakeProjectNature.java @@ -45,19 +45,33 @@ public class YoctoSDKCMakeProjectNature extends YoctoSDKProjectNature { IEnvironmentVariable.ENVVAR_REPLACE, delimiter, ccdesc); String ccString = YoctoSDKUtils.getEnvValue(project, "CC"); + String ccFlagsString = ""; if (!ccString.equals("") && !ccString.equals(" ")) { ccString.trim(); - ccString = ccString.split(" ")[0]; + String[] ccSplitString = ccString.split(" "); + ccString = ccSplitString[0]; + + for(int i=1; i