I am using VSCode for Pi Pico and followed this tutorial https://www.youtube.com/watch?v=mUF9xjDtFfY&ab_channel=LearnEmbeddedSystems. Everything was working fine yesterday and today when I went to configure my files and further build them I am met with this in my output window in vscode:
[variant] Loaded new set of variants
[kit] Successfully loaded 1 kits from C:\Users\faith\AppData\Local\CMakeTools\cmake-tools-kits.json
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --version
[proc] Executing command: "C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.07\bin\arm-none-eabi-gcc.exe" -v
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" "-SC:/Users/faith/CSU23021 Microprocessor Systems/pico-apps/assignments/assign01" "-Bc:/Users/faith/CSU23021 Microprocessor Systems/build" -G "NMake Makefiles"
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" "-SC:/Users/faith/CSU23021 Microprocessor Systems/pico-apps/assignments/assign01" "-Bc:/Users/faith/CSU23021 Microprocessor Systems/build" -G "NMake Makefiles" exited with code: 1
[main] Configuring project: CSU23021 Microprocessor Systems
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.07\bin\arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.07\bin\arm-none-eabi-g++.exe" "-SC:/Users/faith/CSU23021 Microprocessor Systems/pico-apps/assignments/assign01" "-Bc:/Users/faith/CSU23021 Microprocessor Systems/build" -G "NMake Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Warning (dev) in CMakeLists.txt:
[cmake] No project() command is present. The top-level CMakeLists.txt file must
[cmake] contain a literal, direct call to the project() command. Add a line of
[cmake] code such as
[cmake]
[cmake] project(ProjectName)
[cmake]
[cmake] near the top of the file, but after cmake_minimum_required().
[cmake]
[cmake] CMake is pretending there is a "project(Project)" command on the first
[cmake] line.
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[main] Configuring project: CSU23021 Microprocessor Systems
[cmake] -- The C compiler identification is GNU 10.3.1
[cmake] -- The CXX compiler identification is GNU 10.3.1
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Check for working C compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.07/bin/arm-none-eabi-gcc.exe
[cmake] -- Check for working C compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.07/bin/arm-none-eabi-gcc.exe - broken
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
[cmake] The C compiler
[cmake]
[cmake] "C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.07/bin/arm-none-eabi-gcc.exe"
[cmake]
[cmake] is not able to compile a simple test program.
[cmake]
[cmake] It fails with the following output:
[cmake]
[cmake] Change Dir: C:/Users/faith/CSU23021 Microprocessor Systems/build/CMakeFiles/CMakeScratch/TryCompile-6dlzjh
[cmake]
[cmake] Run Build Command(s):nmake -f Makefile /nologo cmTC_c113f\fast && "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\nmake.exe" -f CMakeFiles\cmTC_c113f.dir\build.make /nologo -L CMakeFiles\cmTC_c113f.dir\build
[cmake] Building C object CMakeFiles/cmTC_c113f.dir/testCCompiler.c.obj
[cmake] C:\PROGRA~2\GNUARM~1\102021~1.07\bin\AR19DD~1.EXE -o CMakeFiles\cmTC_c113f.dir\testCCompiler.c.obj -c "C:\Users\faith\CSU23021 Microprocessor Systems\build\CMakeFiles\CMakeScratch\TryCompile-6dlzjh\testCCompiler.c"
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/faith/CSU23021 Microprocessor Systems/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "C:/Users/faith/CSU23021 Microprocessor Systems/build/CMakeFiles/CMakeError.log".
[cmake] Linking C executable cmTC_c113f.exe
[cmake] "C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_c113f.dir/objects.a
[cmake] C:\PROGRA~2\GNUARM~1\102021~1.07\bin\ARM-NO~2.EXE qc CMakeFiles\cmTC_c113f.dir/objects.a #CMakeFiles\cmTC_c113f.dir\objects1
[cmake] C:\PROGRA~2\GNUARM~1\102021~1.07\bin\AR19DD~1.EXE -Wl,--whole-archive CMakeFiles\cmTC_c113f.dir/objects.a -Wl,--no-whole-archive -o cmTC_c113f.exe -Wl,--out-implib,libcmTC_c113f.dll.a -Wl,--major-image-version,0,--minor-image-version,0 #CMakeFiles\cmTC_c113f.dir\linkLibs.rsp
[cmake] c:/progra~2/gnuarm~1/102021~1.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version'
[cmake] c:/progra~2/gnuarm~1/102021~1.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information
[cmake] collect2.exe: error: ld returned 1 exit status
[cmake] NMAKE : fatal error U1077: 'C:\PROGRA~2\GNUARM~1\102021~1.07\bin\AR19DD~1.EXE' : return code '0x1'
[cmake] Stop.
[cmake] NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\nmake.exe"' : return code '0x2'
[cmake] Stop.
[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
[cmake]
[cmake]
[cmake] CMake Warning (dev) in CMakeLists.txt:
[cmake] No cmake_minimum_required command is present. A line of code such as
[cmake] [{
"resource": "/C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake",
"owner": "cmake-configure-diags",
"severity": 8,
"message": "CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):The C compiler\n\n \"C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2021.07/bin/arm-none-eabi-gcc.exe\"\n\nis not able to compile a simple test program.\n\nIt fails with the following output:\n\n Change Dir: C:/Users/faith/CSU23021 Microprocessor Systems/build/CMakeFiles/CMakeScratch/TryCompile-6dlzjh\n \n Run Build Command(s):nmake -f Makefile /nologo cmTC_c113f\\fast && \t\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x86\\nmake.exe\" -f CMakeFiles\\cmTC_c113f.dir\\build.make /nologo -L CMakeFiles\\cmTC_c113f.dir\\build\n Building C object CMakeFiles/cmTC_c113f.dir/testCCompiler.c.obj\n \tC:\\PROGRA~2\\GNUARM~1\\102021~1.07\\bin\\AR19DD~1.EXE -o CMakeFiles\\cmTC_c113f.dir\\testCCompiler.c.obj -c \"C:\\Users\\faith\\CSU23021 Microprocessor Systems\\build\\CMakeFiles\\CMakeScratch\\TryCompile-6dlzjh\\testCCompiler.c\"\n-- Configuring incomplete, errors occurred!\nSee also \"C:/Users/faith/CSU23021 Microprocessor Systems/build/CMakeFiles/CMakeOutput.log\".\nSee also \"C:/Users/faith/CSU23021 Microprocessor Systems/build/CMakeFiles/CMakeError.log\".\n Linking C executable cmTC_c113f.exe\n \t\"C:\\Program Files\\CMake\\bin\\cmake.exe\" -E rm -f CMakeFiles\\cmTC_c113f.dir/objects.a\n \tC:\\PROGRA~2\\GNUARM~1\\102021~1.07\\bin\\ARM-NO~2.EXE qc CMakeFiles\\cmTC_c113f.dir/objects.a #CMakeFiles\\cmTC_c113f.dir\\objects1\n \tC:\\PROGRA~2\\GNUARM~1\\102021~1.07\\bin\\AR19DD~1.EXE -Wl,--whole-archive CMakeFiles\\cmTC_c113f.dir/objects.a -Wl,--no-whole-archive -o cmTC_c113f.exe -Wl,--out-implib,libcmTC_c113f.dll.a -Wl,--major-image-version,0,--minor-image-version,0 #CMakeFiles\\cmTC_c113f.dir\\linkLibs.rsp\n c:/progra~2/gnuarm~1/102021~1.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version'\n c:/progra~2/gnuarm~1/102021~1.07/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information\n collect2.exe: error: ld returned 1 exit status\n NMAKE : fatal error U1077: 'C:\\PROGRA~2\\GNUARM~1\\102021~1.07\\bin\\AR19DD~1.EXE' : return code '0x1'\n Stop.\n NMAKE : fatal error U1077: '\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x86\\nmake.exe\"' : return code '0x2'\n Stop.\n \n \n\n\n\nCMake will not be able to correctly generate this project.",
"source": "CMake (message)",
"startLineNumber": 70,
"startColumn": 1,
"endLineNumber": 70,
"endColumn": 10000
}]
This is in my problems window on vscode:
[cmake] cmake_minimum_required(VERSION 3.25)
[cmake]
[cmake] should be added at the top of the file. The version specified may be lower
[cmake] if you wish to support older CMake versions for this project. For more
[cmake] information run "cmake --help-policy CMP0000".
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.07\bin\arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.07\bin\arm-none-eabi-g++.exe" "-SC:/Users/faith/CSU23021 Microprocessor Systems/pico-apps/assignments/assign01" "-Bc:/Users/faith/CSU23021 Microprocessor Systems/build" -G "NMake Makefiles" exited with code: 1
I am new to using Pi Pico and I am just learning it in a college module. Please let me know if you need more info :)
I tried to uninstall CMake and install it again following the tutorial but this did not work
Related
Using windows 10, I am trying to build example code for a W5100S-EVB-Pico.
I started in https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf section 9.2 which sets you up to build on windows. I was able to build the examples files there using visual studio code.
Now I want to use the Wiznet. Starting in https://github.com/Wiznet/RP2040-HAT-C I follow directions in the file getting_started.md I then go to vs code, and follow the pattern from 9.2. I open the folder ...\RP2040-HAT-C\examples\http\server select the appropriate compiler, and click build. I get an error which leads me to add the line
cmake_minimum_required(VERSION 3.25)
to CMakeLists.txt Build now results in the following:
[variant] Loaded new set of variants
[kit] Successfully loaded 5 kits from C:\Users\rw\AppData\Local\CMakeTools\cmake-tools-kits.json
[proc] Executing command: "D:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\12.2 rel1\bin\arm-none-eabi-gcc.exe" -v
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -Sd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server -Bd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build -G "NMake Makefiles"
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" -Sd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server -Bd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build -G "NMake Makefiles" exited with code: 1 and signal: null
[main] Configuring folder: server
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=D:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\12.2 rel1\bin\arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=D:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\12.2 rel1\bin\arm-none-eabi-g++.exe" -Sd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server -Bd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build -G "NMake Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Warning (dev) in CMakeLists.txt:
[cmake] No project() command is present. The top-level CMakeLists.txt file must
[cmake] contain a literal, direct call to the project() command. Add a line of
[cmake] code such as
[cmake]
[cmake] project(ProjectName)
[cmake]
[cmake] near the top of the file, but after cmake_minimum_required().
[cmake]
[cmake] CMake is pretending there is a "project(Project)" command on the first
[cmake] line.
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- The C compiler identification is GNU 12.2.1
[cmake] -- The CXX compiler identification is GNU 12.2.1
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Check for working C compiler: D:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/12.2 rel1/bin/arm-none-eabi-gcc.exe
[cmake] -- Check for working C compiler: D:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/12.2 rel1/bin/arm-none-eabi-gcc.exe - broken
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
[cmake] The C compiler
[cmake]
[cmake] "D:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/12.2 rel1/bin/arm-none-eabi-gcc.exe"
[cmake]
[cmake] is not able to compile a simple test program.
[cmake]
[cmake] It fails with the following output:
[cmake]
[cmake] Change Dir: D:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build/CMakeFiles/CMakeScratch/TryCompile-2zbfaa
[cmake]
[cmake] Run Build Command(s):nmake -f Makefile /nologo cmTC_d4dce\fast && "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\nmake.exe" -f CMakeFiles\cmTC_d4dce.dir\build.make /nologo -L CMakeFiles\cmTC_d4dce.dir\build
[cmake] Building C object CMakeFiles/cmTC_d4dce.dir/testCCompiler.c.obj
[cmake] "D:\Program Files (x86)\ARMGNU~1\12DBAB~1.2RE\bin\AR19DD~1.EXE" -o CMakeFiles\cmTC_d4dce.dir\testCCompiler.c.obj -c D:\cygwin\home\rw\holden\RP2040-HAT-C\examples\http\server\build\CMakeFiles\CMakeScratch\TryCompile-2zbfaa\testCCompiler.c
[cmake] Linking C executable cmTC_d4dce.exe
[cmake] "C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_d4dce.dir/objects.a
[cmake] "D:\Program Files (x86)\ARMGNU~1\12DBAB~1.2RE\bin\ARM-NO~2.EXE" qc CMakeFiles\cmTC_d4dce.dir/objects.a #CMakeFiles\cmTC_d4dce.dir\objects1
[cmake] "D:\Program Files (x86)\ARMGNU~1\12DBAB~1.2RE\bin\AR19DD~1.EXE" -Wl,--whole-archive CMakeFiles\cmTC_d4dce.dir/objects.a -Wl,--no-whole-archive -o cmTC_d4dce.exe -Wl,--out-implib,libcmTC_d4dce.dll.a -Wl,--major-image-version,0,--minor-image-version,0 #CMakeFiles\cmTC_d4dce.dir\linkLibs.rsp
[cmake] d:/program files (x86)/armgnu~1/12dbab~1.2re/bin/../lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version'
[cmake] d:/program files (x86)/armgnu~1/12dbab~1.2re/bin/../lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information
[cmake] collect2.exe: error: ld returned 1 exit status
[cmake] NMAKE : fatal error U1077: '"D:\Program Files (x86)\ARMGNU~1\12DBAB~1.2RE\bin\AR19DD~1.EXE"' : return code '0x1'
[cmake] Stop.
[cmake] NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\nmake.exe"' : return code '0x2'
[cmake] Stop.
[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
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "D:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "D:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build/CMakeFiles/CMakeError.log".
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=D:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\12.2 rel1\bin\arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=D:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\12.2 rel1\bin\arm-none-eabi-g++.exe" -Sd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server -Bd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build -G "NMake Makefiles" exited with code: 1 and signal: null
Some googling also led me to add the line
set(CMAKE_SYSTEM_NAME Generic)
to CMakeLists.txt, which now looks like
set(TARGET_NAME w5x00_http_server)
cmake_minimum_required(VERSION 3.25)
set(CMAKE_SYSTEM_NAME Generic)
add_executable(${TARGET_NAME}
${TARGET_NAME}.c
)
target_link_libraries(${TARGET_NAME} PRIVATE
pico_stdlib
hardware_spi
hardware_dma
ETHERNET_FILES
IOLIBRARY_FILES
HTTPSERVER_FILES
)
pico_enable_stdio_usb(${TARGET_NAME} 1)
pico_enable_stdio_uart(${TARGET_NAME} 0)
pico_add_extra_outputs(${TARGET_NAME})
I tried to fix the broken compiler error, which made things worse, and returning CMakeLists.txt to its former state did not get back to what is shown above. Is there some kind of 'clean' function I can do?
EDIT2: Tsyvarev made a very good point in the discussion under this answer. Because your CMakeLists.txt is missing a project(...) line it most likely gets implicitly called by CMake on the first line. Specific variables such as CMAKE_CXX_COMPILER or for example CMAKE_SYSTEM_NAME require to be set before the project() line. It is worth trying to update the CMakeLists.txt accordingly. However the first EDIT still holds place (which was also Tsyvarevs finding). You are most likely trying to build from an insufficient CMakeLists.txt
EDIT: I didn't notice what Tsyvarev mentioned in the comments, after looking at the appropriate CMakeLists.txt I have to agree with him. You are definitely also missing some targets and you've probably didn't give us the whole (new) error message. The missing targets here are (for example):
ETHERNET_FILES
IOLIBRARY_FILES
HTTPSERVER_FILES
You will most likely encounter errors regarding this as well. However the original error is truly tied to the set(CMAKE_SYSTEM_NAME Generic).
Original post:
A missing cmake_minimum_required() should just throw a warning not an error IIRC.
The only clean function that exists in CMake is rm [path-to-build-directory]. When you issue the cmake -S. -Bbuild command (or similar) you create a build folder where CMake generates the file needed to compile the project.
As to your issue. The set(CMAKE_SYSTEM_NAME Generic) should be added to the toolchain file or at the very least be the first variable set in your CMakeLists.txt. I believe (and this is a wild guess) that it should be before the cmake_minimum_required() this is the same for variables like CMAKE_CXX_COMPILER etc.
What I would recommend is:
Move the set(CMAKE_SYSTEM_NAME Generic) to the top of the CMakeLists.txt file
Remove the build folder.
Run cmake and build it again.
If the above won't help then I need you to clarify for me this:
By "I went back to VSCode" you mean you opened it up via the Developer prompt like the book you linked suggested.
What commands do you pass to run cmake/build it, i.e. what happens if you run from the Developer powershell/command prompt: cmake -S. -BbuildForStackOverflow -DCMAKE_SYSTEM_NAME=Generic and then build it from these generated files?
My mistake was opening the 'server' folder and assuming that everything was there. I never could figure out where the 'toolchain file' was. The solution is to open the folder RP2040-HAT-C in VS code first and select the appropriate compiler. VS code then does the initial cmake with the .txt file in that directory. Now, on the status line in VS code, I can click 'all' next to build, select my desired target (server) and build. Success!
Thanks to everyone who helped me with this.
I am a student in University.
I currently do not have access to the wonderful Ubuntu machines my University normally provides for CS students. As such, I've had to set up a C/C++ coding environment on my Windows 10 laptop. After much trial and error, I was able to set up the following configuration:
IDE: Visual Studio Code (with C/C++ extension)
Compiler: MinGW (GCC)
Build System: CMake
Everything was working fine until about two hours ago. At some point, the compiler CMake was using to compile my code switched over to MSVC instead of GCC which I had originally set it to. I ran the CMake configuration command from the Visual Studio Code command palette and set the Compiler back to GCC. Now I am getting all sorts of CMake errors when I try to run the CMake configuration command. If I try and create a new Hello World project with a very basic CMakeLists.txt file, I get the same error messages.
Here are the errors:
[main] Configuring folder: Test
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\MinGW\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\MinGW\bin\g++.exe -Hc:/Users/jwhen/Desktop/Test -Bc:/Users/jwhen/Desktop/Test/build -G "MinGW Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:677 (file):
[cmake] file STRINGS file
[cmake] "C:/Users/jwhen/Desktop/Test/build/CMakeFiles/3.17.0/CompilerIdC/a.exe"
[cmake] cannot be read.
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:38 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCCompiler.cmake:116 (CMAKE_DETERMINE_COMPILER_ID)
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:761 (file):
[cmake] file failed to open for reading (Permission denied):
[cmake]
[cmake] C:/Users/jwhen/Desktop/Test/build/CMakeFiles/3.17.0/CompilerIdC/a.exe
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:38 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCCompiler.cmake:116 (CMAKE_DETERMINE_COMPILER_ID)
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:764 (string):
[cmake] string begin index: 1 is out of range 0 - 0
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:38 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCCompiler.cmake:116 (CMAKE_DETERMINE_COMPILER_ID)
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:772 (math):
[cmake] math cannot parse the expression: " * 16 + ": syntax error, unexpected
[cmake] exp_TIMES (2).
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:38 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCCompiler.cmake:116 (CMAKE_DETERMINE_COMPILER_ID)
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:774 (file):
[cmake] file failed to open for reading (Permission denied):
[cmake]
[cmake] C:/Users/jwhen/Desktop/Test/build/CMakeFiles/3.17.0/CompilerIdC/a.exe
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:38 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCCompiler.cmake:116 (CMAKE_DETERMINE_COMPILER_ID)
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:815 (file):
[cmake] file failed to open for reading (Permission denied):
[cmake]
[cmake] C:/Users/jwhen/Desktop/Test/build/CMakeFiles/3.17.0/CompilerIdC/a.exe
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:38 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCCompiler.cmake:116 (CMAKE_DETERMINE_COMPILER_ID)
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] -- The C compiler identification is GNU 8.2.0
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:677 (file):
[cmake] file STRINGS file
[cmake] "C:/Users/jwhen/Desktop/Test/build/CMakeFiles/3.17.0/CompilerIdCXX/a.exe"
[cmake] cannot be read.
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:38 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCXXCompiler.cmake:111 (CMAKE_DETERMINE_COMPILER_ID)
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:761 (file):
[cmake] file failed to open for reading (Permission denied):
[cmake]
[cmake] C:/Users/jwhen/Desktop/Test/build/CMakeFiles/3.17.0/CompilerIdCXX/a.exe
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:38 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCXXCompiler.cmake:111 (CMAKE_DETERMINE_COMPILER_ID)
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:764 (string):
[cmake] string begin index: 1 is out of range 0 - 0
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:38 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCXXCompiler.cmake:111 (CMAKE_DETERMINE_COMPILER_ID)
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:772 (math):
[cmake] math cannot parse the expression: " * 16 + ": syntax error, unexpected
[cmake] exp_TIMES (2).
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:38 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCXXCompiler.cmake:111 (CMAKE_DETERMINE_COMPILER_ID)
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:774 (file):
[cmake] file failed to open for reading (Permission denied):
[cmake]
[cmake] C:/Users/jwhen/Desktop/Test/build/CMakeFiles/3.17.0/CompilerIdCXX/a.exe
[cmake] Call Stack (most recent call first):
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCompilerId.cmake:38 (CMAKE_DETERMINE_COMPILER_ID_CHECK)
[cmake] C:/Program Files/CMake/share/cmake-3.17/Modules/CMakeDetermineCXXCompiler.cmake:111 (CMAKE_DETERMINE_COMPILER_ID)
[cmake] CMakeLists.txt:3 (project)
[cmake]
[cmake]
[cmake] -- The CXX compiler identification is GNU 8.2.0
[cmake] -- Check for working C compiler: C:/MinGW/bin/gcc.exe
[cmake] -- Check for working C compiler: C:/MinGW/bin/gcc.exe - works
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Check for working CXX compiler: C:/MinGW/bin/g++.exe
[cmake] -- Check for working CXX compiler: C:/MinGW/bin/g++.exe - works
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - failed
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "C:/Users/jwhen/Desktop/Test/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "C:/Users/jwhen/Desktop/Test/build/CMakeFiles/CMakeError.log".
The only thing I can think of is that around the time the first crash occurred, I noticed Norton being particularly active and popping up whenever I tried to run a CMake command. Could Norton somehow be blocking me?
Edit
It is almost certainly Norton. The configuration works fine if I try and run it while Norton is running a full system scan. If I pause the scan, the configuration fails. If I resume, it works fine. How can I prevent Norton from blocking access to certain files?
I'm failing to build the simple Hello World C++ CMake Project in Eclipse with Yocto plugin. Yocto's version is "thud".
The local.conf have the line:
TOOLCHAIN_HOST_TASK_append += " nativesdk-cmake"
I've build the sdk
bitbake myBoard -c populate_sdk
I've installed the sdk, sourced the enviroment setup, launched eclipse from the same terminal and configured the yocto plugin.
The enviroment script have the following variable:
export SDKTARGETSYSROOT=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi
export CC="arm-fslc-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=$SDKTARGETSYSROOT"
export CXX="arm-fslc-linux-gnueabi-g++ -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=$SDKTARGETSYSROOT"
export CPP="arm-fslc-linux-gnueabi-gcc -E -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=$SDKTARGETSYSROOT"
When I try to build I have the following output (even sourcing the sdk's enviroment setup and then cmake from command line):
$ cmake ..
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: /yocto/sdk/myBoard/sysroots/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi/arm-fslc-linux-gnueabi-gcc
-- Check for working C compiler: /yocto/sdk/myBoard/sysroots/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi/arm-fslc-linux-gnueabi-gcc -- broken
CMake Error at /yocto/sdk/myBoard/sysroots/x86_64-fslcsdk-linux/usr/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"/yocto/sdk/myBoard/sysroots/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi/arm-fslc-linux-gnueabi-gcc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /yocto/eclipse-ws/prova/Debug/CMakeFiles/CMakeTmp
Run Build Command:"/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/bin/make" "cmTC_4df0b/fast"
/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/bin/make: 1: /yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/bin/make: Syntax error: word unexpected (expecting ")")
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:4 (PROJECT)
-- Configuring incomplete, errors occurred!
See also "/yocto/eclipse-ws/prova/Debug/CMakeFiles/CMakeOutput.log".
See also "/yocto/eclipse-ws/prova/Debug/CMakeFiles/CMakeError.log".
Someone see something wrong or missing that is causing the error?
Thank you in advance for any help
Update
The CMakeOutput.log show:
The system is: Linux - 4.15.0-47-generic - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /yocto/sdk/myBoard/sysroots/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi/arm-fslc-linux-gnueabi-gcc
Build flags: ;;;--sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi;;-march=armv7-a;-mthumb;-mfpu=neon;-mfloat-abi=hard;
Id flags:
The output was:
0
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"
The C compiler identification is GNU, found in "/yocto/eclipse-ws/prova/Debug/CMakeFiles/3.12.2/CompilerIdC/a.out"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /yocto/sdk/myBoard/sysroots/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi/arm-fslc-linux-gnueabi-g++
Build flags: ;;;--sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi;;-march=armv7-a;-mthumb;-mfpu=neon;-mfloat-abi=hard;;-fpermissive
Id flags:
The output was:
0
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"
The CXX compiler identification is GNU, found in "/yocto/eclipse-ws/prova/Debug/CMakeFiles/3.12.2/CompilerIdCXX/a.out"
Update 2
If I remove everything from the Debug folder and run cmake from command line I have a success and I can build even in Eclipse. If I change something in CMakeLists.txt then the error show up again.
I see that Debug/CMakeFiles/3.12.2/CMakeSystem.cmake is different when it is generated by eclipse or by command line:
Eclipse)
set(CMAKE_HOST_SYSTEM "Linux-4.15.0-47-generic")
set(CMAKE_HOST_SYSTEM_NAME "Linux")
set(CMAKE_HOST_SYSTEM_VERSION "4.15.0-47-generic")
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
include("/yocto/eclipse-ws/prova/toolchain.cmake")
set(CMAKE_SYSTEM "Linux-4.15.0-47-generic")
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_VERSION "4.15.0-47-generic")
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(CMAKE_CROSSCOMPILING "FALSE")
set(CMAKE_SYSTEM_LOADED 1)
Command Line)
set(CMAKE_HOST_SYSTEM "Linux-4.15.0-47-generic")
set(CMAKE_HOST_SYSTEM_NAME "Linux")
set(CMAKE_HOST_SYSTEM_VERSION "4.15.0-47-generic")
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
include("/yocto/sdk/aw70pc_am8000/sysroots/x86_64-fslcsdk-linux/usr/share/cmake/OEToolchainConfig.cmake")
set(CMAKE_SYSTEM "Linux")
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_VERSION "")
set(CMAKE_SYSTEM_PROCESSOR "armv7at2hf-neon-fslc")
set(CMAKE_CROSSCOMPILING "TRUE")
set(CMAKE_SYSTEM_LOADED 1)
From what I understand the eclipse plugin is generating a configuration that use the arm toolchain to compile a test program, not crosscompiling, and obviously it fail. Cmake from command line instead generate it the right way but it's overwritten by the first change in eclipse.
Here's the printenv as requested by danlor
ARCH=arm
CONFIG_SITE=/yocto/sdk/myBoard/site-config-armv7at2hf-neon-fslc-linux-gnueabi
SDKTARGETSYSROOT=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi
CFLAGS= -O2 -pipe -g -feliminate-unused-debug-types
KCFLAGS=--sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi
OECORE_ACLOCAL_OPTS=-I /yocto/sdk/myBoard/sysroots/x86_64-fslcsdk-linux/usr/share/aclocal
CC=arm-fslc-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi
OECORE_DISTRO_VERSION=2.6
OECORE_SDK_VERSION=2.6.1
PKG_CONFIG_SYSROOT_DIR=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi
CXXFLAGS= -O2 -pipe -g -feliminate-unused-debug-types
STRIP=arm-fslc-linux-gnueabi-strip
OBJCOPY=arm-fslc-linux-gnueabi-objcopy
CONFIGURE_FLAGS=--target=arm-fslc-linux-gnueabi --host=arm-fslc-linux-gnueabi --build=x86_64-linux --with-libtool-sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi
OECORE_NATIVE_SYSROOT=/yocto/sdk/myBoard/sysroots/x86_64-fslcsdk-linux
RANLIB=arm-fslc-linux-gnueabi-ranlib
OBJDUMP=arm-fslc-linux-gnueabi-objdump
AS=arm-fslc-linux-gnueabi-as
AR=arm-fslc-linux-gnueabi-ar
TARGET_PREFIX=arm-fslc-linux-gnueabi-
NM=arm-fslc-linux-gnueabi-nm
CXX=arm-fslc-linux-gnueabi-g++ -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi
OECORE_TARGET_OS=linux-gnueabi
OECORE_TARGET_ARCH=arm
OECORE_TARGET_SYSROOT=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi
CROSS_COMPILE=arm-fslc-linux-gnueabi-
OE_CMAKE_TOOLCHAIN_FILE=/yocto/sdk/myBoard/sysroots/x86_64-fslcsdk-linux/usr/share/cmake/OEToolchainConfig.cmake
CPPFLAGS=
LDFLAGS=-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX=
OECORE_BASELIB=lib
PKG_CONFIG_PATH=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/lib/pkgconfig:/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/share/pkgconfig
CPP=arm-fslc-linux-gnueabi-gcc -E -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi
LD=arm-fslc-linux-gnueabi-ld --sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi
toolchain.cmake
# CMake system name must be something like "Linux".
# This is important for cross-compiling.
set(CMAKE_SYSTEM_PROCESSOR )
set(CMAKE_C_COMPILER arm-fslc-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER arm-fslc-linux-gnueabi-g++)
set(CMAKE_C_FLAGS " --sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard " CACHE STRING "CFLAGS")
set(CMAKE_CXX_FLAGS " --sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -fpermissive" CACHE STRING "CXXFLAGS")
set(CMAKE_C_FLAGS_RELEASE " --sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -DNDEBUG" CACHE STRING "CFLAGS for release")
set(CMAKE_CXX_FLAGS_RELEASE " --sysroot=/yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -DNDEBUG" CACHE STRING "CXXFLAGS for release")
set(CMAKE_C_LINK_FLAGS "" CACHE STRING "LDFLAGS")
set(CMAKE_CXX_LINK_FLAGS "" CACHE STRING "LDFLAGS")
# only search in the paths provided so cmake doesnt pick
# up libraries and tools from the native build machine
set(CMAKE_FIND_ROOT_PATH /yocto/sdk/myBoard/sysroots/x86_64-fslcsdk-linux /yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi )
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# Use qt.conf settings
set(ENV{QT_CONF_PATH} qt.conf)
# We need to set the rpath to the correct directory as cmake does not provide any
# directory as rpath by default
set(CMAKE_INSTALL_RPATH )
# Use native cmake modules
set(CMAKE_MODULE_PATH /cmake/Modules/)
# add for non /usr/lib libdir, e.g. /usr/lib64
set(CMAKE_LIBRARY_PATH ${libdir} ${base_libdir})
Workaround
I've found a way out
Adding the following 2 lines in CMakeLists.txt will tell cmake that the compiler works and to not test it
SET (CMAKE_C_COMPILER_WORKS 1)
SET (CMAKE_CXX_COMPILER_WORKS 1)
Now I can build successfully my own program and it works like a charm.
It means that Eclipse can crosscompile my program but when checking the system it build the test program in a different way.
It seems that you're trying to use the cross-compiled make tool (the one that is compiled for your TARGET, i.e. /yocto/sdk/myBoard/sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/bin/make) instead of the HOST make tool (/yocto/sdk/myBoard/sysroots/x86_64-fslcsdk-linux/usr/bin/make). Change it and try again :)
I followed the steps of GENIVI guide.
Building wayland-ivi-extension:
$ git clone https://github.com/GENIVI/wayland-ivi-extension.git
$ mkdir build-wayland-ivi-extension
$ cd build-wayland-ivi-extension
$ cmake ./ -DBUILD_ILM_API_TESTS=1 ../wayland-ivi-extension
$ make
$ make install
I got the error when I executed:
cmake ./ -DBUILD_ILM_API_TESTS=1 ../wayland-ivi-extension
Error logļ¼
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'wayland-client>=1.13.0'
CMake Error at /usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:367 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:532 (_pkg_check_modules_internal)
protocol/CMakeLists.txt:25 (pkg_check_modules)
-- Configuring incomplete, errors occurred!
See also "/home/nlin/Wayland/build-wayland-ivi-extension/CMakeFiles/CMakeOutput.log".
some installed packages are required to compile Wayland-ivi-extension
Pre-requisite:
- Weston
- CMake required (version 2.6 or higher)
- Open GLES and EGL for example applications
- Gtest for the test suite
sudo apt-get install pkg-config
sudo apt-get install libwayland-dev
and then try to run cmake command. If there is any error feel free to contact.
I'm working on Solaris 11.3 with Sun Studio 12.5. When I attempt to configure with Cmake out-of-tree, Cmake finishes with configuration errors and does not produce the makefiles. In-tree may be broken, too. But our procedures say to build out-of-tree, so that;' what I do.
I have nearly no Cmake experience. Others contributed the the CMake files, and I struggle with tasks related to them. I'm not sure if I am doing something wrong, if our Cmake files are broken, or if Cmake is not well tested under Solaris.
What is going on with CMake, and how do I fix it?
Here are the links to the Cmake files. I can copy/paste them, but it just takes up a bunch of space. The files are hosted on GitHub so they should always be available.
CMakefileList.txt
cryptopp-config.cmake
Here is Solaris' Cmake version, prior to me installing 3.6.2:
$ cmake --version
cmake version 2.8.6
Below is from Solaris Cmake version 2.8.6.
cryptopp-build$ export CXX=/opt/developerstudio12.5/bin/CC
cryptopp-build$ export CXXFLAGS="-DNDEBUG -g2 -O2 -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__AES__ -D__PCLMUL__ -D__RDRND__ -D__RDSEED__ -D__AVX__ -D__AVX2__ -D__BMI__ -D__BMI2__ -D__ADX__ -xarch=avx2_i"
cryptopp-build$ cmake ../cryptopp
-- The CXX compiler identification is unknown
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:45 (MESSAGE):
The C++ compiler "/bin/c++" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /export/home/test/cryptopp-build/CMakeFiles/CMakeTmp
Run Build Command:/bin/gmake "cmTryCompileExec/fast"
/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
CMakeFiles/cmTryCompileExec.dir/build
gmake[1]: Entering directory
`/export/home/test/cryptopp-build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/export/home/test/cryptopp-build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o
/bin/c++ -DNDEBUG -g2 -O2 -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__
-D__SSE4_2__ -D__AES__ -D__PCLMUL__ -D__RDRND__ -D__RDSEED__ -D__AVX__
-D__AVX2__ -D__BMI__ -D__BMI2__ -D__ADX__ -xarch=avx2_i -o
CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o -c
/export/home/test/cryptopp-build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
c++: error: language arch=avx2_i not recognized
c++: error: language arch=avx2_i not recognized
gmake[1]: Leaving directory
`/export/home/test/cryptopp-build/CMakeFiles/CMakeTmp'
gmake[1]: *** [CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o] Error
1
gmake: *** [cmTryCompileExec/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:9 (project)
-- Configuring incomplete, errors occurred!
And:
$ /opt/developerstudio12.5/bin/CC -V
CC: Studio 12.5 Sun C++ 5.14 SunOS_i386 2016/05/31
I built Cmake 3.6.2 from sources and installed in /usr/local to attack the CXX compiler identification is unknown issue, but it appears to be having some troubles. As I said earlier, I'm not a Cmake expert (and I'm not sure how one can mess up a make && sudo make install).
cryptopp-build$ cmake ../cryptopp
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.
Clearing the cache as suggested by #AndrewHenle results in:
# The project GNUmakefile clears all Cmake artifacts because Cmake cannot seem to do it on its own
$ cd cryptopp
$ git status -s
$
$ cd ..
$ rm -rf cryptopp-build
$ mkdir cryptopp-build
$ cd cryptopp-build
# Using 3.6.2 now
$ cmake ../cryptopp
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.
So there appeared to be two problems. First was the down level Sun supplied Cmake. There's nothing genius about diagnosing it as "too old".
The second issue was more interesting. It appears the CMake Error: Could not find CMAKE_ROOT !!! was cause by sudo make install Once I switched to sudo gmake install the issue went away.
Here are the bug reports on the issue:
Cmake Issue 16302: Cmake fails to identify Sun Studio 12.5 compiler
Cmake Issue 16303: Cmake fails to produce a working installation on Solaris 11.3