raspberrypi / pico-setup

92 stars 42 forks source link

Build for picotool (within pico-setup script) seems to missing some steps, resulting in "Findpicotool" failing during project builds #42

Open dshadoff opened 4 weeks ago

dshadoff commented 4 weeks ago

Issue: Within the pico-setup script, there is a section (around line 100) where it clones and builds the picotool repository, then copies the executable into /usr/local/bin.

Apparent Cause: The above appears to be insufficient for the pico-sdk "Findpicotool" step, resulting in local rebuilds of the picotoool executable in EVERY project due to the pico-sdk "Findpicotool" step failing (despite it being in the path).

Fallout: This can also be seen described in issue pico-sdk#1818, and possibly #41 in this repository.

My solution: I was able to correct this on my own (Raspberry Pi 5) system by performing the following instructions, as described in the picotool repository's README.md:

  1. On Linux you can add udev rules in order to run picotool without sudo: sudo cp udev/99-picotool.rules /etc/udev/rules.d/

  2. Whilst the SDK can download picotool on its own per project, if you have multiple projects or build configurations, it is preferable to install a single copy of picotool locally.

    This can be done most simply with make install, using sudo if required; the SDK will use this installed version by default.

Note: Because of this item, I did a "sudo make install" after the initial build. This appears to have done additional operations beyond the simple "sudo cp" of the executable which is done by the pico-setup.sh script.

After these two steps, it's not complaining and forcing a remake each time.

I'm not sure if you are interested in fixing this, however (even though it is reported as an issue repeatedly), because the picotool repository seems to imply that there may be some situations where you may want a separate picotool for each project.

lurch commented 3 weeks ago

ping @will-v-pi

will-v-pi commented 3 weeks ago

Yeah, the copy is not correct anymore - https://github.com/raspberrypi/pico-setup/blob/b6029ad57b64fe19bc06dc1fbb5f9cd2c55b3116/pico_setup.sh#L116 should be replaced with

sudo make install

because the picotool repository seems to imply that there may be some situations where you may want a separate picotool for each project.

This was not the intention - could you clarify where we've implied that and we'll fix it? Generally you should always have a common picotool for all your projects, I can't think of any case where you'd want separate ones

dshadoff commented 3 weeks ago

because the picotool repository seems to imply that there may be some situations where you may want a separate picotool for each project.

This was not the intention - could you clarify where we've implied that and we'll fix it? Generally you should always have a common picotool for all your projects, I can't think of any case where you'd want separate ones

In the README.md file in the picotool repository, under the section "Usage by the Raspberry Pi Pico SDK", the section does state that common usage is preferred, but it seems that additional steps are necessary and only suggested. Perhaps this is the right approach, but should be more strongly worded (such as by specifying the "make install" step first).

Link here: https://github.com/raspberrypi/picotool/blob/master/README.md?plain=1#L76C1-L94C29

lurch commented 3 weeks ago

In the README.md file in the picotool repository, under the section "Usage by the Raspberry Pi Pico SDK"

Note that the wording there has already been tweaked slightly on the develop branch: https://github.com/raspberrypi/picotool/blob/develop/README.md

dshadoff commented 3 weeks ago

I see. In my case, the confusion was caused by this not being the default (since I assumed the whole purpose of pico-setup was to install with default behaviour). Once this is corrected, I'm happy (and probably quite a few issues across more than one repository can be closed too.)