gcc12: disable libsanitizer for mips64#238715
Closed
Conversation
This commit moves `canExecute`, `emulator`, and `emulatorAvailable`
out of `{host,build,target}Platform` and lifts them into
`lib.systems`. Stubs have been left behind to assist with migration
of out-of-tree code.
Nix's function equality is unpredictable and error-prone; we should
not rely on it. Since we need to be able to test
`{host,build,target}Platform` attrsets for equality, the most
sustainable long-term solution is to forbid functions from these
attrsets, much like we do for the `meta` attrset.
The stubs which have been left behind are a narrowly-defined case
where Nix's function equality *does* behave predictably.
Comparing platform sets using `==` works for most cases since the in the native case, the platform sets would not only be equal, but the same identical value (in terms of memory location). This is, however, technically not always the case, e.g. when specifying crossSystem explicitly, cases can arise when we should use a native stdenv, but don't since the functions wouldn't compare as equal due to them being constructed in separate invocations of `lib.system.elaborate`. This problem is described in #237427 and motivated #237512 as an equality predicate that ignors the functions. Since the functions in the platform attribute set no longer relate to the platform set at all, we can use the same function value for every placeholder deprecation error function in the attribute set—consequently they will all compare as equal even for independently constructed platform sets. This is achieved by floating the funtions into a let binding in `lib/systems/default.nix`, ensuring that they are only constructed once per nixpkgs instance, i.e. when that file is imported. (Consequently, comparison of platform sets should be reliable as long as they come from the same instance of nixpkgs.) let inherit ( import <nixpkgs> { localSystem = "x86_64-linux"; crossSystem.system = "x86_64-linux"; } ) buildPlatform hostPlatform ; in buildPlatform == hostPlatform # => true This property is also verified with new test cases.
Without the change build on mips64-unknown-linux-gnu fails as:
$ nix-build -A buildPackages.gcc12 --argstr crossSystem mips64-linux
In file included from ...-glibc-mips64-unknown-linux-gnu-2.37-8-dev/include/bits/stat.h:25,
from ...-glibc-mips64-unknown-linux-gnu-2.37-8-dev/include/fcntl.h:78,
from ../../../../gcc-12.3.0/libsanitizer/sanitizer_common/sanitizer_linux.cpp:55:
...-glibc-mips64-unknown-linux-gnu-2.37-8-dev/include/bits/struct_stat.h:190:8: error: redefinition of 'struct stat64'
190 | struct stat64
| ^~~~~~
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
Resubmitting @trofi's 6cec03027a07162b1fe1d5bfd61c98e98eb5c316 from #237815 which was the right solution to this problem.
Cc: @trofi @alyssais
Things done