Environment Variables Ignored in 0.11.0
See original GitHub issueBrief Issue Summary
Environment variables defined in project settings.json are ignored.
Expected:
Previous versions of CMake Tools were using the cmake.environment variable set in my project settings.json file.
Apparent Behavior:
CMake is completely ignoring those environment variables. It tries to compile the test program but fails to find a linker.
CMake Tools Log
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_C_COMPILER:FILEPATH=/opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -H/home/skrawn/Documents/program -B/home/skrawn/Documents/program/Debug
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is GNU 6.3.0
[cmake] -- The CXX compiler identification is GNU 7.2.0
[cmake] -- Check for working C compiler: /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
[cmake] -- Check for working C compiler: /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -- broken
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "/home/skrawn/Documents/program/Debug/CMakeFiles/CMakeOutput.log".
[cmake] See also "/home/skrawn/Documents/program/Debug/CMakeFiles/CMakeError.log".
[cmake] CMake Error at /usr/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
[cmake] The C compiler
[cmake] "/opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc"
[cmake] is not able to compile a simple test program.
[cmake]
[cmake] It fails with the following output:
[cmake]
[cmake] Change Dir: /home/skrawn/Documents/program/Debug/CMakeFiles/CMakeTmp
[cmake]
[cmake]
[cmake]
[cmake] Run Build Command:"/usr/bin/make" "cmTC_36428/fast"
[cmake]
[cmake] /usr/bin/make -f CMakeFiles/cmTC_36428.dir/build.make
[cmake] CMakeFiles/cmTC_36428.dir/build
[cmake]
[cmake] make[1]: Entering directory
[cmake] '/home/skrawn/Documents/program/Debug/CMakeFiles/CMakeTmp'
[cmake]
[cmake]
[cmake] Building C object CMakeFiles/cmTC_36428.dir/testCCompiler.c.o
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
[cmake] -o CMakeFiles/cmTC_36428.dir/testCCompiler.c.o -c
[cmake] /home/skrawn/Documents/program/Debug/CMakeFiles/CMakeTmp/testCCompiler.c
[cmake]
[cmake]
[cmake] Linking C executable cmTC_36428
[cmake]
[cmake] /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_36428.dir/link.txt
[cmake] --verbose=1
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
[cmake] -rdynamic CMakeFiles/cmTC_36428.dir/testCCompiler.c.o -o cmTC_36428
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.3.0/real-ld:
[cmake] cannot find crt1.o: No such file or directory
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.3.0/real-ld:
[cmake] cannot find crti.o: No such file or directory
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.3.0/real-ld:
[cmake] cannot find crtbegin.o: No such file or directory
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.3.0/real-ld:
[cmake] cannot find -lgcc
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.3.0/real-ld:
[cmake] cannot find -lgcc_s
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.3.0/real-ld:
[cmake] cannot find -lc
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.3.0/real-ld:
[cmake] cannot find -lgcc
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.3.0/real-ld:
[cmake] cannot find -lgcc_s
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.3.0/real-ld:
[cmake] cannot find crtend.o: No such file or directory
[cmake]
[cmake]
[cmake] /opt/poky/2.3.3/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/6.3.0/real-ld:
[cmake] cannot find crtn.o: No such file or directory
[cmake]
[cmake] collect2: error: ld returned 1 exit status
[cmake]
[cmake] CMakeFiles/cmTC_36428.dir/build.make:97: recipe for target 'cmTC_36428'
[cmake] failed
[cmake]
[cmake] make[1]: *** [cmTC_36428] Error 1
[cmake]
[cmake] make[1]: Leaving directory
[cmake] '/home/skrawn/Documents/program/Debug/CMakeFiles/CMakeTmp'
[cmake]
[cmake]
[cmake] Makefile:126: recipe for target 'cmTC_36428/fast' failed
[cmake]
[cmake] make: *** [cmTC_36428/fast] Error 2
[cmake]
[cmake]
[cmake]
[cmake]
[cmake]
[cmake] CMake will not be able to correctly generate this project.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt:4 (PROJECT)
[cmake]
[cmake]
Platform and Versions
- Operating System: Ubuntu
- CMake Version: 3.9
- VSCode Version: 1.22.1
- CMake Tools Extension Version: 0.11.0
- Compiler/Toolchain: arm-poky-gnueabi-linux 6.3.0
Other Notes/Information
Documentation says to leave environment variables in settings.json…so what do?
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Environment Variables Ignored in 0.11.0 · Issue #384 - GitHub
Apparent Behavior: CMake is completely ignoring those environment variables. It tries to compile the test program but fails to find a linker.
Read more >GitLab ignoring no_proxy? (#17587) · Issues
I have GitLab 8.7.4 installed in an environment that needs use of a proxy server to access the internet but not a number...
Read more >Proxy Settings — Jannovar 0.11.0 documentation
If you do not have to use a proxy then you can ignore this section. ... Jannovar interprets the following environment variables that...
Read more >Environment Variables are Ignored in Exclude Path Patterns
Environment Variables are Ignored in Exclude Path Patterns. This issue appears when the exclude path pattern contains an environment variable.
Read more >Configuration - Invoke documentation - PyInvoke
Environment variables found in the invoking shell environment. ... load the first one we find, and ignore any others that might exist.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vector-of-bool thank you for the update, this fixed my issue! I’ll deal with the CMake server thing later.
I was able to reproduce and fix the issue. It was a silly mistake with a hole in the TS type-checker. I found that the issue only occurs when using non-cmake-server mode. The legacy driver wasn’t receiving the environment variables from configuration.
The issue you’re seeing when you enable CMake Server is another issue. If I were you, I’d do some investigation and maybe open another issue for it.