-
Notifications
You must be signed in to change notification settings - Fork 47
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
fix: Fixes for Cross-Compilation Issues #272
base: main
Are you sure you want to change the base?
Conversation
…ing diverse compiler invocation commands This commit addresses the issue where certain operating systems (e.g., NixOS) were unable to complete cross-platform compilation. The current implementation assumes that all clang and clang++ invocations are done using specific commands. However, in reality, the invocation of these compilers can vary. For example, on NixOS, the compiler commands are actually: `aarch64-unknown-linux-gnu-clang` and `aarch64-unknown-linux-gnu-clang++`. To resolve this, we should respect the original environment variable settings and allow users to determine the binary names provided by their distribution. This adjustment improves our support for different operating systems and compilation environments, enhancing the cross-platform compatibility of the project.
This commit added necessary configurations to `CMakeLists.txt` to ensure the correct discovery of package directories during cross-compilation. This includes: - Finding and linking required packages: Fontconfig, X11 with xkbcommon, and OpenGL with EGL. - Utilizing pkg-config to locate Wayland libraries: wayland-egl, wayland-client, and wayland-cursor. - Linking these dependencies to the flutter target. - Including the necessary directories for these dependencies. These changes address the issue where the build system could not correctly locate package directories during cross-compilation, thereby ensuring a successful build process.
Thank you for sending this PR.
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. 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.
This looks good to me. |
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. |
I suppose https://github.com/sony/flutter-elinux/blob/main/templates/app/CMakeLists.txt.tmpl#L28 |
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:
clang
andclang++
. However, different operating systems might use different commands. For instance, on NixOS, the commands areaarch64-unknown-linux-gnu-clang
andaarch64-unknown-linux-gnu-clang++
.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.