Cmake error in px4

hey guys , I’m beginner in this community . i recently installed gazebo fortress in my ubuntu 22.04 ,using ros2 humble and now i faced a big issue :

– Checking for module ‘gstreamer-app-1.0’
– Found gstreamer-app-1.0, version 1.20.1
– Found Java: /usr/bin/java (found version “11.0.28”)
– ROMFS: ROMFS/px4fmu_common
Architecture: amd64
==> CPACK_INSTALL_PREFIX = @DEB_INSTALL_PREFIX@
– Configuring done
CMake Error at cmake/px4_add_library.cmake:42 (add_library):
Cannot find source file:

heatshrink/heatshrink_decoder.c

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
.hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
Call Stack (most recent call first):
src/lib/heatshrink/CMakeLists.txt:36 (px4_add_library)

CMake Error at cmake/px4_add_module.cmake:151 (add_library):
Cannot find source file:

devices/src/crc.cpp

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
.hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
Call Stack (most recent call first):
src/drivers/gps/CMakeLists.txt:36 (px4_add_module)

CMake Error at cmake/px4_add_library.cmake:42 (add_library):
No SOURCES given to target: heatshrink
Call Stack (most recent call first):
src/lib/heatshrink/CMakeLists.txt:36 (px4_add_library)

CMake Error at cmake/px4_add_module.cmake:151 (add_library):
No SOURCES given to target: drivers__gps
Call Stack (most recent call first):
src/drivers/gps/CMakeLists.txt:36 (px4_add_module)

CMake Generate step failed. Build files cannot be regenerated correctly.
Error: /home/mamad/PX4-Autopilot/build/px4_sitl_default is not a directory
make: *** [Makefile:227: px4_sitl] Error 1

i tried this command : mamad@mamadPC:~/Desktop$ ros2 launch px4_offboard offboard_velocity_control.launch.py
by a tutorial on YT , and it showed me the rviz simulation but not the gazebo sim (unlike the tutorial!) i have faced this error in downloading px4 but i ignored it . what to do now?

1 Like

Missing git submodules maybe?

I’m not sure .. i just followed the
GitHub - artastier/PX4_Swarm_Controller: The aim of this ROS2 package is to facilitate the implementation of a drone swarm controller through simulation on Gazebo. GitHub - artastier/PX4_Swarm_Controller: The aim of this ROS2 package is to facilitate the implementation of a drone swarm controller through simulation on Gazebo. instructions
And chatgpt and other Ai tools didn’t help me thou🥲

Well, try git submodule update --init --recursive within the PX4-Autopilot folder.

1 Like

thanks a lot . i could finally run this with vpn . otherwise i faced error 403 .. i tried other way

[quote=“JulianOes, post:4, topic:46712”]

On branch main
Your branch is behind ‘origin/main’ by 22 commits, and can be fast-forwarded.
(use “git pull” to update your local branch)

Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git restore …” to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: Tools/simulation/flightgear/flightgear_bridge (modified content)
modified: Tools/simulation/gazebo-classic/sitl_gazebo-classic (modified content)
modified: Tools/simulation/jmavsim/jMAVSim (modified content)
modified: platforms/nuttx/NuttX/apps (modified content)
modified: platforms/nuttx/NuttX/nuttx (modified content)
modified: src/drivers/actuators/vertiq_io/iq-module-communication-cpp (modified content)
modified: src/drivers/gps/devices (modified content)
modified: src/drivers/uavcan/libdronecan/dsdl (modified content)
modified: src/lib/crypto/monocypher (modified content)
modified: src/lib/events/libevents (modified content)
modified: src/lib/heatshrink/heatshrink (modified content)
modified: src/modules/mavlink/mavlink (modified content)
modified: src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client (modified content)

no changes added to commit (use “git add” and/or “git commit -a”)

Blockquote
i think my problem is somehow related to this part and again i couldn’t fix it It’s been days since i work on this error i should give up..whatever ,thanks a lot for your time spending at this :))

I think your error was caused by git. Maybe you can download PX4 code again, and delete the former code.
try the command

git clone https://github.com/PX4/PX4-Autopilot.git
git submodule update --init --recursive
cd ./PX4-Autopilot/Tools/setup
./ubuntu.sh --no-nuttx

I am a beginner and want to simulate px4 on gazebo classic with ROS2 humble on ubuntu 22, after I clone the px4 repository I run cmake then make but an error appears then I try to downgrade cmake and finally ros2 and gazebo become error, and I think this is not a good way, this is the error:

CMake Warning (dev) at CMakeLists.txt:54 (find_package): Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules are removed. Run "cmake --help-policy CMP0148" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it. CMake Error at external/OpticalFlow/CMakeLists.txt:34 (cmake_minimum_required): Compatibility with CMake < 3.5 has been removed from CMake. Update the VERSION argument <min> value. Or, use the <min>...<max> syntax to tell CMake that the project requires at least <min> but has been updated to work with policies introduced by <max> or earlier. Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.

This is not a cmake error, rather cmake is telling you there’s something missing in your environment, its not smart enough to actually know if its missing from your system, it just can’t find it with the context provided. You need to debug what’s going on based on the requirements for your system, if you installed the setup script in the repo you should be all set, unless there were conflicting libraries already present, which you would have to figure out yourself.

This also looks like a separate issue from OP’s you should create your own issue.