Unable to find cmake package when building ROS2 workspace

We are working on a university project to build a px4 quadcopter controlled by a companion Ubuntu computer with ROS. We setup the computer following this tutorial: ROS 2 User Guide (PX4-ROS 2 Bridge) | PX4 User Guide, and stop at “$ source build_ros2_workspace.bash” when trying to build ROS2 workspace.

Once run this command in terminal, it will close after around 2 seconds. The error it reports within that 2 seconds is: " Could not find a package configuration file provided by “ament_cmake” with any of the following names…etc."

We try to use “source /opt/ros/galactic/setup.bash”, not helping. Also, we try to append CMAKE_PREFIX_PATH in px4_msgs pack with their directory in “/home/william/ros2_galactic/build” or “/home/william/ros2_galactic/build/ament_cmake/ament_cmake_core” (first one with package, and later one with exact .cmake file), or adding “PATHS” argument into “find_package” still not working.

Does anyone else also encounter similar issues?
Are there any direction I should work on?


Our current config:
Ubuntu 20.04.4 LTS
Fast DDS: v2.6
Fast RPTS Gen: v1.0.4