PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.57k stars 13.55k forks source link

[Bug] Unable to make make px4_sitl gazebo-classic on M1 Mac #23841

Open dotvignesh opened 1 month ago

dotvignesh commented 1 month ago

Unable to build px4_sitl on M1 Mac. Running terminal on Rosetta, and I've tinyxml installed, still doesn't work.

I repeatedly keep running into some new error or the other, mostly it points to some directory and says it doesn't exist while it actually does in that location.


[0/413] Performing configure step for 'sitl_gazebo-classic'
-- install-prefix: /usr/local
-- cmake build type: RelWithDebInfo
-- Using C++17 standard
-- ccache enabled (export CCACHE_DISABLE=1 to disable)
CMake Warning (dev) at CMakeLists.txt:47 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" 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.

-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.86.0/BoostConfig.cmake (found suitable version "1.86.0", minimum required is "1.58") found components: system thread filesystem
-- Found DART: /opt/homebrew/include (Required is at least version "6.6") found components: dart
CMake Warning (dev) at /opt/homebrew/lib/cmake/gazebo/gazebo-config.cmake:187 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

Call Stack (most recent call first):
  CMakeLists.txt:48 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.86.0/BoostConfig.cmake (found suitable version "1.86.0", minimum required is "1.40.0") found components: thread system filesystem program_options regex iostreams date_time
-- Looking for ignition-math6 -- found version 6.15.1
-- Searching for dependencies of ignition-math6
-- Looking for OGRE...
-- Found Ogre Ghadamon (1.9.0)
-- Found OGRE: optimized;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreMain.dylib;debug;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreMain.dylib
CMake Warning (dev) at /opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/share/OGRE/cmake/modules/FindOGRE.cmake:313 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

Call Stack (most recent call first):
  /opt/homebrew/lib/cmake/gazebo/gazebo-config.cmake:212 (find_package)
  CMakeLists.txt:48 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at /opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/share/OGRE/cmake/modules/FindOGRE.cmake:322 (find_package):
  Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
  --help-policy CMP0167" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

Call Stack (most recent call first):
  /opt/homebrew/lib/cmake/gazebo/gazebo-config.cmake:212 (find_package)
  CMakeLists.txt:48 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Looking for OGRE_Paging...
-- Found OGRE_Paging: optimized;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgrePaging.dylib;debug;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgrePaging.dylib
-- Looking for OGRE_Terrain...
-- Found OGRE_Terrain: optimized;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreTerrain.dylib;debug;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreTerrain.dylib
-- Looking for OGRE_Property...
-- Found OGRE_Property: optimized;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreProperty.dylib;debug;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreProperty.dylib
-- Looking for OGRE_RTShaderSystem...
-- Found OGRE_RTShaderSystem: optimized;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreRTShaderSystem.dylib;debug;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreRTShaderSystem.dylib
-- Looking for OGRE_Volume...
-- Found OGRE_Volume: optimized;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreVolume.dylib;debug;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreVolume.dylib
-- Looking for OGRE_Overlay...
-- Found OGRE_Overlay: optimized;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreOverlay.dylib;debug;/opt/homebrew/Cellar/ogre1.9/1.9-20160714-108ab0bcc69603dba32c0ffd4bbbc39051f421c9_10/lib/libOgreOverlay.dylib
-- Looking for ignition-math6 -- found version 6.15.1
-- Looking for ignition-transport8 -- found version 8.5.0
-- Searching for dependencies of ignition-transport8
-- Looking for ignition-msgs5 -- found version 5.11.0
-- Searching for dependencies of ignition-msgs5
-- Looking for ignition-math6 -- found version 6.15.1
-- Checking for module 'tinyxml2'
--   Found tinyxml2, version 10.0.0
-- Looking for ignition-msgs5 -- found version 5.11.0
-- Looking for ignition-common3 -- found version 3.17.0
-- Searching for dependencies of ignition-common3
-- Looking for dlfcn.h - found
-- Looking for libdl - found
-- Searching for <ignition-common3> component [graphics]
-- Looking for ignition-common3-graphics -- found version 3.17.0
-- Searching for dependencies of ignition-common3-graphics
-- Looking for ignition-math6 -- found version 6.15.1
-- Looking for ignition-fuel_tools4 -- found version 4.9.1
-- Searching for dependencies of ignition-fuel_tools4
-- Checking for module 'jsoncpp'
--   Found jsoncpp, version 1.9.6
-- Checking for module 'yaml-0.1'
--   Found yaml-0.1, version 0.2.5
-- Checking for module 'libzip'
--   Found libzip, version 1.11.1
-- Looking for ignition-common3 -- found version 3.17.0
-- Looking for ignition-math6 -- found version 6.15.1
-- Looking for ignition-msgs5 -- found version 5.11.0
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 /opt/homebrew/Cellar/cmake/3.30.5/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find TinyXML (missing: TinyXML_LIBRARY TinyXML_INCLUDE_DIR)
Call Stack (most recent call first):
  /opt/homebrew/Cellar/cmake/3.30.5/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindTinyXML.cmake:65 (find_package_handle_standard_args)
  CMakeLists.txt:65 (find_package)

