PX4-Autopilot: build on macos14.3 error, and which python3 we should use?

Describe the bug

when I use MacOS Development Environment, after:

git clone https://github.com/PX4/PX4-Autopilot.git --recursive
cd PX4-Autopilot/Tools/setup
sh macos.sh

output is :

➜  PX4-Autopilot git:(9687324778) sh Tools/setup/macos.sh                
px4-dev already installed
Installing PX4 Python3 dependencies
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
    xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-brew-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-brew packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
    xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-brew-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-brew packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
All set! PX4 toolchain installed!
➜  PX4-Autopilot git:(9687324778) which python3
/usr/local/bin/python3
➜  PX4-Autopilot git:(9687324778) /usr/bin/python3 --version
Python 3.9.6
➜  PX4-Autopilot git:(9687324778) python3 --version         
Python 3.12.2
➜  PX4-Autopilot git:(9687324778) 

To Reproduce

following instructions set up a PX4 development environment for macOS

Expected behavior

this instructions in /Tools/setup/macos.sh will running:

python3 -m pip install future
python3 -m pip install --user -r ${DIR}/requirements.txt

Screenshot / Media

No response

Flight Log

non

Software Version

px4 v1.14.2, I want to build px4_sitl on macos sonoma 14.3.1 (m1).

Flight controller

non

Vehicle type

None

How are the different components wired up (including port information)

No response

Additional context

No response

About this issue

  • Original URL
  • State: open
  • Created 4 months ago
  • Comments: 16

Most upvoted comments

the error fix by

brew uninstall --ignore-dependencies QT

I just want to thank you for sharing:

brew uninstall --ignore-dependencies QT

That totally fixed my PX4 gazebo-classic QT build errors on MacOS 13.6.1 Ventura…

Now,

make px4_sitl gazebo-classic

works like a champ.

what is this?

gzserver(20729,0x204d8b240) malloc: Incorrect checksum for freed object 0x7f8f6cb475a0: probably modified after being freed.
Corrupt value: 0x4d555458
gzserver(20729,0x204d8b240) malloc: *** set a breakpoint in malloc_error_break to debug
/Users/mch/Proj/Mac_DF/PX4-Autopilot/Tools/sitl_run.sh: line 217: 20729 Abort trap: 6           gzserver $verbose $world_path $ros_args



the error fix by

brew uninstall --ignore-dependencies QT

But make px4_sitl gazebo still failed.

➜  PX4-Autopilot git:(6823cbc414) ✗ make px4_sitl gazebo                                                            
[0/4] Performing build step for 'sitl_gazebo'
ninja: no work to do.
[3/4] cd /Users/mch/Proj/Mac_DF/PX4-Autopilot/build/px4_sitl_default/tmp && /Users/mch/Proj/Mac_D... /Users/mch/Proj/Mac_DF/PX4-Autopilot /Users/mch/Proj/Mac_DF/PX4-Autopilot/build/px4_sitl_defaul
SITL ARGS
sitl_bin: /Users/mch/Proj/Mac_DF/PX4-Autopilot/build/px4_sitl_default/bin/px4
debugger: none
program: gazebo
model: none
world: none
src_path: /Users/mch/Proj/Mac_DF/PX4-Autopilot
build_path: /Users/mch/Proj/Mac_DF/PX4-Autopilot/build/px4_sitl_default
empty model, setting iris as default
GAZEBO_PLUGIN_PATH :/Users/mch/Proj/Mac_DF/PX4-Autopilot/build/px4_sitl_default/build_gazebo
GAZEBO_MODEL_PATH :/Users/mch/Proj/Mac_DF/PX4-Autopilot/Tools/sitl_gazebo/models
LD_LIBRARY_PATH :/Users/mch/Proj/Mac_DF/PX4-Autopilot/build/px4_sitl_default/build_gazebo
empty world, setting empty.world as default
Using: /Users/mch/Proj/Mac_DF/PX4-Autopilot/Tools/sitl_gazebo/models/iris/iris.sdf
Warning [parser.cc:833] XML Attribute[version] in element[sdf] not defined in SDF, ignoring.
gzserver(20729,0x204d8b240) malloc: Incorrect checksum for freed object 0x7f8f6cb475a0: probably modified after being freed.
Corrupt value: 0x4d555458
gzserver(20729,0x204d8b240) malloc: *** set a breakpoint in malloc_error_break to debug
/Users/mch/Proj/Mac_DF/PX4-Autopilot/Tools/sitl_run.sh: line 217: 20729 Abort trap: 6           gzserver $verbose $world_path $ros_args
SITL COMMAND: "/Users/mch/Proj/Mac_DF/PX4-Autopilot/build/px4_sitl_default/bin/px4" "/Users/mch/Proj/Mac_DF/PX4-Autopilot/build/px4_sitl_default"/etc -s etc/init.d-posix/rcS -t "/Users/mch/Proj/Mac_DF/PX4-Autopilot"/test_data
Creating symlink /Users/mch/Proj/Mac_DF/PX4-Autopilot/build/px4_sitl_default/etc -> /Users/mch/Proj/Mac_DF/PX4-Autopilo

