-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Search PATH for code_assets dependencies if needed #175312
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
Search PATH for code_assets dependencies if needed #175312
Conversation
If the executable dependencies of `code_assets` are not found in the usual location (next to `clang++` on Linux), search for them on the `PATH`. This is necessary on some systems, such as NixOS.
|
Can you elaborate why this is necessary on NixOS? The reason I did not do this before is because I want to avoid accidentally combining a compiler and linker from a different toolchain. Is there a way to verify the set of tools together makes sense if not based on directory structure? Or do we kind of need to blindly trust that the user has a sensible set of tools on
Yes, please tag me! I'm happy to receive contributions that make sure Flutter and the code assets work everywhere! 🙏 |
Ahh, I was half-thinking about that when I was making my PR (which is why I preserved the current behavior to look in the same directory). LLVM is confusing enough for me, nevermind roping nix into it; just take a peak at all of the available packages for LLVM 20: https://search.nixos.org/packages?channel=unstable&query=llvmPackages_20 -- they all provide slightly different configurations + binaries
At least as far as I know, there isn't an "all-in-one" LLVM package that includes every executable, at least that I've seen. See also this issue, which (I think?) seems relevant. But thanks for poking some more into this, as I think the proper fix might just be to search for other binary names in the same directory as For example, it looks like $ which clang++
/nix/store/hnn7sg6s3x3zfk8pjxmpslqyj5yy7v1v-clang-wrapper-20.1.6/bin/clang++
$ ls /nix/store/hnn7sg6s3x3zfk8pjxmpslqyj5yy7v1v-clang-wrapper-20.1.6/bin
addr2line@ as@ c++filt@ clang* cpp* ld@ objcopy@ ranlib@ strings@
ar@ c++@ cc@ clang++* gprof@ nm@ objdump@ size@ strip@So we will need to follow some symbolic links, but that's not a big issue--we also just need to look for I'll go ahead and close this PR and make a new one for that fix, unless you see any issues with that approach. Thanks for poking into this! |
Sometimes the necessary binaries `code_assets` expects alongside `clang++` have differing names than the current code expects (e.g., `ld` instead of `ld.lld`) on Linux. This change is necessary on some systems with atypical installs, such as NixOS. These binaries are gathered by the flutter tool and are eventually sent to the build hook for native code assets as the `CCompilerConfig`. Note that the only other reference to `clang`/`clang++` in the linux build system is where it is used to invoke `cmake`, where they are set as the values of the `CC`/`CXX` environment variables. Fixes #175311 CC @dcharkes, this is take two of #175312 > This PR also fixes my CI using only the `llvmPackages_20.clangUseLLVM` Nix package, for reference ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sometimes the necessary binaries `code_assets` expects alongside `clang++` have differing names than the current code expects (e.g., `ld` instead of `ld.lld`) on Linux. This change is necessary on some systems with atypical installs, such as NixOS. These binaries are gathered by the flutter tool and are eventually sent to the build hook for native code assets as the `CCompilerConfig`. Note that the only other reference to `clang`/`clang++` in the linux build system is where it is used to invoke `cmake`, where they are set as the values of the `CC`/`CXX` environment variables. Fixes flutter#175311 CC @dcharkes, this is take two of flutter#175312 > This PR also fixes my CI using only the `llvmPackages_20.clangUseLLVM` Nix package, for reference ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sometimes the necessary binaries `code_assets` expects alongside `clang++` have differing names than the current code expects (e.g., `ld` instead of `ld.lld`) on Linux. This change is necessary on some systems with atypical installs, such as NixOS. These binaries are gathered by the flutter tool and are eventually sent to the build hook for native code assets as the `CCompilerConfig`. Note that the only other reference to `clang`/`clang++` in the linux build system is where it is used to invoke `cmake`, where they are set as the values of the `CC`/`CXX` environment variables. Fixes flutter#175311 CC @dcharkes, this is take two of flutter#175312 > This PR also fixes my CI using only the `llvmPackages_20.clangUseLLVM` Nix package, for reference ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sometimes the necessary binaries `code_assets` expects alongside `clang++` have differing names than the current code expects (e.g., `ld` instead of `ld.lld`) on Linux. This change is necessary on some systems with atypical installs, such as NixOS. These binaries are gathered by the flutter tool and are eventually sent to the build hook for native code assets as the `CCompilerConfig`. Note that the only other reference to `clang`/`clang++` in the linux build system is where it is used to invoke `cmake`, where they are set as the values of the `CC`/`CXX` environment variables. Fixes flutter#175311 CC @dcharkes, this is take two of flutter#175312 > This PR also fixes my CI using only the `llvmPackages_20.clangUseLLVM` Nix package, for reference ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Sometimes the necessary binaries `code_assets` expects alongside `clang++` have differing names than the current code expects (e.g., `ld` instead of `ld.lld`) on Linux. This change is necessary on some systems with atypical installs, such as NixOS. These binaries are gathered by the flutter tool and are eventually sent to the build hook for native code assets as the `CCompilerConfig`. Note that the only other reference to `clang`/`clang++` in the linux build system is where it is used to invoke `cmake`, where they are set as the values of the `CC`/`CXX` environment variables. Fixes flutter#175311 CC @dcharkes, this is take two of flutter#175312 > This PR also fixes my CI using only the `llvmPackages_20.clangUseLLVM` Nix package, for reference ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
If the executable dependencies of
code_assetsare not found in the usual location (next toclang++on Linux), search for them on thePATH.This is necessary on some systems, such as NixOS.
Fixes #175311
CC @dcharkes , looks like you're the relevant SME here based on
git blame(sorry I keep tagging you in everything...)Pre-launch Checklist
///).