Unable to build in Visual Studio Code #5

Closed
opened 2021-01-23 11:42:55 -06:00 by Bazz-Man · 11 comments
Bazz-Man commented 2021-01-23 11:42:55 -06:00 (Migrated from github.com)

I followed the instructions in the PDF and successfully setup Windows to build from the command line. However when trying to build from VSC it reports the following error:

[main] Building folder: pico-examples
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/barry/Downloads/pico-examples/build --config Debug --target all -- -j 8
[build] ninja: error: FindFirstFileExA(c/:/users/barry/downloads/pico-sdk/src/rp2_common/boot_stage2): The filename, directory name, or volume label syntax is incorrect.
[build]
[build] Build finished with exit code 1

If I paste the same command line into a VS cmd box it reports the same issue. This also happens if I select build all or a specific code set e.g. blink

I followed the instructions in the PDF and successfully setup Windows to build from the command line. However when trying to build from VSC it reports the following error: [main] Building folder: pico-examples [build] Starting build [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/barry/Downloads/pico-examples/build --config Debug --target all -- -j 8 [build] ninja: error: FindFirstFileExA(c/:/users/barry/downloads/pico-sdk/src/rp2_common/boot_stage2): The filename, directory name, or volume label syntax is incorrect. [build] [build] Build finished with exit code 1 If I paste the same command line into a VS cmd box it reports the same issue. This also happens if I select build all or a specific code set e.g. blink
kilograham commented 2021-01-23 14:35:33 -06:00 (Migrated from github.com)

I think there is a problem with the ninja CMake generator and pico-examples, can you try setting "NMake Makefiles" as the preferred/default build generator in CMake plugin settings?

I think there is a problem with the ninja CMake generator and pico-examples, can you try setting "NMake Makefiles" as the preferred/default build generator in CMake plugin settings?
realjanek commented 2021-01-23 19:36:56 -06:00 (Migrated from github.com)

'nmake' is not recognized as an internal or external command,
operable program or batch file.

I follow the instructions in pdf running on Windows. All good until trying to run nmake.

D:\2021\RpiPico\pico-examples\build>cmake -G "NMake Makefiles" ..
Using PICO_SDK_PATH from environment ('....\pico-sdk')
Pico SDK is located at D:/2021/RpiPico/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
Defaulting PICO platform compiler to pico_arm_gcc since not specified.
-- Defaulting build type to 'Release' since not specified.
PICO compiler is pico_arm_gcc
PICO_GCC_TRIPLE defaulted to arm-none-eabi
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- The ASM compiler identification is GNU
-- Found assembler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2020-q4-major/bin/arm-none-eabi-gcc.exe
Defaulting PICO target board to pico since not specified.
Using board configuration from D:/2021/RpiPico/pico-sdk/src/boards/include/boards/pico.h
-- Found Python3: C:/Python38/python.exe (found version "3.8.7") found components: Interpreter
TinyUSB available at D:/2021/RpiPico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
ELF2UF2 will need to be built
PIOASM will need to be built
-- Configuring done
-- Generating done
-- Build files have been written to: D:/2021/RpiPico/pico-examples/build

D:\2021\RpiPico\pico-examples\build>nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.

'nmake' is not recognized as an internal or external command, operable program or batch file. I follow the instructions in pdf running on Windows. All good until trying to run nmake. D:\2021\RpiPico\pico-examples\build>cmake -G "NMake Makefiles" .. Using PICO_SDK_PATH from environment ('..\..\pico-sdk') Pico SDK is located at D:/2021/RpiPico/pico-sdk Defaulting PICO_PLATFORM to rp2040 since not specified. Defaulting PICO platform compiler to pico_arm_gcc since not specified. -- Defaulting build type to 'Release' since not specified. PICO compiler is pico_arm_gcc PICO_GCC_TRIPLE defaulted to arm-none-eabi -- The C compiler identification is GNU 10.2.1 -- The CXX compiler identification is GNU 10.2.1 -- The ASM compiler identification is GNU -- Found assembler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/10 2020-q4-major/bin/arm-none-eabi-gcc.exe Defaulting PICO target board to pico since not specified. Using board configuration from D:/2021/RpiPico/pico-sdk/src/boards/include/boards/pico.h -- Found Python3: C:/Python38/python.exe (found version "3.8.7") found components: Interpreter TinyUSB available at D:/2021/RpiPico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; adding USB support. -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) ELF2UF2 will need to be built PIOASM will need to be built -- Configuring done -- Generating done -- Build files have been written to: D:/2021/RpiPico/pico-examples/build D:\2021\RpiPico\pico-examples\build>nmake 'nmake' is not recognized as an internal or external command, operable program or batch file.
kilograham commented 2021-01-23 21:08:08 -06:00 (Migrated from github.com)

you need to run it from a visual studio developer command prompt (or whatever it is called)

you need to run it from a visual studio developer command prompt (or whatever it is called)
realjanek commented 2021-01-23 22:06:08 -06:00 (Migrated from github.com)

you need to run it from a visual studio developer command prompt (or whatever it is called)

Thanks a lot. It works. You save me a lot of time and headaches. I still have to figure out how to use VSCode. Is it possible to use J-Link for debugging on Windows?

> > > you need to run it from a visual studio developer command prompt (or whatever it is called) Thanks a lot. It works. You save me a lot of time and headaches. I still have to figure out how to use VSCode. Is it possible to use J-Link for debugging on Windows?
Bazz-Man commented 2021-01-24 06:18:11 -06:00 (Migrated from github.com)

I think there is a problem with the ninja CMake generator and pico-examples, can you try setting "NMake Makefiles" as the preferred/default build generator in CMake plugin settings?

Excellent, that fixed it, many thanks kilograham :). So for everyone else, you need to add the "NMake Makefiles" to the Settings tab of the extension under the entry labelled:
Cmake: Generator
The CMake generator to use

Should look like this
image

> I think there is a problem with the ninja CMake generator and pico-examples, can you try setting "NMake Makefiles" as the preferred/default build generator in CMake plugin settings? Excellent, that fixed it, many thanks kilograham :). So for everyone else, you need to add the "NMake Makefiles" to the Settings tab of the extension under the entry labelled: Cmake: Generator The CMake generator to use Should look like this ![image](https://user-images.githubusercontent.com/33786321/105629989-282db700-5e3e-11eb-91e5-f8d600295f32.png)
kilograham commented 2021-01-25 11:08:21 -06:00 (Migrated from github.com)

Also if you are using VS Code on something other than Windows you likely need to change this to "Unix Makefiles"

Also if you are using VS Code on something other than Windows you likely need to change this to "Unix Makefiles"
aallan commented 2021-01-26 07:07:04 -06:00 (Migrated from github.com)

I've now updated the documentation to reflect this, will be available in the next docs release expected today.

I've now updated the documentation to reflect this, will be available in the next docs release expected today.
vishnumaiea commented 2021-01-26 21:27:26 -06:00 (Migrated from github.com)

I've now updated the documentation to reflect this, will be available in the next docs release expected today.

You may also have to specify not to skip installing the Windows 10 SDK from VS build tool installation step. Because not installing the SDK will cause NMAKE to fail. Installing the Windows 10 SDK solved an error I encountered later.

> I've now updated the documentation to reflect this, will be available in the next docs release expected today. You may also have to specify **not to skip** installing the **Windows 10 SDK** from VS build tool installation step. Because not installing the SDK will cause NMAKE to fail. Installing the Windows 10 SDK solved an error I encountered later.
lurch commented 2021-03-29 12:25:47 -05:00 (Migrated from github.com)

Just for the sake of completeness (not that it really matters, because our instructions say to use nmake), but it turns out that the problem with ninja is that GCC outputs dependency-information in a slightly-incorrect format that ninja can't understand.
https://gitlab.kitware.com/cmake/cmake/-/issues/21997#note_929924

EDIT: ...which in turn has been fixed in the master version of ninja, https://github.com/ninja-build/ninja/pull/1774 but seems like it isn't yet included in a released-version of ninja.

Just for the sake of completeness (not that it really matters, because our instructions say to use `nmake`), but it turns out that the problem with `ninja` is that GCC outputs dependency-information in a slightly-incorrect format that `ninja` can't understand. https://gitlab.kitware.com/cmake/cmake/-/issues/21997#note_929924 EDIT: ...which in turn has been fixed in the `master` version of `ninja`, https://github.com/ninja-build/ninja/pull/1774 but seems like it isn't yet included in a released-version of ninja.
aallan commented 2021-03-30 04:08:29 -05:00 (Migrated from github.com)

I'll add a note to the Getting Started book to this effect.

I'll add a note to the Getting Started book to this effect.
eriklundh commented 2021-05-17 15:39:12 -05:00 (Migrated from github.com)

The fix for ninja-build/ninja#1774 are included in ninja release 1.10.1 and later

The fix for [ninja-build/ninja#1774](https://github.com/ninja-build/ninja/pull/1774) are included in ninja release 1.10.1 and later
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#5
No description provided.