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

scs: Fix darwin build #46551

Merged
merged 1 commit into from Sep 12, 2018
Merged

scs: Fix darwin build #46551

merged 1 commit into from Sep 12, 2018

Conversation

knedlsepp
Copy link
Member

Motivation for this change

This fixes the darwin build of scs.
/cc ZHF #45961

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option 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/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@GrahamcOfBorg GrahamcOfBorg added the 6.topic: darwin Running or building packages on Darwin label Sep 11, 2018
@knedlsepp
Copy link
Member Author

@GrahamcOfBorg build scs

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: scs

Partial log (click to expand)

installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2
shrinking /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2/lib/libscsindir.so
shrinking /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2/lib/libscsdir.so
strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2/lib
patching script interpreter paths in /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2
checking for references to /build in /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2...
/nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: scs

Partial log (click to expand)

installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/pn5ch22f4fmdb8r9lsaws6xbbhiw4gs2-scs-2.0.2
shrinking /nix/store/pn5ch22f4fmdb8r9lsaws6xbbhiw4gs2-scs-2.0.2/lib/libscsindir.so
shrinking /nix/store/pn5ch22f4fmdb8r9lsaws6xbbhiw4gs2-scs-2.0.2/lib/libscsdir.so
strip is /nix/store/y4ymnvgxygpq05h03kyzbj572zmh6zla-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/pn5ch22f4fmdb8r9lsaws6xbbhiw4gs2-scs-2.0.2/lib
patching script interpreter paths in /nix/store/pn5ch22f4fmdb8r9lsaws6xbbhiw4gs2-scs-2.0.2
checking for references to /build in /nix/store/pn5ch22f4fmdb8r9lsaws6xbbhiw4gs2-scs-2.0.2...
/nix/store/pn5ch22f4fmdb8r9lsaws6xbbhiw4gs2-scs-2.0.2

@LnL7
Copy link
Member

LnL7 commented Sep 11, 2018

I don't see any dylibs/so's in the output, while the linux build does include dynamic libraries.

@knedlsepp
Copy link
Member Author

Hm. That's odd. I'll look into it.

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: scs

Partial log (click to expand)

/nix/store/pn5ch22f4fmdb8r9lsaws6xbbhiw4gs2-scs-2.0.2

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: scs

Partial log (click to expand)

/nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2
shrinking /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2/lib/libscsdir.so
shrinking /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2/lib/libscsindir.so
strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2/lib
patching script interpreter paths in /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2
checking for references to /build in /nix/store/9icbcrxjnhwvqypc3gvsmb9lyhjwz2yn-scs-2.0.2...

@knedlsepp
Copy link
Member Author

@LnL7 Should be fixed now.

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: scs

Partial log (click to expand)

installing
post-installation fixup
/nix/store/pinr8gpfi6sjzk0g8ms23ildh7hbhd4n-scs-2.0.2
shrinking RPATHs of ELF executables and libraries in /nix/store/pinr8gpfi6sjzk0g8ms23ildh7hbhd4n-scs-2.0.2
shrinking /nix/store/pinr8gpfi6sjzk0g8ms23ildh7hbhd4n-scs-2.0.2/lib/libscsdir.so
shrinking /nix/store/pinr8gpfi6sjzk0g8ms23ildh7hbhd4n-scs-2.0.2/lib/libscsindir.so
strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/pinr8gpfi6sjzk0g8ms23ildh7hbhd4n-scs-2.0.2/lib
patching script interpreter paths in /nix/store/pinr8gpfi6sjzk0g8ms23ildh7hbhd4n-scs-2.0.2
checking for references to /build in /nix/store/pinr8gpfi6sjzk0g8ms23ildh7hbhd4n-scs-2.0.2...

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: scs

Partial log (click to expand)

installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/nyk0gcd2r00fgcfh567d39y9bwfrdf2w-scs-2.0.2
shrinking /nix/store/nyk0gcd2r00fgcfh567d39y9bwfrdf2w-scs-2.0.2/lib/libscsindir.so
shrinking /nix/store/nyk0gcd2r00fgcfh567d39y9bwfrdf2w-scs-2.0.2/lib/libscsdir.so
strip is /nix/store/y4ymnvgxygpq05h03kyzbj572zmh6zla-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/nyk0gcd2r00fgcfh567d39y9bwfrdf2w-scs-2.0.2/lib
patching script interpreter paths in /nix/store/nyk0gcd2r00fgcfh567d39y9bwfrdf2w-scs-2.0.2
checking for references to /build in /nix/store/nyk0gcd2r00fgcfh567d39y9bwfrdf2w-scs-2.0.2...
/nix/store/nyk0gcd2r00fgcfh567d39y9bwfrdf2w-scs-2.0.2

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: scs

Partial log (click to expand)

true pri opt = 0.525044
true dua opt = 0.525044
scs pri obj= 0.525046
scs dua obj = 0.525044
installing
post-installation fixup
strip is /nix/store/df6k4mgdjxciy0f637lryp7c9ln7n1m3-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/rg07dxydf8yb2kp0c1829cc3zvvp0dy4-scs-2.0.2/lib
patching script interpreter paths in /nix/store/rg07dxydf8yb2kp0c1829cc3zvvp0dy4-scs-2.0.2
/nix/store/rg07dxydf8yb2kp0c1829cc3zvvp0dy4-scs-2.0.2

