Skip to content

Adjust ruby gem defaults for scrypt on darwin #20113

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

Merged
merged 1 commit into from
Nov 28, 2016

Conversation

johbo
Copy link
Contributor

@johbo johbo commented Nov 3, 2016

Motivation for this change

Ran into build trouble when trying to package a Gemset which included scrypt. I'll add the full error output into the comments.

Was building against channels/nixpkgs-unstable

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
    • OS X
    • Linux
  • 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.

Without the adjustment I was not able to build scrypt. It was failing
because of missing symbols due to the parameter '-arch i386' being
appended to the clang calls.

Sorry, something went wrong.

Without the adjustment I was not able to build scrypt. It was failing
because of missing symbols due to the parameter '-arch i386' being
appended to the clang calls.
@mention-bot
Copy link

@johbo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @cstrahan, @aflatter and @manveru to be potential reviewers.

@johbo
Copy link
Contributor Author

johbo commented Nov 3, 2016

The problem I wanted to work around looked like this:

clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -msse -msse2 -arch x86_64 -arch i386  -o x86_64-darwin/crypto_scrypt-sse.o -c ./crypto_scrypt-sse.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -msse -msse2 -arch x86_64 -arch i386  -o x86_64-darwin/memlimit.o -c ./memlimit.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -msse -msse2 -arch x86_64 -arch i386  -o x86_64-darwin/scrypt_calibrate.o -c ./scrypt_calibrate.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -msse -msse2 -arch x86_64 -arch i386  -o x86_64-darwin/scrypt_ext.o -c ./scrypt_ext.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -msse -msse2 -arch x86_64 -arch i386  -o x86_64-darwin/scryptenc_cpuperf.o -c ./scryptenc_cpuperf.c
clang -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -msse -msse2 -arch x86_64 -arch i386  -o x86_64-darwin/sha256.o -c ./sha256.c
clang -bundle -o x86_64-darwin/libscrypt_ext.bundle x86_64-darwin/crypto_scrypt-sse.o x86_64-darwin/memlimit.o x86_64-darwin/scrypt_calibrate.o x86_64-darwin/scrypt_ext.o x86_64-darwin/scryptenc_cpuperf.o x86_64-darwin/sha256.o -fexceptions -arch x86_64 -arch i386 
ld: warning: ignoring file /nix/store/1gi5k4v4hibqwx2y7wlxrijnmh269agh-Libsystem-osx-10.11.6/lib/libSystem.dylib, file was built for x86_64 which is not the architecture being linked (i386): /nix/store/1gi5k4v4hibqwx2y7wlxrijnmh269agh-Libsystem-osx-10.11.6/lib/libSystem.dylib
Undefined symbols for architecture i386:
  "___error", referenced from:
      _crypto_scrypt in crypto_scrypt-sse.o
      _memtouse in memlimit.o
  "___stack_chk_fail", referenced from:
      _memtouse in memlimit.o
      _calibrate in scrypt_calibrate.o
      _scryptenc_cpuperf in scryptenc_cpuperf.o
      _scrypt_SHA256_Transform in sha256.o
      _scrypt_SHA256_Final in sha256.o
      _HMAC_scrypt_SHA256_Init in sha256.o
      _HMAC_scrypt_SHA256_Final in sha256.o
      ...
  "___stack_chk_guard", referenced from:
      _memtouse in memlimit.o
      _calibrate in scrypt_calibrate.o
      _scryptenc_cpuperf in scryptenc_cpuperf.o
      _scrypt_SHA256_Transform in sha256.o
      _scrypt_SHA256_Final in sha256.o
      _HMAC_scrypt_SHA256_Init in sha256.o
      _HMAC_scrypt_SHA256_Final in sha256.o
      ...
      _memtouse in memlimit.o
      _calibrate in scrypt_calibrate.o
      _scryptenc_cpuperf in scryptenc_cpuperf.o
      _scrypt_SHA256_Transform in sha256.o
      _scrypt_SHA256_Final in sha256.o
      _HMAC_scrypt_SHA256_Init in sha256.o
      _HMAC_scrypt_SHA256_Final in sha256.o
      ...
      _memtouse in memlimit.o
      _calibrate in scrypt_calibrate.o
      _scryptenc_cpuperf in scryptenc_cpuperf.o
      _scrypt_SHA256_Transform in sha256.o
      _scrypt_SHA256_Final in sha256.o
      _HMAC_scrypt_SHA256_Init in sha256.o
      _HMAC_scrypt_SHA256_Final in sha256.o
      ...
      _memtouse in memlimit.o
      _calibrate in scrypt_calibrate.o
      _scryptenc_cpuperf in scryptenc_cpuperf.o
      _scrypt_SHA256_Transform in sha256.o
      _scrypt_SHA256_Final in sha256.o
      _HMAC_scrypt_SHA256_Init in sha256.o
      _HMAC_scrypt_SHA256_Final in sha256.o
      ...
  "_free", referenced from:
      _crypto_scrypt in crypto_scrypt-sse.o
  "_getrlimit$UNIX2003", referenced from:
      _memtouse in memlimit.o
  "_gettimeofday", referenced from:
      _scryptenc_cpuperf in scryptenc_cpuperf.o
  "_malloc", referenced from:
      _crypto_scrypt in crypto_scrypt-sse.o
  "_memcpy", referenced from:
      _scrypt_SHA256_Update in sha256.o
      _PBKDF2_scrypt_SHA256 in sha256.o
  "_mmap$UNIX2003", referenced from:
      _crypto_scrypt in crypto_scrypt-sse.o
  "_munmap$UNIX2003", referenced from:
      _crypto_scrypt in crypto_scrypt-sse.o
  "_sysconf", referenced from:
      _memtouse in memlimit.o
ld: symbol(s) not found for architecture i386
clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)
rake aborted!
Command failed with status (1): [clang -bundle -o x86_64-darwin/libscrypt_e...]
/nix/store/5y5jr6a53hw8837852vplcjv8apak5sl-ruby2.3.1-ffi-compiler-0.1.3/lib/ruby/gems/2.3.0/gems/ffi-compiler-0.1.3/lib/ffi-compiler/compile_task.rb:131:in `block in define_task!'
/nix/store/j8grv0gb9ccr0q2fq4zc45kwg5kps2ri-ruby2.3.1-rake-11.2.2/lib/ruby/gems/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<main>'
Tasks: TOP => default => x86_64-darwin/libscrypt_ext.bundle
(See full trace by running task with --trace)

rake failed, exit code 1

@LnL7 LnL7 added the 6.topic: darwin Running or building packages on Darwin label Nov 5, 2016
@grahamc grahamc merged commit 5cc4f50 into NixOS:master Nov 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants