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

Missing libgd when building gem native extension #846

Open
josemigallas opened this issue Oct 10, 2022 · 2 comments
Open

Missing libgd when building gem native extension #846

josemigallas opened this issue Oct 10, 2022 · 2 comments
Labels

Comments

@josemigallas
Copy link

In our Rails project we want to use the gem local-fastimage_resize which requires libgd. According to the doc (and the Internet) it should be possible to install it by means of homebrew but when we try to install the gem it can't find the library.

Here are some logs from my M1 mac:

$ brew info libgd
==> gd: stable 2.3.3 (bottled), HEAD
Graphics library to dynamically manipulate images
https://libgd.github.io/
/opt/homebrew/Cellar/gd/2.3.3_3 (33 files, 1.5MB) *
  Poured from bottle on 2022-10-10 at 12:18:49
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gd.rb
License: Cannot Represent
==> Dependencies
Required: fontconfig ✔, freetype ✔, jpeg-turbo ✔, libavif ✔, libpng ✔, libtiff ✔, webp ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 147,026 (30 days), 503,823 (90 days), 1,624,252 (365 days)
install-on-request: 17,867 (30 days), 55,417 (90 days), 144,616 (365 days)
build-error: 0 (30 days)
$ gem install local-fastimage_resize -- --with-gdlib=/opt/homebrew/Cellar/gd/2.3.3_3
Building native extensions with: '--with-gdlib=/opt/homebrew/Cellar/gd/2.3.3_3'
This could take a while...
ERROR:  Error installing local-fastimage_resize:
	ERROR: Failed to build gem native extension.

    current directory: /Users/jgallaso/.asdf/installs/ruby/2.6.8/lib/ruby/gems/2.6.0/gems/local-fastimage_resize-3.4.0/ext/fastimage_native_resize
/Users/jgallaso/.asdf/installs/ruby/2.6.8/bin/ruby -I /Users/jgallaso/.asdf/installs/ruby/2.6.8/lib/ruby/2.6.0 -r ./siteconf20221010-18826-otaeca.rb extconf.rb --with-gdlib\=/opt/homebrew/Cellar/gd/2.3.3_3
checking for -l/opt/homebrew/Cellar/gd/2.3.3_3... no
missing libgd
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/jgallaso/.asdf/installs/ruby/2.6.8/bin/$(RUBY_BASE_NAME)
	--with-gdlib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/jgallaso/.asdf/installs/ruby/2.6.8/lib/ruby/gems/2.6.0/extensions/arm64-darwin-21/2.6.0/local-fastimage_resize-3.4.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/jgallaso/.asdf/installs/ruby/2.6.8/lib/ruby/gems/2.6.0/gems/local-fastimage_resize-3.4.0 for inspection.
Results logged to /Users/jgallaso/.asdf/installs/ruby/2.6.8/lib/ruby/gems/2.6.0/extensions/arm64-darwin-21/2.6.0/local-fastimage_resize-3.4.0/gem_make.out

I've also tried installing libgd manually following instructions in INSTALL but no matter the path --with-gdlib it will return the same error.

Any ideas? 😖

@vapier
Copy link
Member

vapier commented Oct 10, 2022

probably want to ask the ruby or homebrew folks for help instead

@jkraemer
Copy link

gem install local-fastimage_resize -- --with-opt-dir=$(brew --prefix gd) worked for me

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

No branches or pull requests

3 participants