@LnL7
Copy link
Member

LnL7 commented Sep 12, 2018

Looks like we'll also have to fixup the install_name.

@knedlsepp
Copy link
Member Author

Oh, I've never dealt with that before. Could you hint me to what it should look like and how you can tell that it's not correct currently?

@LnL7
Copy link
Member

LnL7 commented Sep 12, 2018

I described it in short here https://nixos.org/nixpkgs/manual/#sec-darwin. Basically, the LC_ID_DYLIB entry should point to the full path of the library otherwise linking against it won't work. Currently it's just the basename.

$ otool -D /nix/store/rg07dxydf8yb2kp0c1829cc3zvvp0dy4-scs-2.0.2/lib/libscsdir.dylib
/nix/store/rg07dxydf8yb2kp0c1829cc3zvvp0dy4-scs-2.0.2/lib/libscsdir.dylib:
libscsdir.dylib

@knedlsepp knedlsepp force-pushed the fix-scs-on-darwin branch 3 times, most recently from 6dcda03 to d726c0f Compare September 12, 2018 18:58
Additionally we make the unit-test deterministic by specifying a seed
instead of using something random.
@knedlsepp
Copy link
Member Author

knedlsepp commented Sep 12, 2018

@LnL7: Thanks for the pointer. Had a look at the options:

  • LDFLAGS=-Wl,-install_name... during buildPhase
  • install_name_tool -id during fixupPhase
  • fixDarwinDylibNames in nativeBuildInputs

I went for the most convenient, namely fixDarwinDylibNames.

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: scs

Partial log (click to expand)

installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/1ald6dpsica3cb7m58svcs9bl87az6fh-scs-2.0.2
shrinking /nix/store/1ald6dpsica3cb7m58svcs9bl87az6fh-scs-2.0.2/lib/libscsindir.so
shrinking /nix/store/1ald6dpsica3cb7m58svcs9bl87az6fh-scs-2.0.2/lib/libscsdir.so
strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/1ald6dpsica3cb7m58svcs9bl87az6fh-scs-2.0.2/lib
patching script interpreter paths in /nix/store/1ald6dpsica3cb7m58svcs9bl87az6fh-scs-2.0.2
checking for references to /build in /nix/store/1ald6dpsica3cb7m58svcs9bl87az6fh-scs-2.0.2...
/nix/store/1ald6dpsica3cb7m58svcs9bl87az6fh-scs-2.0.2

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: scs

Partial log (click to expand)

scs pri obj= 0.525046
scs dua obj = 0.525044
installing
post-installation fixup
/nix/store/pxhznh2fiscxphbval3c2i3hhjgds81q-scs-2.0.2/lib/libscsdir.dylib: fixing dylib
/nix/store/pxhznh2fiscxphbval3c2i3hhjgds81q-scs-2.0.2/lib/libscsindir.dylib: fixing dylib
strip is /nix/store/df6k4mgdjxciy0f637lryp7c9ln7n1m3-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/pxhznh2fiscxphbval3c2i3hhjgds81q-scs-2.0.2/lib
patching script interpreter paths in /nix/store/pxhznh2fiscxphbval3c2i3hhjgds81q-scs-2.0.2
/nix/store/pxhznh2fiscxphbval3c2i3hhjgds81q-scs-2.0.2

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: scs

Partial log (click to expand)

installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/y3vm8ms99c9w9s3q2p64jl6pcksf7sfq-scs-2.0.2
shrinking /nix/store/y3vm8ms99c9w9s3q2p64jl6pcksf7sfq-scs-2.0.2/lib/libscsindir.so
shrinking /nix/store/y3vm8ms99c9w9s3q2p64jl6pcksf7sfq-scs-2.0.2/lib/libscsdir.so
strip is /nix/store/y4ymnvgxygpq05h03kyzbj572zmh6zla-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/y3vm8ms99c9w9s3q2p64jl6pcksf7sfq-scs-2.0.2/lib
patching script interpreter paths in /nix/store/y3vm8ms99c9w9s3q2p64jl6pcksf7sfq-scs-2.0.2
checking for references to /build in /nix/store/y3vm8ms99c9w9s3q2p64jl6pcksf7sfq-scs-2.0.2...
/nix/store/y3vm8ms99c9w9s3q2p64jl6pcksf7sfq-scs-2.0.2

Copy link
Member

@LnL7 LnL7 left a comment

Choose a reason for hiding this comment

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

Thanks!

@LnL7 LnL7 merged commit 09c6755 into NixOS:master Sep 12, 2018
@LnL7
Copy link
Member

LnL7 commented Sep 12, 2018

@knedlsepp 2. and 3. are basically the same, but the hook only looks at *.dylib files IIRC.

@LnL7
Copy link
Member

LnL7 commented Sep 12, 2018

backported in 84361ab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants