andymeneely / squib

A Ruby DSL for prototyping card games.
http://squib.rocks
MIT License
918 stars 67 forks source link

Squib can't install on an MacBook M1 #375

Open CovertDad opened 1 year ago

CovertDad commented 1 year ago

When running "gem install squib" on a Macbook M1 running ruby 3.1.3, the build errors out with "ld: symbol(s) not found for architecture arm64".

The build still succeeds on a Windows installation.

andymeneely commented 1 year ago

Hm. Interesting. It works on my M1. I'll look into it more

CovertDad commented 1 year ago

I THINK it might be something with gobject_introspection. I've put the install output here: https://pastebin.com/udPfmtwt

fgombault commented 1 year ago

Some dependancies must be installed with specific ldflags in order to build on M1.

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"
gem install pango:3.5.1 -- --with-ldflags="-Wl,-undefined,dynamic_lookup"
andymeneely commented 1 year ago

Ah - interesting. Actually it looks like they went to 4.0 a few months ago anyway, and that works out of the box for me. They had some breaking changes that messes some obscure ways Squib can take font strings, so I'm going to do a little more testing. But the next version of Squib should be able to work without this workaround

KEClaytor commented 1 year ago

Hey, just wanted to chime in on this - I've spent the evening trying to get this installed with bundle install on my M1 Air and was failing with errors similar to;

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

and

An error occurred while installing cairo-gobject (3.5.1), and Bundler cannot continue.

Then I tried with the gem install squib method and was getting similar errors;

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

But for cairo, gio, etc. This led me to just do the gem install for the one that was giving me the error and most likely, it installed successfully.

Eventually what worked (this is copy-paste from my history) was;

gem install gobject-introspection   # installed v4.0+
gem install cairo-gobject           # installed v4.0+
gem install pango                   # installed v4.0+
gem install squib                   # failed
gem install rb-gio2                 # not a real ruby package
gem install gio2                    # okay
gem install squib                   # failed
gem install gio2                    # okay
gem install squib                   # failed
arch -arch x86_64 gem install squib # failed
gem install squib -- --with-ldflags="-Wl,-undefined,dynamic_lookup" # failed, inspired by above
gem install squib                   # success??

Ruby version:

% ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin22]

Gem versions:

% gem search cairo cairo-gobject gobject-introspection gio2

*** REMOTE GEMS ***

cairo (1.17.8, 1.16.1 x64-mingw32 x86-mingw32, 1.8.1 x86-mswin32)
cairo-gobject (4.0.8, 3.2.9 x64-mingw32 x86-mingw32)
cairo-graph (0.0.2)
caironoleto-feedtools (0.2.31)
caironoleto-feedupdater (0.2.7)
carray-cairo (1.0.1)
gir_ffi-cairo (0.0.15)

*** REMOTE GEMS ***

cairo-gobject (4.0.8, 3.2.9 x64-mingw32 x86-mingw32)

*** REMOTE GEMS ***

gobject-introspection (4.0.8, 3.2.9 x64-mingw32 x86-mingw32)

*** REMOTE GEMS ***

gio2 (4.0.8, 3.2.9 x64-mingw32 x86-mingw32)

I just re-ran bundle install to try to capture the errors and this time it worked?

Gemfile:

source 'https://rubygems.org'
gem 'squib'

I think this quote quite describes my night:

Insanity is doing the same thing over and over again and expecting different results.

KEClaytor commented 1 year ago

Just wanted to link this similar issue on BGG

spencerm commented 1 year ago

I'm on a 2019 intel mac running Ventura and still getting a

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

I never use ruby so it's a fresh brew ruby, which is a more recent version, ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-darwin22]. Rails installed fine however.

Tried the above and working through the errors and didn't get anywhere.

andymeneely commented 1 year ago

@spencerm Can you try the latest Squib? Should be 0.19.0