PX4-Autopilot icon indicating copy to clipboard operation
PX4-Autopilot copied to clipboard

Ubuntu 24.04 Support

Open MaEtUgR opened this issue 1 year ago • 2 comments

Solved Problem

Ubuntu 24.04 stable came out and we already have the first developer @haumarco using it on a new laptop. Some things need to be adapted.

Issues

  • [x] When I followed https://docs.px4.io/main/en/dev_setup/dev_env_linux_ubuntu.html and ran git clone https://github.com/PX4/PX4-Autopilot.git --recursive I got prompted to enter https credentials for Tools/simulation/jsbsim/jsbsim_bridge/models/Rascal and ATI-Resolution. I don't know why that is since the repos are still public. Ticking this one since it's unrelated and tracked here: https://github.com/PX4/PX4-Autopilot/issues/23124
  • [ ] The newer python versions have this annoying pip package environment enforcement. For Arch Linux which had this problem already quite some time ago I added the --break-system-packages parameter which is in my understanding not the proper solution so we might as well do it correctly now and use a virtual environment. But I need to first figure out how to do it correctly before rolling that out. Related:
    • https://github.com/PX4/PX4-Autopilot/issues/23073
    • https://github.com/PX4/PX4-Autopilot/commit/d25938698715dbb6a10e0891471c33a08687bf85
  • [ ] libncurses5 seems not available. Only libncurses5-dev? Why? New version?
  • [ ] The Java version condition by default uses 14 which doesn't exist. 11 works but we should probably use a newer one if possible.
  • [ ] Gazebo neither classic nor gz exist as packages for 24.04 yet.
  • [ ] There's a Warning about Compatibility with CMake < 3.5

Changelog Entry

Ubuntu 24.04 support of toolchain
Documentation: Make sure it's reflected on the development environment page.

Test coverage

With this hacky draft I could successfully build make px4_sitl and make px4_fmu-v5x. I haven't tested more. Let's cooperate to work through the items and do more testing.

MaEtUgR avatar May 13 '24 15:05 MaEtUgR

The basic flow for a python virtual environment using venv is to create a directory for your environment using python -m venv /path/to/myenv. Most projects will just name this directory venv/, and it is conventional to add this directory to .gitignore, as it will contain platform-specific code.

The virtual environment is activated by calling source venv/bin/activate, which updates your local shell's PATH references so that the virtual environment's dependencies appear like they're global. After activating the virtual environment, dependencies can be added using normal pip commands:

python3 -m pip install -r path/to/requirements.txt` 

Then when you want to leave the virtual environment, you have to call deactivate, which was added to your path in the initial activation.

I have something of a working branch with this modification for macos (the branch has a lot of other issues), discussed here: https://github.com/PX4/PX4-Autopilot/issues/23073

saosebastiao avatar May 15 '24 16:05 saosebastiao

@saosebastiao I agree. Switching dependencies to a venv is long overdue. (And we should also install the arm compiler only locally and source it in the same way, and not mess with the users PATH.

julianoes avatar May 18 '24 20:05 julianoes

Is there any update on this and Ubuntu 24.04 support in general?

TannerGilbert avatar Sep 01 '24 19:09 TannerGilbert

I have looked into this and think it's related to #23228 but even when adding the Makefile changes from #23228 to this PR I still couldn't run make px4_sitl as expected as not every command in the Makefile seems to be using the virtual environment yet.

For now I could get the simulation to run by adding --break-system-packages as mentioned by @MaEtUgR.

TannerGilbert avatar Sep 02 '24 09:09 TannerGilbert

Is there any update on this and Ubuntu 24.04 support in general?

I'm aware there are rightfully more and more users. I haven't spent any time anymore 😬 I agree we should got for the --break-system-packages workaround for now. Just wanted to test this again on 24.04 and 22.04 to make sure it didn't break anything and then we can get it merged and documented.

MaEtUgR avatar Sep 04 '24 16:09 MaEtUgR

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/installing-px4-on-ubuntu-24-04-x64-vm/39365/5

DronecodeBot avatar Sep 22 '24 07:09 DronecodeBot

👀 https://github.com/PX4/PX4-Autopilot/pull/23869/

MaEtUgR avatar Oct 30 '24 16:10 MaEtUgR

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-oct-30-2024/42184/1

DronecodeBot avatar Oct 30 '24 17:10 DronecodeBot

Superseded by https://github.com/PX4/PX4-Autopilot/pull/23937 24.04 now works out of the box on main.

MaEtUgR avatar Nov 19 '24 15:11 MaEtUgR

Superseded by #23937 24.04 now works out of the box on main.

so how to use px4 in ubuntu 24.04? I still cant find the proper way. I want to use it using gazebo. Thanks.

Aniruddha120 avatar Apr 02 '25 20:04 Aniruddha120

@Aniruddha120 Please don't necrobump old issues, or add "how do I do this" stuff that isn't a bug to the issue tracking repo.

If you have a problem with usage, ask on https://discuss.px4.io/ and put as much information as possible on what you have already tried. IF there is some problem then you may be asked to create an issue report.

hamishwillee avatar Apr 03 '25 01:04 hamishwillee