sony / flutter-elinux

Flutter tools for embedded Linux (eLinux)
BSD 3-Clause "New" or "Revised" License
471 stars 47 forks source link

fix: Fixes for Cross-Compilation Issues #272

Open Losses opened 2 months ago

Losses commented 2 months ago

This pull request includes two key modifications to address potential issues in the cross-compilation process:

1. Configuration Updates in CMakeLists.txt

Introducing necessary configurations in CMakeLists.txt to ensure the correct discovery and linking of package directories during cross-compilation. The changes include:

Problem Addressed:

Previously, the build system struggled to correctly locate package directories during cross-compilation, leading to build failures. These changes ensure that the necessary packages and libraries are correctly found and linked, thereby facilitating a successful build process.

2. Fix for Diverse Compiler Invocation Commands

Resolving issues related to cross-platform compilation on certain operating systems, such as NixOS, by supporting diverse compiler invocation commands.

Details:

Problem Addressed:

Certain operating systems were unable to complete cross-platform compilation due to hardcoded compiler invocation commands. By allowing customizable compiler commands, this fix enhances the project's cross-platform compatibility.

Potentially related to #159, since an incorrect compiler could trigger the same error.

HidenoriMatsubayashi commented 2 months ago

Thank you for sending this PR.

Introducing necessary configurations in CMakeLists.txt to ensure the correct discovery and linking of package directories during cross-compilation. The changes include:

X11, Wayland, and DRM are independent of each other, and aside from common dependency libraries, they are not required for building an application. For example, in the case of X11, the Wayland libraries are unnecessary.

See also: https://github.com/sony/flutter-elinux/wiki/flutter-elinux-install#3-installing-dependent-libraries-for-runtime-binary-flutter-app

If you want to proceed with this change, you will need to implement code that checks for only the necessary components depending on the type of backend.

  1. Fix for Diverse Compiler Invocation Commands

This looks good to me.

Losses commented 2 months ago

It seems we need to find a way for CMake to know which dependencies it requires. This is a bit complex to me, so please give me some time to think about this issue.

HidenoriMatsubayashi commented 2 months ago

I suppose FLUTTER_TARGET_BACKEND_TYPE var can be used to identify which dependencies are needed.

https://github.com/sony/flutter-elinux/blob/main/templates/app/CMakeLists.txt.tmpl#L28