Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cpptools integration does not respect sysroot and compiler flags when crosscompiling #637

Open
bjosa opened this Issue Jan 20, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@bjosa
Copy link
Contributor

bjosa commented Jan 20, 2019

Brief Issue Summary

Using a cross compile toolchain e.g. cortexa9t2hf-neon-linux-gnueabi with a sysroot folder for the target filesystem.
The CMake toolchain file sets architecture specific compile flags and the CMAKE_SYSROOT variable.

When using the cpptools integration, to autoconfigure the Microsoft C/C++ cpptools Extension, these flags and the sysroot folder are not respected from the cpptools extension. Seems cmake-tools does not hand these settings over to the cpptools extension.

We get error squiggles for not existing header files and incorrect intellisens due to wrong defines that describe the architectur e.g. hard-float vs. soft-float.

Wrong:

cpptools extension output:

Custom configurations received:
  uri: file:///c%3A/.../test.cpp
  config: {
  "defines": [],
  "standard": "c++17",
  "includePath": [
    "C:/...test/src",
    "C:/.../test/build/src",
    "C:/.../test/include",
    "C:/sdk/sysroots/cortexa9t2hf-neon-linux-gnueabi/usr/include/testlib"
  ],
  "intelliSenseMode": "clang-x64",
  "compilerPath": "C:/sdk/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-linux-gnueabi/arm-linux-gnueabi-g++.exe"
}
Custom browse configuration received: {
  "browsePath": [
    "C:/.../test/include",
    "C:/sdk/sysroots/cortexa9t2hf-neon-linux-gnueabi/usr/include/testlib",
    "C:/.../test/src",
    "C:/.../test/build/src"
  ],
  "standard": "c++17",
  "compilerPath": "C:/sdk/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-linux-gnueabi/arm-linux-gnueabi-g++.exe"
}
...
sending compilation args for C:\...\TEST\SRC\HEWO\TEST.CPP
  include: C:\...\TEST\SRC
  include: C:\...\TEST\BUILD\SRC
  include: C:\...\TEST\INCLUDE
  include: C:\SDK\SYSROOTS\cortexa9t2hf-neon-linux-GNUEABI\USR\INCLUDE\TESTLIB
  include: C:\SDK\SYSROOTS\X86_64-POKYSDK-MINGW32\USR\LIB\ARM-LINUX-GNUEABI\GCC\ARM-LINUX-GNUEABI\6.2.0\INCLUDE
  include: C:\SDK\SYSROOTS\X86_64-POKYSDK-MINGW32\USR\LIB\ARM-LINUX-GNUEABI\GCC\ARM-LINUX-GNUEABI\6.2.0\INCLUDE-FIXED
  define: __STDC__=1
  define: __cplusplus=201500L
  define: __STDC_UTF_16__=1
  define: __STDC_UTF_32__=1
  define: __STDC_HOSTED__=1
  define: __GNUC__=6
  define: __GNUC_MINOR__=2
  define: __GNUC_PATCHLEVEL__=0
  define: __VERSION__="6.2.0"
  ...

Expected:

cpptools extension output:

Custom configurations received:
  uri: file:///c%3A/.../test/src/hewo/test.cpp
  config: {
  "defines": [],
  "standard": "c++17",
  "includePath": [
    "C:/.../test/src",
    "C:/.../test/build/src",
    "C:/.../test/include",
    "C:/sdk/sysroots/cortexa9t2hf-neon-linux-gnueabi/usr/include/testlib"
  ],
  "intelliSenseMode": "clang-x64",
  "compilerPath": "C:/sdk/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-linux-gnueabi/arm-linux-gnueabi-g++.exe -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -g --sysroot=C:/sdk/sysroots/cortexa9t2hf-neon-linux-gnueabi"
}
Custom browse configuration received: {
  "browsePath": [
    "C:/.../test/include",
    "C:/sdk/sysroots/cortexa9t2hf-neon-linux-gnueabi/usr/include/testlib",
    "C:/.../test/src",
    "C:/.../test/build/src"
  ],
  "standard": "c++17",
  "compilerPath": "C:/sdk/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-linux-gnueabi/arm-linux-gnueabi-g++.exe -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -g --sysroot=C:/sdk/sysroots/cortexa9t2hf-neon-linux-gnueabi"
}
...
sending compilation args for C:\...\TEST\SRC\HEWO\TEST.CPP
  include: C:\...\TEST\SRC
  include: C:\...\TEST\BUILD\SRC
  include: C:\...\TEST\INCLUDE
  include: C:\SDK\SYSROOTS\CORTEXA9T2HF-NEON-LINUX-GNUEABI\USR\INCLUDE\TESTLIB
  include: C:\SDK\SYSROOTS\X86_64-POKYSDK-MINGW32\USR\LIB\ARM-LINUX-GNUEABI\GCC\ARM-LINUX-GNUEABI\6.2.0\INCLUDE
  include: C:\SDK\SYSROOTS\X86_64-POKYSDK-MINGW32\USR\LIB\ARM-LINUX-GNUEABI\GCC\ARM-LINUX-GNUEABI\6.2.0\INCLUDE-FIXED
  include: C:\SDK\SYSROOTS\CORTEXA9T2HF-NEON-LINUX-GNUEABI\USR\INCLUDE\C++\6.2.0
  include: C:\SDK\SYSROOTS\CORTEXA9T2HF-NEON-LINUX-GNUEABI\USR\INCLUDE\C++\6.2.0\ARM-LINUX-GNUEABI
  include: C:\SDK\SYSROOTS\CORTEXA9T2HF-NEON-LINUX-GNUEABI\USR\INCLUDE\C++\6.2.0\BACKWARD
  include: C:\SDK\SYSROOTS\CORTEXA9T2HF-NEON-LINUX-GNUEABI\USR\LIB\GCC\ARM-LINUX-GNUEABI\6.2.0\INCLUDE
  include: C:\SDK\SYSROOTS\CORTEXA9T2HF-NEON-LINUX-GNUEABI\USR\INCLUDE
  define: __STDC__=1
  define: __cplusplus=201500L
  define: __STDC_UTF_16__=1
  define: __STDC_UTF_32__=1
  define: __STDC_HOSTED__=1
  define: __GNUC__=6
  define: __GNUC_MINOR__=2
  define: __GNUC_PATCHLEVEL__=0
  define: __VERSION__="6.2.0"
  ...
  define: __VFP_FP__=1
  define: __ARM_FP=12
  define: __ARM_NEON__=1
  define: __ARM_NEON=1
  define: __ARM_NEON_FP=4
  ...

Note that the compiler flags and the sysroot is appended to the compilerPath for the cpptools configuration.

Platform and Versions

  • Operating System: Windows 10
  • CMake Version: 3.13.0-rc3
  • VSCode Version: 1.30.2
  • CMake Tools Extension Version: 1.1.3
  • Microsoft C/C++ cpptools Extension Version: 0.20.1
  • Compiler/Toolchain: gcc-6.2.0 (arm-linux-gnueabi)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.