RoboStack / ros-galactic

Vinca build files for ROS 2 Galactic Geochelone
https://robostack.github.io
21 stars 14 forks source link

Fix qt-gui-cpp cross-compile for osx-arm64 #72

Open Tobias-Fischer opened 2 years ago

Tobias-Fischer commented 2 years ago

mimick-vendor and qt-gui-cpp currently only compile natively - cross compile doesn't work.

For mimick-vendor, it is probably sufficient to simply forward the CMAKE_ARGS to the mimick build.

For qt-gui-cpp, we need to install sip-build and qt-main (also) in the build env, and point SIP_EXECUTABLE to $BUILD_PREFIX/bin/sip-build. Similarly we need to point QMAKE_EXECUTABLE to $BUILD_PREFIX/bin/qmake. Not sure what else needs doing beyond that.

Tobias-Fischer commented 2 years ago

Fixed the mimick-vendor cross-compile; qt-gui-cpp seems trickier.

michtesar commented 2 years ago

I am investigating qt-gui-cpp.

michtesar commented 2 years ago

After some testing, I tried to compile qt-gui-cpp for osx-64 and osx-arm64 on Intel based MacBook Pro.

In recipe.yaml I added followings host libraries:

- qt-main
- pyqt-builder
- libfido2
- qt

I found issues with incompatibility of versions of qt. During build I see package qt-main-5.15.2-hfad5ee4_0 has constraint qt 5.15.2 conflicting with qt-5.12.1-h1b46049_0.

For cross-platform build for osx-arm64 it goes until almost end and complains on C lang compiler as manifested as follows:

ld: library not found for -lSystem
    clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)

Its noteworthy that in recipe.yaml for osx-arm64 I commented out qt package otherwise, there are no sources to qt 5.12.*.

I include log file for both to start investigating.

report_arm-x64.log report_x64.log

michtesar commented 2 years ago

It seems I can build it on osx-64, with osx-arm64 I struggle with qt versions. Archive.zip

Tobias-Fischer commented 2 years ago

Good start!

I forgot to tell you one piece that explains the qt issues. For the osx-arm64 build, we only use the qt-main package. This is already configured properly in https://github.com/RoboStack/ros-galactic/blob/main/robostack.yaml - however, you need to tell vinca that you want to create recipes for osx-arm64 rather than osx-64. You do so by running vinca --multiple --platform=osx-arm64. Then qt should disappear in the recipe.yaml.

The error ld: library not found for -lSystem can be explained as CONDA_BUILD_SYSROOT needs to be set on your machine: https://github.com/RoboStack/ros-galactic/blob/5dd8f8992639e315be47d96116d2d0bb8e310fd1/conda_build_config.yaml#L64-L65 - simply add a new entry with the path to your SDK. You can download the 11.3 SDK from https://github.com/phracker/MacOSX-SDKs/releases/tag/11.3 and point to that path.

Let us know how you go.