nemuibanila / zig-pico-cmake

Build zig projects that use the Raspberry PI Pico SDK
MIT License
7 stars 0 forks source link

Errors during the zig build on Windows #1

Open mstrens opened 9 months ago

mstrens commented 9 months ago

Hello, I would like to use zig with pico sdk. I try to reuse your code but I do not succeed.

I expect that your build.zig has been written for linux because it uses a "find" command that is not supported by windows.

I tried to change the file build.zig harcoding all the directories having a name with "include" and adding them in lib.addIncludePath() instructions. Still it does not work. I get many errors and I do not know how to solve them.

Could you please look at the mistake(s) I make.

I put in attachement my version of your code. There are several small changes compared to your code because I tried a solution by myself (use a pico board instead of pico-W, copy of "pico_sdk_import.cmake" in the folder, ...) Note : the file "Errors with zig build.txt" contains the errors that I get currently.

Thanks in advance. zig-pico-cmake-main.zip

nemuibanila commented 9 months ago

Hello, I dont have any way to verify the functionality on windows. Additionally, you shouldnt need to copy the cmake file into the build dir.

My code uses "find" to find the headers required to link the pico application in zig with the sdk, you could try installing find on windows or replacing it with an equivalent command. It additionally uses the standard library headers for the arm-none-eabi cross-compiler from "/usr/arm-none-eabi/include" -> I am not sure how this is set up with the sdk on windows.

I think its likely those standard library headers missing. Another option is to use WSL or a Linux VM.

mstrens commented 9 months ago

Thanks for your suggestions. I have no experience with virtual machine and linux but I tried. It took me some time to install VirtualBox , Debian, pico-sdk , and zig. Finally I was able to build your project. Thanks again.

nemuibanila commented 9 months ago

I'm happy it works now! I was about to get to reply to this, but I see you already made it work yourself. I'll try to look into making it also work on windows when I have some spare time.

mstrens commented 9 months ago

I still tried to let it works for windows. I hardcoded build.zig with all included directories found in the command displayed in linux.

It seems I made some progress because the error I get is now on step 3 (instead of 2) and and is related to the "cmake".

I add here an updated version of my configuration and of the file containing the error I get (errors with zig build.txt).

This can perhaps help you.

On my side I do not know what I can further try (on windows) zig-pico-cmake-main.zip

mstrens commented 9 months ago

Please discard my previous post. I tried again starting from a new installation of sdk 1.5.1 The error I get is now at step 4 (running make).

The folder containing the project is now to big to upload here. Here a link to get it on google drive. https://drive.google.com/file/d/1HADaG2pvOU0-ywqW9J8ZSqlP5Yz6coje/view?usp=sharing

It contains also the file with the error generated at step 4

mstrens commented 9 months ago

FYI, I finally was able to get a good result (tested with a "pico" instead of a "pico-w") under windows. I made several changes and I do not know what really solved my issue:

mstrens commented 9 months ago

FYI, I was able to make a version that works on windows and where the "include" paths are not hardcoded. Fo windows, I also had to change some lines of code in order to use the function std.process.getEnvVarOwned() to find the SDK path. In attachment I join the version I made. pico_sdk5.zip

nemuibanila commented 6 months ago

Hi, I integrated your changes/idea. Hopefully it should work across platforms now.

Can you check if it works? Otherwise I'll ask a friend with a windows machine to test it.