_____  __   __    ___ 
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

INFO  [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
INFO  [init] found model autostart file as SYS_AUTOSTART=10016
INFO  [param] selected parameter default file eeprom/parameters_10016
[param] parameter file not found, creating eeprom/parameters_10016
  SYS_AUTOCONFIG: curr: 0 -> new: 1
  SYS_AUTOSTART: curr: 0 -> new: 10016
  CAL_ACC0_ID: curr: 0 -> new: 1310988
  CAL_GYRO0_ID: curr: 0 -> new: 1310988
  CAL_ACC1_ID: curr: 0 -> new: 1310996
  CAL_GYRO1_ID: curr: 0 -> new: 1310996
  CAL_ACC2_ID: curr: 0 -> new: 1311004
  CAL_GYRO2_ID: curr: 0 -> new: 1311004
* CAL_MAG0_ID: curr: 0 -> new: 197388
* CAL_MAG1_ID: curr: 0 -> new: 197644
* SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000
* SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010
* SYS_AUTOCONFIG: curr: 1 -> new: 0
* IMU_INTEG_RATE: curr: 200 -> new: 250
INFO  [dataman] data manager file './dataman' size is 7866640 bytes
PX4 SIM HOST: localhost
INFO  [simulator] Waiting for simulator to accept connection on TCP port 4560
Gazebo multi-robot simulator, version 11.14.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Err] [ConnectionManager.cc:121] Failed to connect to master in 30 seconds.
[Err] [gazebo_shared.cc:78] Unable to initialize transport.
[Err] [gazebo_client.cc:56] Unable to setup Gazebo
gcc^CERROR [px4] Startup script returned with return value: 2
/Users/mch/Proj/Mac_DF/PX4-Autopilot/Tools/sitl_run.sh: line 260: kill: (20729) - No such process
/Users/mch/Proj/Mac_DF/PX4-Autopilot/Tools/sitl_run.sh: line 262: kill: (20736) - No such process
ninja: build stopped: interrupted by user.
make: *** [px4_sitl] Interrupt: 2

➜  PX4-Autopilot git:(6823cbc414) ✗ gcc --version
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin23.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
➜  PX4-Autopilot git:(6823cbc414) ✗ which python
python not found
➜  PX4-Autopilot git:(6823cbc414) ✗ which python3
/usr/local/bin/python3
➜  PX4-Autopilot git:(6823cbc414) ✗ python3 --version
Python 3.12.2
➜  PX4-Autopilot git:(6823cbc414) ✗ gazebo -v
Gazebo multi-robot simulator, version 11.14.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org


➜  PX4-Autopilot git:(6823cbc414) ✗