1

I'm trying to install the following gems without any luck: rsvg2 gobject-introspection

Native library of gobject-introspection is installed via brew.

I'm using ruby 2.7.2 installed using RVM

when ever I try to install rsvg2 or gobject-introspection I get the following error:

gem install rsvg2:3.5.1

. . . ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [gobject_introspection.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/ibrahimsalem/.rvm/gems/ruby-2.7.2@salam_sc/gems/gobject-introspection-3.5.1 for inspection. Results logged to /Users/ibrahimsalem/.rvm/gems/ruby-2.7.2@salam_sc/extensions/arm64-darwin-22/2.7.0/gobject-introspection-3.5.1/gem_make.out

gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 3.1.4
  - RUBY VERSION: 2.7.2 (2020-10-01 patchlevel 137) [arm64-darwin22]
  - INSTALLATION DIRECTORY: /Users/ibrahimsalem/.rvm/gems/ruby-2.7.2@salam_sc
  - USER INSTALLATION DIRECTORY: /Users/ibrahimsalem/.gem/ruby/2.7.0
  - RUBY EXECUTABLE: /Users/ibrahimsalem/.rvm/rubies/ruby-2.7.2/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /Users/ibrahimsalem/.rvm/gems/ruby-2.7.2@salam_sc/bin
  - SPEC CACHE DIRECTORY: /Users/ibrahimsalem/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/ibrahimsalem/.rvm/rubies/ruby-2.7.2/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - arm64-darwin-22
  - GEM PATHS:
     - /Users/ibrahimsalem/.rvm/gems/ruby-2.7.2@salam_sc
     - /Users/ibrahimsalem/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/ibrahimsalem/.rvm/gems/ruby-2.7.2@salam_sc/bin
     - /Users/ibrahimsalem/.rvm/gems/ruby-2.7.2@global/bin
     - /Users/ibrahimsalem/.rvm/rubies/ruby-2.7.2/bin
     - /Users/ibrahimsalem/.rvm/bin
     - /opt/homebrew/bin
     - /opt/homebrew/sbin
     - /usr/local/bin
     - /System/Cryptexes/App/usr/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Library/Apple/usr/bin
Ibrahim salem
  • 11
  • 1
  • 3
  • Did you migrate from an Intel-based machine? It could be you have left-over libraries from that installation that need to be cleared out. – tadman Dec 03 '22 at 17:48
  • No, this is totally brand new machine and environment .. I'm using brew for all native libraries and so far most gems installed nicely .. except the mentioned gems ... – Ibrahim salem Dec 03 '22 at 18:06
  • I'm not sure how that x86 binary snuck in, then. As a point of comparison, do you have the same problem with Ruby 3.1? It could be `rsvg2` has some kind of binary stub baked in. – tadman Dec 03 '22 at 18:29
  • I suspected so since I'm using older ruby that didn't have M1 support back then, so I tried ruby 3.0 / 3.1 .. same issue: gem install gobject-introspection Building native extensions. This could take a while... ERROR: Error installing gobject-introspection: ERROR: Failed to build gem native extension. – Ibrahim salem Dec 03 '22 at 18:36
  • It might be worth adding the output of `gem env` to your question, just to be sure you're using an ARM-built Ruby. Additionally, test with `file` what `gobject_introspection.bundle` actually is. – tadman Dec 03 '22 at 18:37

1 Answers1

0

Finally fixed it by doing:

gem install gobject-introspection:3.5.1 -- --with-ldflags="-Wl,-undefined,dynamic_lookup" gem install cairo-gobject:3.5.1 -- --with-ldflags="-Wl,-undefined,dynamic_lookup"

Ibrahim salem
  • 11
  • 1
  • 3