-- Configuring incomplete, errors occurred!
[225/413] Building CXX object src/modu...mulation__pwm_out_sim.dir/PWMSim.cpp.o
FAILED: external/Stamp/sitl_gazebo-classic/sitl_gazebo-classic-configure /Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/external/Stamp/sitl_gazebo-classic/sitl_gazebo-classic-configure
cd "/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic" && /opt/homebrew/Cellar/cmake/3.30.5/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DSEND_ODOMETRY_DATA=ON -DGENERATE_ROS_MODELS=ON -GNinja -S "/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic" -B "/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic" && /opt/homebrew/Cellar/cmake/3.30.5/bin/cmake -E touch "/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/external/Stamp/sitl_gazebo-classic/sitl_gazebo-classic-configure"
[235/413] Performing configure step for 'libmicroxrceddsclient_project'
FAILED: src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure /Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure
cd "/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build" && /opt/homebrew/Cellar/cmake/3.30.5/bin/cmake -P "/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure-RelWithDebInfo.cmake" && /opt/homebrew/Cellar/cmake/3.30.5/bin/cmake -E touch "/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure"
CMake Error at /Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure-RelWithDebInfo.cmake:37 (message):
  Command failed: 1

   '/opt/homebrew/Cellar/cmake/3.30.5/bin/cmake' '-GNinja' '-C/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/tmp/libmicroxrceddsclient_project-cache-RelWithDebInfo.cmake' '-S' '/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client' '-B' '/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build'

  See also

    /Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure-*.log

-- stdout output is:
loading initial cache file /Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/tmp/libmicroxrceddsclient_project-cache-RelWithDebInfo.cmake
-- The C compiler identification is AppleClang 16.0.0.16000026
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - broken
-- Configuring incomplete, errors occurred!

-- stderr output is:
CMake Error at /opt/homebrew/Cellar/cmake/3.30.5/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/Library/Developer/CommandLineTools/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build/CMakeFiles/CMakeScratch/TryCompile-MbMowk'

    Run Build Command(s): /opt/homebrew/bin/ninja -v cmTC_1ff26
    [1/2] /Library/Developer/CommandLineTools/usr/bin/cc   -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/boards/px4/sitl/src -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/posix/src/px4/common/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/lib -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/posix/src/px4/common/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/common -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/common/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/src -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/src/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/src/lib -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/src/lib/matrix -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/src/modules -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/posix/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/external/Install/include  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -MD -MT CMakeFiles/cmTC_1ff26.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_1ff26.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_1ff26.dir/testCCompiler.c.o -c '/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build/CMakeFiles/CMakeScratch/TryCompile-MbMowk/testCCompiler.c'
    FAILED: CMakeFiles/cmTC_1ff26.dir/testCCompiler.c.o
    /Library/Developer/CommandLineTools/usr/bin/cc   -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/boards/px4/sitl/src -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/posix/src/px4/common/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/lib -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/posix/src/px4/common/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/common -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/common/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/src -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/src/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/src/lib -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/src/lib/matrix -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/src/modules -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/platforms/posix/include -I/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/external/Install/include  -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk -MD -MT CMakeFiles/cmTC_1ff26.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_1ff26.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_1ff26.dir/testCCompiler.c.o -c '/Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-build/CMakeFiles/CMakeScratch/TryCompile-MbMowk/testCCompiler.c'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/boards/px4/sitl/src'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/platforms/posix/src/px4/common/include'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/lib'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/platforms/posix/src/px4/generic/generic/include'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/platforms/posix/src/px4/common/include'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/platforms/common'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/platforms/common/include'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/src'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/src/include'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/src/lib'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/src/lib/matrix'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/src/modules'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/platforms/posix/include'
    cc: error: no such file or directory: 'Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/external/Install/include'
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  cmake/SuperBuild.cmake:19 (enable_language)
  CMakeLists.txt:98 (include)

CMake Error at /Users/vigneshraja/Documents/NEU Notes/FAI/Project/PX4-Autopilot/build/px4_sitl_default/src/modules/uxrce_dds_client/src/libmicroxrceddsclient_project-stamp/libmicroxrceddsclient_project-configure-RelWithDebInfo.cmake:47 (message):
  Stopping after outputting logs.

ninja: build stopped: subcommand failed.
make: *** [px4_sitl] Error 1
(base) vigneshraja@Vigneshs-MacBook-Air PX4-Autopilot %```
ryanjAA commented 1 month ago

Below is untested but what I’d try (stopped using apple silicon awhile back but use Mac builds on intel chips extensively).

Try tinyxml2 (brew install tinyxml2)

Then point to the correct paths by setting the cmake variable manually:

export TINYXML2_INCLUDE_DIR=/opt/homebrew/include/tinyxml2 export TINYXML2_LIBRARY=/opt/homebrew/lib/libtinyxml2.dylib

Fix the cmake warning by adding these to the top of cmakelists.txt

cmake_policy(SET CMP0167 NEW) # For Boost warnings cmake_policy(SET CMP0148 NEW) # For PythonInterp and PythonLibs warnings

check command line tools is installed (aka because you can’t compile a simple test program):

xcode-select --install

Do a make clean and try again.