Visual studio code cmake causes error ld.exe: unrecognized option '--major-image-version' - visual-studio-code

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.

Related

CMake Error When Trying to Configure File for Pi Pico

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

CMake Configuration Error: various errors involving files failing to open when trying to configure

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?

wayland-ivi-extension build error on ubuntu16.04

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.

CMake fails to generate Makefiles with Sun Studio 12.5

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

How to fix linking errors with gfortran compiler?

I downloaded Eclipse and Cygwin for windows 7 64 bit. I wrote the next Fortran program:
program main
print*, 'Hello World'
end program main
and got the next error when I tried to build the program:
make all
Building target: examples
Invoking: GNU Fortran Linker
gfortran -o "examples" ./main.o
gfortran: fatal error: -fuse-linker-plugin, but cyglto_plugin.dll not found
compilation terminated.
makefile:29: recipe for target 'examples' failed
make: *** [examples] Error 1
I looked for the file cyglto_plugin.dll, and found it in the folder:
C:\cygwin64\lib\gcc\x86_64-pc-cygwin\4.9.3
I tried to add this folder to the PATH environment variable but still got the same error.
Searching the web I found out that the problem can be solved by installing as a dependency the library cyglto_plugin.dll, which is used for Link-Time-Optimization, and can be found in the package gcc-core. However, I have no idea how to do it, can someone instruct me please ?
Using the command prompt I disabled this library by typing:
$ gfortran main.f90 -fno-use-linker-plugin -o main
doing so I got a bunch of new errors:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lquadmath
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find crtend.o: No such file or directory
Do someone has an idea how to fix these errors ?