-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to build px4 current version by cross-compilation on macOS Mojave 10.14.6 #13172
Comments
You are trying to cross-compile without the cross compilation toolchain available. You need gcc that can compile for RPi.
|
@julianoes thank you for the response! Is there a proper way to set this up on the mac that you would recommend ? It seems that the most recent post I can find is over a year old. |
You need to have the toolchain (
|
@julianoes thank you again. Sorry to be so annoying, but I am clearly missing something here. I have the toolchain installed that comes built with the homebrew repo tap Similarly, I also have the Are you saying that I need to have an additional toolchain installed on my Mac as well? Or that I need to add the existing tapped repo compiler location to the Again, sorry about the confusion. I appreciate your help! |
It should all be covered here actually: https://dev.px4.io/master/en/setup/dev_env_mac.html |
@julianoes thanks, but I have followed the instructions to a t, over and over again and this is why I have posted. I can’t seem to find any other help. Let me back up a little to explain. After following all of the instructions that you referenced, I am able to build with The aforementioned errors are from when trying to compile for the navio2. Before even exporting the file to upload to the pi, I need to compile it first. I can’t do that because of said errors. Any further help would be greatly appreciated. |
Right, sorry. I'm not entirely sure which toolchain you need to cross compile for RPi. PX4 does provide a docker image though with the toolchain installed, however, the toolchain itself is based on GCC 4.8.2 and 4 years old. You can use it using docker:
This is the dockerfile for it: |
Hmm. Ok. Thank you @julianoes I assume that the toolchain that comes with the brew tap for macOS should work automatically theoretically, especially since it does compile for jMAVSim. And in all of my research and reading (even on the ARM site), the toolchain installed is the correct one to cross compile for any environment from the Mac. Should this be considered a bug instead of a question ? As that info is not mentioned in the documentation. |
MacOS very clearly supports only NuttX, JMavsim, Gazebo:
If emlid_navio2_cross is one of those then this is a bug, if not it is is a question. |
Thank you @hamishwillee I understand that. The issue is cross compilation from macOS to raspberry pi for the emlid_navio2_cross. Not macOS itself as you can see from the thread above. |
@jshuadvd You are on macOS and you want to target raspberry pi. RaPi is not listed as a supported target that you can build for on macOS. If that list said cross compile for RaPi or Emlid ... I don't understand the distinction that you are trying to draw. I'm probably missing something very obvious. |
@hamishwillee I see what you are saying. I was under the impression that since I am not building for macOS specifically, I could cross-compile (since this is the recommended way to build vs native) for the the pi and then ssh to upload as per this link. As it seems like a stepped process, I just followed along, and after building successfully with Similarly, it doesn't say anywhere specifically that you cannot cross compile from osx to rpi. And I have seen a few videos where individuals are doing just that. To clarify, are you saying that the only way to build for the navio2 is on a linux machine? Thank's for your help! |
Nearly. I am saying that the only supported way to build for the navio2 is on a Linux machine. It may well be possible to build on MacOS, but we don't have a supported solution. What does supported mean? Essentially, a system that is known to work, that is tested in CI and that we commit to keeping working. You're right that we don't say you can't cross compile from OSX to RPi. What we do is say what you can compile. That makes more sense, because after all the list of things you can't compile to is very large. |
Have you tried the docker solution? This should work on macOS. |
@julianoes I haven't tried yet. I plan to do this tonight and see if that gets me anywhere. :( |
@julianoes Docker did not work for me either unfortunately. After installing the containers (see image) following the instructions listed on the documentation, and entering this command:
below is the error I receive.
|
Don't run it with |
@julianoes :( sorry, Please see the updated error:
and if i run:
|
You need to reset all directories that you've touched with the sudo command to your user (or delete them). You have now files that are owned by the super user. I will close this issue - the things we're discussing here (like Mac OS file permissions) are trivial system level issues that you can read up on sites like Stackoverflow and this is not a support forum. Please post to the PX4 user forum and post the link here and some might still give you pointers. But what you're trying is unsupported, so it is not an issue. We have a very small team and that team needs to focus its energy - so even when something seems possible (like running cross-compilation on Mac OS) we still might not spend time on it. If you want to contribute documentation or code changes that make this easier for other Mac OS users, please send pull requests. I'm running on Mac OS myself and I would love that - but I still don't do it, because I can spend the full year dealing with toolchain issues on different operating systems. Which is why we've chosen a supported set and leave it there. Thanks! |
Hi @LorenzMeier Thanks for your feedback. I was simply following the directions in the documentation which clearly states to use the I understand that this is not a support forum, and have posted to the discuss channel without any help as creating the issue was a last resort. To provide you with a little context, my project is used for a prototype. The reason I find PX4 interesting is the specific open source license type for Intellectual Property. I have no issue using AP (which is fully supported by the Navio2), but would rather use PX4. Perhaps I should look into Auterion for a more custom / supported solution. I will continue on my path, and gladly document any success i have. Again, thank you for your remarks as well as your great contribution to the world :) Have a wonderful rest of your weekend ! |
Thanks for pointing to the documentation! We'll fix that. |
Fix for sudo: PX4/PX4-Devguide#881 @LorenzMeier should we add a note that RPi with navio2 is not officially supported to prevent confusion? |
@bkueng To chime in - he worked on that a bit and I don't know where he left it off. |
This builds fine for me (on Linux), using @jshuadvd your output points to a setup issue: you need |
Whenever I run the
make emlid_navio2_cross
command in attempt to build the current master branch of the repository, I receive the following errors.I'm not 100% sure what seems to be going on here, but I can only build with
make px4_sitl jmavsim
not gazebo either.To note:
The current path to my
gcc
&g++
are as follows:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
I have also ran the sequence below in attempt to fix:
make clean
make submodules clean
git submodule update --init --recursive
Similarly, also running this:
sudo rm -rf /Library/Developer/CommandLineTools
sudp xcode-select --install
sudo xcode-select --reset
Any help would be greatly appreciated. Thank you!
The text was updated successfully, but these errors were encountered: