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

dmd,dtools,dub: 2.079.0 -> 2.079.1 and wrap ldc2 binary with $CC #40228

Merged
merged 2 commits into from
May 23, 2018

Conversation

ThomasMader
Copy link
Contributor

@ThomasMader ThomasMader commented May 9, 2018

Motivation for this change

Fix dmd build on Master and update to new version.
Wrap ldc2 binary with C compiler because it's needed for linking.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@ThomasMader
Copy link
Contributor Author

The reason why this is WIP is that the resulting compiler (dmd) is not working properly.
The build of dmd is successful but it can't even build a simple hello world program anymore.
The compilation results in various linker errors.
This problem was hidden because dmd wasn't building anymore for some time now.
The merge commit which introduced the problem into master was ee6894c.
I don't know the exact problem commit but I suspect that it is 273e58e which made glibc 2.27 the default.
This problem only occurs on master, on 18.03 there should be no problem. At least not the last time I checked.

The error output of the hello world compilation can be seen at https://forum.dlang.org/post/ooxytxcurfzakjpqhvkt@forum.dlang.org

@shlevy Do you have a clue what might be wrong? I am having a hard time here.

To compile the hello world program with dmd just run 'dmd hello.d'
The contents of hello.d looks like this:

import std.stdio;

void main()
{
	writeln("test");
}

@ThomasMader
Copy link
Contributor Author

@shlevy I did a very time consuming bisect and found the error commit to be 3027bca which bumped the binutils to 2.30.

Since this PR fixes the build of dmd and the problem with binutils doesn't exist on 18.03 I remove the WIP label and consider it ready to be merged as it also improves the situation on master.

This should be cherry picked to 18.03 too to update the packages.

@ThomasMader ThomasMader changed the title [WIP] dmd,dtools,dub: 2.079.0 -> 2.079.1 dmd,dtools,dub: 2.079.0 -> 2.079.1 May 11, 2018
@ThomasMader
Copy link
Contributor Author

@GrahamcOfBorg build dmd

I don't trigger the build of dtools and dub because they can not build due to the binutils problem.

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: dmd

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: dmd

Partial log (click to expand)

3.247s PASS release64 std.parallelism
16.010s PASS release64 std.file
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/540f42qs5p6xsrvbhkr1j0v60clh066b-phobosUnittests-2.067.1
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/540f42qs5p6xsrvbhkr1j0v60clh066b-phobosUnittests-2.067.1
checking for references to /build in /nix/store/540f42qs5p6xsrvbhkr1j0v60clh066b-phobosUnittests-2.067.1...
warning: path '/nix/store/540f42qs5p6xsrvbhkr1j0v60clh066b-phobosUnittests-2.067.1' claims to be content-addressed but isn't
error: unexpected end-of-file

@ThomasMader
Copy link
Contributor Author

The error
warning: path '/nix/store/540f42qs5p6xsrvbhkr1j0v60clh066b-phobosUnittests-2.067.1' claims to be content-addressed but isn't error: unexpected end-of-file
was first mentioned in #39951. -> cc @voobscout

Removing the phobosUnittests resolves this.
Because I disabled all tests while bisecting the first error I didn't see this second error.
I don't want to just remove the tests, so I will try to bisect this problem too.

@ThomasMader ThomasMader changed the title dmd,dtools,dub: 2.079.0 -> 2.079.1 [WIP] dmd,dtools,dub: 2.079.0 -> 2.079.1 May 11, 2018
@ThomasMader
Copy link
Contributor Author

The error
warning: path '/nix/store/540f42qs5p6xsrvbhkr1j0v60clh066b-phobosUnittests-2.067.1' claims to be content-addressed but isn't error: unexpected end-of-file
was first mentioned in #39951. -> cc @voobscout

This seems to be a regression in nix. Opened NixOS/nix#2155 for it.

@ThomasMader ThomasMader changed the title [WIP] dmd,dtools,dub: 2.079.0 -> 2.079.1 dmd,dtools,dub: 2.079.0 -> 2.079.1 and wrap ldc2 binary with $CC May 12, 2018
@ThomasMader
Copy link
Contributor Author

ThomasMader commented May 12, 2018

I also opened #40397 for the binutils problem.

While testing I saw that the ldc package can't compile if there is no gcc installed. I fixed this by wrapping the ldc2 binary like it was already done with the dmd binary.

Because the other remaining issues are outside the scope of this PR and this PR fixes the build problems on master, this can now be finally merged as it improves the current situation.

'';

postInstall = ''
wrapProgram $out/bin/ldc2 \
--prefix PATH ":" "${stdenv.cc}/bin" \
Copy link
Member

Choose a reason for hiding this comment

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

If you are care about cross compilation, or might eventually care about cross compilation, it's better if you do targetPackages.stdenv.cc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, also changed it in the dmd package.

postInstall = ''
wrapProgram $out/bin/ldc2 \
--prefix PATH ":" "${stdenv.cc}/bin" \
--set-default CC "$CC"
Copy link
Member

Choose a reason for hiding this comment

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

likewise

--set-default CC "${targetPackages.stdenv.cc}/bin/cc"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, also changed it in the dmd package.

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: dmd, dtools, dub, ldc

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: dmd, dtools, dub, ldc

Partial log (click to expand)


Total Test time (real) =  16.05 sec
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/0hj4zi4v1hfhcclh3zxhlykrx3g8frzg-ldcUnittests-0.17.5
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/0hj4zi4v1hfhcclh3zxhlykrx3g8frzg-ldcUnittests-0.17.5
checking for references to /build in /nix/store/0hj4zi4v1hfhcclh3zxhlykrx3g8frzg-ldcUnittests-0.17.5...
warning: path '/nix/store/0hj4zi4v1hfhcclh3zxhlykrx3g8frzg-ldcUnittests-0.17.5' claims to be content-addressed but isn't
error: unexpected end-of-file

@ThomasMader
Copy link
Contributor Author

I found the linking problem.
It's because of of a changed/broken strip in binutils 2.30.

Since it is better anyway not to strip the dmd package I put a dontStrip = true into the package which fixes the problem immediately. See also #40397 (comment).

This means that the only thing left is to merge nix 2.0.2 into release-18.03. See #40652.

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: dmd, dtools, dub, ldc

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: dmd, dtools, dub, ldc

Partial log (click to expand)


Total Test time (real) =  34.47 sec
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/zrw5hxv62gmc8gh75wiqy6053xi7f0i7-ldcUnittests-1.8.0
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/zrw5hxv62gmc8gh75wiqy6053xi7f0i7-ldcUnittests-1.8.0
checking for references to /build in /nix/store/zrw5hxv62gmc8gh75wiqy6053xi7f0i7-ldcUnittests-1.8.0...
building '/nix/store/1fdwk5p7jc2ggwjcp11927sxi5xca308-ldc-1.8.0.drv'...
installing

@ElvishJerricco
Copy link
Contributor

@ThomasMader Looks like that's merged. Is this PR good to go then?

@ThomasMader
Copy link
Contributor Author

Yes can be merged.

@xeji xeji merged commit 4aa04d1 into NixOS:master May 23, 2018
ThomasMader pushed a commit to ThomasMader/nixpkgs that referenced this pull request May 24, 2018
dmd,dtools,dub: 2.079.0 -> 2.079.1 and wrap ldc2 binary with $CC

(cherry picked from commit 4aa04d1)

Reason: This bumps the version to a newer release and fixes package
issues.
xeji pushed a commit that referenced this pull request May 24, 2018
dmd,dtools,dub: 2.079.0 -> 2.079.1 and wrap ldc2 binary with $CC

(cherry picked from commit 4aa04d1)

Reason: This bumps the version to a newer release and fixes package
issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants