4

I'm working with a Rails app that uses authlogic. The scrypt crypto algorithim is included (although not used). I'm gettting this error on my Mac. How do I resovle?

Why is i386 being thought as platform? I really don't care about scrypt - how can I get around this?

ld: in '/usr/local/lib/libunwind.dylib', file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libunwind.dylib for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
rake aborted!
Command failed with status (1): [gcc -bundle -o x86_64-darwin/libscrypt_ext...]
/Users/jt/.rvm/gems/ruby-2.1.2@global/gems/ffi-compiler-1.0.1/lib/ffi-compiler/compile_task.rb:153:in `block in define_task!'
Tasks: TOP => default => x86_64-darwin/libscrypt_ext.bundle
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /Users/jt/.rvm/gems/ruby-2.1.2@ssui/gems/scrypt-3.0.5 for inspection.
Results logged to /Users/jt/.rvm/gems/ruby-2.1.2@ssui/extensions/x86_64-darwin-17/2.1.0/scrypt-3.0.5/gem_make.out

An error occurred while installing scrypt (3.0.5), and Bundler cannot continue.
Make sure that `gem install scrypt -v '3.0.5'` succeeds before bundling.

In Gemfile:
  authlogic was resolved to 3.6.0, which depends on
    scrypt
timpone
  • 19,235
  • 36
  • 121
  • 211

2 Answers2

4
`bundle update scrypt`

The scrypt gem just released 3.0.6 that solves this issue. It's not in the changelog but you can read the PR: https://github.com/pbhogan/scrypt/pull/72

2

scrypt gem version 3.0.5 is causing the problem.

I was checking their releases and can not find 3.0.5. The latest release is 3.0.3

jvillian may be right. The solution could be using wtfiwtz suggestion:

Remove the references to -arch i386 from /Users/<username>/.rvm/gems/ruby-2.3.1/gems/scrypt-2.0.2/ext/scrypt/Rakefile and /Users/<username>/.rvm/gems/ruby-2.3.1/gems/scrypt-2.0.2/Rakefile and then do this:

cp -R /Users/<username>/.rvm/gems/ruby-2.3.1/gems/scrypt-2.0.2/ ~/Code/scrypt
cd ~/Code/scrypt
gem build scrypt.gemspec
gem install --local scrypt-2.0.2.gem

I also had to comment out a line about the signing key in scrypt.gemspec

by checking the scrypt Rakefile sourcecode, I found the code that could be triggering the error. It is a mac specific issue (if t.platform.mac?).

desc "FFI compiler"
namespace "ffi-compiler" do
  FFI::Compiler::CompileTask.new('ext/scrypt/scrypt_ext') do |t|
    t.cflags << "-Wall -std=c99"
    t.cflags << "-msse -msse2" if t.platform.arch.include? "86"
    t.cflags << "-D_GNU_SOURCE=1" if RbConfig::CONFIG["host_os"].downcase =~ /mingw/
    t.cflags << "-D_POSIX_C_SOURCE=199309L" if RbConfig::CONFIG['host_os'].downcase =~ /linux/
    t.cflags << "-arch x86_64 -arch i386" if t.platform.mac?
    t.ldflags << "-arch x86_64 -arch i386" if t.platform.mac?

    t.add_define 'WINDOWS_OS' if FFI::Platform.windows?
  end
end
Fabrizio Bertoglio
  • 5,890
  • 4
  • 16
  • 57