Skip to content
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

gcc: fix building cross-compiler on 32-bit host platforms #82510

Merged
merged 2 commits into from
Mar 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions pkgs/development/compilers/gcc/9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,6 @@ stdenv.mkDerivation ({

inherit (stdenv) is64bit;

# In this particular combination it stopped creating lib output at all.
# TODO: perhaps find a better fix? (ideally understand what's going on)
postFixup = if crossStageStatic && targetPlatform.isMusl && targetPlatform.is32bit
then ''mkdir "$lib"''
else null;

meta = {
homepage = https://gcc.gnu.org/;
license = stdenv.lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/compilers/gcc/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ postConfigure() {


preInstall() {
mkdir -p "$out/${targetConfig}/lib"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still want [ -z "$enableMultilib" ] though, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those directories should always be created. I think the logic for the conditional below is correct (other than is64bit referring to wrong platform). On 32-bit platforms, there should only be a lib directory. On 64-bit platforms, there should be lib and lib64, which should be linked unless multilib is enabled.

It doesn't seem to break anything to have lib64 on 32-bit as well (since it happens unintentionally in the armv7l cross compiler), but that kind of change seems out of scope for this PR.

Copy link
Member

@Ericson2314 Ericson2314 Mar 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'm not sure we ever don't do enableMultilib, but I think without multilib it never prefixes any directories like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multilib is disabled for normal builds. In all the 64-bit GCCs I have built, lib64 is a symlink to lib. The only place I can find in nixpkgs where enableMultilib is true is gcc_multi.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh oops I forgot the -z and got it backwards.

mkdir -p "$lib/${targetConfig}/lib"
# Make ‘lib64’ symlinks to ‘lib’.
if [ -n "$is64bit" -a -z "$enableMultilib" ]; then
mkdir -p "$out/${targetConfig}/lib"
ln -s lib "$out/${targetConfig}/lib64"
mkdir -p "$lib/${targetConfig}/lib"
ln -s lib "$lib/${targetConfig}/lib64"
fi
}
Expand Down