Skip to content
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

Building MAVSDK for Android failing (Apple Silicon M2 Max) #2248

Open
rayw-dronesense opened this issue Mar 13, 2024 · 8 comments
Open

Building MAVSDK for Android failing (Apple Silicon M2 Max) #2248

rayw-dronesense opened this issue Mar 13, 2024 · 8 comments

Comments

@rayw-dronesense
Copy link

rayw-dronesense commented Mar 13, 2024

Environment

  • Apple M2 Max Macbook Pro

  • 64 GB RAM

  • Mac OS Ventura

  • Docker Desktop 4.28.0

Problem

I cloned the MAVSDK repo on the main branch, and tried to run the configuration step following the documentation to use dockcross.

However, it fails every single time when it tries to build OpenSSL,

-- extracting...
     src='/work/build/default/third_party/openssl/openssl/src/openssl-3.0.9.tar.gz'
     dst='/work/build/default/third_party/openssl/openssl/src/openssl'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 37%] No update step for 'openssl'
[ 50%] Performing patch step for 'openssl'
patching file Configurations/15-android.conf
Hunk #1 succeeded at 130 (offset 18 lines).
[ 62%] Performing configure step for 'openssl'
Configuring OpenSSL version 3.0.9 for target android-arm64
Using os-specific seed configuration
Created configdata.pm
Running configdata.pm
Created Makefile.in
Created Makefile
Created include/openssl/configuration.h

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL.md file first)      ***
***                                                                ***
**********************************************************************
[ 75%] Performing build step for 'openssl'
make[3]: *** write jobserver: Bad file descriptor.  Stop.
make[3]: *** Waiting for unfinished jobs....
make[3]: *** write jobserver: Bad file descriptor.  Stop.
gmake[2]: *** [CMakeFiles/openssl.dir/build.make:86: openssl/src/openssl-stamp/openssl-build] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/openssl.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
CMake Error at third_party/cmake/build_target.cmake:51 (message):
  /work/build/default/third_party/openssl failed to build!
Call Stack (most recent call first):
  third_party/CMakeLists.txt:23 (build_target)


-- Configuring incomplete, errors occurred!

The command being used to configure the build is

~/dockcross-android-arm64 cmake -DCMAKE_BUILD_TYPE=Debug -Bbuild/default -DBUILD_MAVSDK_SERVER=ON -DBUILD_SHARED_LIBS=ON -H.

The end goal is to make modifications to MAVSDK C++ and bring it into the Android projects (mavsdk_server.aar and mavsdk-java.jar)

@JonasVautherin
Copy link
Collaborator

It is interesting that the build happening inside a docker container fails on the M2 🤔.

Do you know why that would be? What is this "Bad file descriptor"?

@Jai-GAY
Copy link

Jai-GAY commented Mar 14, 2024

The end goal is to make modifications to MAVSDK C++ and bring it into the Android projects (mavsdk_server.aar and mavsdk-java.jar)

What is the difference between these two? I hope I can further understand and learn.

@rayw-dronesense
Copy link
Author

It is interesting that the build happening inside a docker container fails on the M2 🤔.

Do you know why that would be? What is this "Bad file descriptor"?

I have no idea. Hence, reaching out to the experts for help 😁

@rayw-dronesense
Copy link
Author

What is the difference between these two? I hope I can further understand and learn.

@Jai-GAY

MAVSDK-Java is a wrapper interface that talks to the 'MAVSDK-server' using generated protobuf interfaces. The 'Server' contains a pre-built .so binary of MAVSDK C++, in this case, targets Android.

Just having the Java wrapper and Server isn't enough, if you are looking to make modifications because the meat underneath is actually within the MAVSDK C++ project.

@JonasVautherin
Copy link
Collaborator

It seems like openssl fails to build with dockcross on the M2. I would try to remove MAVSDK from the equation and just build OpenSSL first. Then see if that fails or not, and go from there.

This is where we build openssl, you could start from there.

@Jai-GAY
Copy link

Jai-GAY commented Mar 15, 2024

if you are looking to make modifications because the meat underneath is actually within the MAVSDK C++ project.

okay, so as an open-source spirit, isn't it a pull request, submit?

@julianoes
Copy link
Collaborator

FYI: openssl/openssl#23845

@julianoes
Copy link
Collaborator

@rayw-dronesense are you still looking into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants