Uploading Firmware via WSL Fails

I’m trying to configure PX4 to accept ELRS RC input. As a result, I’m trying to rebuild PX4 with those drivers and upload to my Cubepilot, but I’m getting errors.

So far, I’ve been able to run

./Tools/setup/ubuntu.sh
and
make ark_fmu-v6x_default boardconfig

to enable the ELRS driver. However, when I run

sudo make ark_fmu-v6x_default upload

I get the following output:

PX4-Autopilot$ sudo make
ark_fmu-v6x_default upload
[0/1140] git submodule src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client
[2/1140] Generating ../../../platforms/nuttx/NuttX/nuttx/.config
FAILED: ../../platforms/nuttx/NuttX/nuttx/.config
cd /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx && /usr/bin/cmake -E copy_if_different /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/build/ark_fmu-v6x_default/NuttX/nuttx/Make.defs /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/Make.defs && cat /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/boards/ark/fmu-v6x/nuttx-config/nsh/defconfig /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/build/ark_fmu-v6x_default/NuttX/extra_config_options > /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/.config && /usr/bin/cmake -E copy_if_different /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/boards/ark/fmu-v6x/nuttx-config/nsh/defconfig /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/defconfig && /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/tools/px4_nuttx_make_olddefconfig.sh > /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/build/ark_fmu-v6x_default/NuttX/nuttx_olddefconfig.log && /usr/bin/cmake -E copy_if_different /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/.config /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/build/ark_fmu-v6x_default/NuttX/nuttx/.config
/usr/bin/env: ‘bash\r’: No such file or directory
/usr/bin/env: ‘bash\r’: No such file or directory
/mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/tools/incdir: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/tools/incdir)
/mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/tools/incdir: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/tools/incdir)
/usr/bin/env: ‘bash\r’: No such file or directory
mv: cannot stat '.version.tmp': No such file or directory
/usr/bin/env: ‘bash\r’: No such file or directory
/usr/bin/env: ‘bash\r’: No such file or directory
/mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/tools/incdir: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/tools/incdir)
/mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/tools/incdir: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/platforms/nuttx/NuttX/nuttx/tools/incdir)
/usr/bin/env: ‘bash\r’: No such file or directory
mv: cannot stat '.version.tmp': No such file or directory
/usr/bin/env: ‘bash\r’: No such file or directory
make[2]: *** [tools/Unix.mk:390: clean_dirlinks] Error 127
make[1]: *** [tools/Unix.mk:605: olddefconfig] Error 2
[4/1140] Generating Mavlink uAvionix: sr...nk/message_definitions/v1.0/uAvionix.xm
FAILED: mavlink/uAvionix/uAvionix.h
cd /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/build/ark_fmu-v6x_default/src/modules/mavlink && /usr/bin/python3 /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/src/modules/mavlink/mavlink/pymavlink/tools/mavgen.py --lang C --wire-protocol 2.0 --output /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/build/ark_fmu-v6x_default/mavlink /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/uAvionix.xml > /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/build/ark_fmu-v6x_default/src/modules/mavlink/mavgen_uAvionix.log
Traceback (most recent call last):
  File "/mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/src/modules/mavlink/mavlink/pymavlink/tools/mavgen.py", line 16, in <module>
    from pymavlink.generator import mavgen
  File "/mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/src/modules/mavlink/mavlink/pymavlink/generator/mavgen.py", line 28, in <module>
    from future import standard_library
ModuleNotFoundError: No module named 'future'
ninja: build stopped: subcommand failed.
make: *** [Makefile:227: ark_fmu-v6x_default] Error 1

The last error about No module named 'future' is odd considering when I run pip install future, I get a Requirement already satisfied output message…

I’m using Ubuntu 20.04.6 LTS in WSL2 in Windows 11.

Am I doing something wrong? Also, why is getting ELRS to work with PX4 such a pain? With ELRS being fairly popular (as far as I can tell), why not have that driver already enabled in the standard firmware?

Hi. Did you try to run “make clean” before build again ?

I retried the upload after doing a make clean and got the following:

PX4-Autopilot$ sudo make ark_fmu-v6x_default upload
[sudo] password for <usr>:
[0/1] Re-running CMake...
-- PX4_GIT_TAG: v1.16.0-rc1-168-g66fe3aa2b3
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3")
-- PX4 config file: /mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/boards/ark/fmu-v6x/default.px4board
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'menuconfig'
CMake Error at cmake/kconfig.cmake:6 (message):
  kconfiglib is not installed or not in PATH

  please install using "pip3 install kconfiglib"

Call Stack (most recent call first):
  CMakeLists.txt:191 (include)


-- Configuring incomplete, errors occurred!
See also "/mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/build/ark_fmu-v6x_default/CMakeFiles/CMakeOutput.log".
See also "/mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/build/ark_fmu-v6x_default/CMakeFiles/CMakeError.log".
FAILED: build.ninja
/usr/bin/cmake -S/mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot -B/mnt/c/Users/<usr>/OneDrive/Desktop/PX4-Autopilot/build/ark_fmu-v6x_default
ninja: error: rebuilding 'build.ninja': subcommand failed
make: *** [Makefile:227: ark_fmu-v6x_default] Error 1

Hey @PowerBroker2 can you please run make distclean then try to build again.

After doing make distclean and then sudo make ark_fmu-v6x_default upload, I get the same error as before.

Did you setup the dev environment? BTW ark_fmu-v6x_default is the wrong target for a CubePilot board

You need to read what it says…

I did setup the dev environment. Which is the correct target? Is it ark_fmu-v5x_default?

I was trying to follow along with this tutorial: https://www.youtube.com/watch?v=XFHZMNQpqgs

Of course I read it…

I’ve already installed that library. This is one of the reasons I’m finding this PX4 build process so incredibly frustrating. Seriously though - why aren/t the ELRS/Crossfire drivers enabled by default???:

pip3 install kconfiglib
Requirement already satisfied: kconfiglib in /home/<usr>/.local/lib/python3.8/site-packages (14.1.0)

Tab autocomplete will show you the targets. For a Cube board you use a cubepilot target

jake@jake:~/code/jake/PX4-Autopilot$ make cubepilot_
cubepilot_cubeorange                 cubepilot_cubeorangeplus_bootloader  cubepilot_cubeyellow
cubepilot_cubeorange_bootloader      cubepilot_cubeorangeplus_console     cubepilot_cubeyellow_default
cubepilot_cubeorange_console         cubepilot_cubeorangeplus_default     cubepilot_io-v2
cubepilot_cubeorange_default         cubepilot_cubeorangeplus_test        cubepilot_io-v2_default
cubepilot_cubeorangeplus             cubepilot_cubeorange_test 

The docs describe it too

Most boards have the RC drivers included and enabled by default. You can check the .px4board for your target.

Please try to build the binaries first (without the upload part), then you can try with your original command. Also, it is considered a good idea that every time errors like this happen, you may need to run make distclean and git submodule update --init --recursive.

Btw, you might need to attach your USB device to WSL before attempting to upload PX4 to your board, have a quick check with ls /dev.

Check your target as @dakejahl is recommending.

Regards.