Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

giflib: fix "ld: library not found for -lSM" #42050

Closed
wants to merge 2 commits into from
Closed

giflib: fix "ld: library not found for -lSM" #42050

wants to merge 2 commits into from

Conversation

bashu
Copy link
Contributor

@bashu bashu commented Jul 23, 2015

I got this on os x 10.6.8 :

==> Downloading https://downloads.sourceforge.net/project/giflib/giflib-4.x/giflib-4.2.3.tar.bz2
Already downloaded: /Library/Caches/Homebrew/giflib-4.2.3.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/giflib/4.2.3
==> make install
libtool: link: gcc-4.2 -dynamiclib  -o .libs/libgif.4.dylib  .libs/dgif_lib.o .libs/egif_lib.o .libs/gif_font.o .libs/gif_hash.o .libs/gifalloc.o .libs/gif_err.o   -L/usr/X11/lib -lSM -lICE -lX11  -O2   -install_name  /usr/local/Cellar/giflib/4.2.3/lib/libgif.4.dylib -compatibility_version 6 -current_version 6.7 -Wl,-single_module
ld: library not found for -lSM
collect2: ld returned 1 exit status
make[1]: *** [libgif.la] Error 1
make: *** [install-recursive] Error 1

I got this without ``depends_on :x11`` on os x 10.6.8 :
```
==> Downloading https://downloads.sourceforge.net/project/giflib/giflib-4.x/giflib-4.2.3.tar.bz2
Already downloaded: /Library/Caches/Homebrew/giflib-4.2.3.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/giflib/4.2.3
==> make install
libtool: link: gcc-4.2 -dynamiclib  -o .libs/libgif.4.dylib  .libs/dgif_lib.o .libs/egif_lib.o .libs/gif_font.o .libs/gif_hash.o .libs/gifalloc.o .libs/gif_err.o   -L/usr/X11/lib -lSM -lICE -lX11  -O2   -install_name  /usr/local/Cellar/giflib/4.2.3/lib/libgif.4.dylib -compatibility_version 6 -current_version 6.7 -Wl,-single_module
ld: library not found for -lSM
collect2: ld returned 1 exit status
make[1]: *** [libgif.la] Error 1
make: *** [install-recursive] Error 1
```
@bashu bashu changed the title fix "ld: library not found for -lSM" giflib: fix "ld: library not found for -lSM" Jul 23, 2015
@dunn
Copy link
Contributor

dunn commented Jul 23, 2015

We no longer allow formulae with hard X11 dependencies in the core repository. Can the X11 dependency be made optional? What options are you building giflib with?

@bashu
Copy link
Contributor Author

bashu commented Jul 23, 2015

got error with depends_on :x11 => :optional

$ brew install giflib
Warning: Formula file is modified!
Building from source because Library/Formula/giflib.rb has local changes
To install from a bottle instead, run with --force-bottle
==> Downloading https://downloads.sourceforge.net/project/giflib/giflib-4.x/giflib-4.2.3.tar.bz2
Already downloaded: /Library/Caches/Homebrew/giflib-4.2.3.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/giflib/4.2.3
==> make install
libtool: link: gcc-4.2 -dynamiclib  -o .libs/libgif.4.dylib  .libs/dgif_lib.o .libs/egif_lib.o .libs/gif_font.o .libs/gif_hash.o .libs/gifalloc.o .libs/gif_err.o   -L/usr/X11/lib -lSM -lICE -lX11  -O2   -install_name  /usr/local/Cellar/giflib/4.2.3/lib/libgif.4.dylib -compatibility_version 6 -current_version 6.7 -Wl,-single_module
ld: library not found for -lSM
collect2: ld returned 1 exit status
make[1]: *** [libgif.la] Error 1
make: *** [install-recursive] Error 1

here is modified formula

require 'formula'

class Giflib < Formula
  desc "GIF library using patented LZW algorithm"
  homepage 'http://giflib.sourceforge.net/'
  # 4.2.0 has breaking API changes; don't update until
  # things in $(brew uses giflib) are compatible
  url 'https://downloads.sourceforge.net/project/giflib/giflib-4.x/giflib-4.2.3.tar.bz2'
  sha256 '0ac8d56726f77c8bc9648c93bbb4d6185d32b15ba7bdb702415990f96f3cb766'

  bottle do
    cellar :any
    sha256 "d51319dcc61c11386ffb963a7d0b3c9c7d4e5d62beb6b863aba9691f56df9132" => :yosemite
    sha256 "bc2e9f9f053b82868f5e3a83be6c8f700141580f3f8b47fa58459721846a6cb2" => :mavericks
    sha256 "d38a310aa80f627a23b65b71e97baf6d08d8daa8281595f523e8116f5d4eace1" => :mountain_lion
  end

  depends_on :x11 => :optional

  option :universal

  def install
    ENV.universal_binary if build.universal?
    system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
    system "make install"
  end
end

Note: works with depends_on :x11

@dunn
Copy link
Contributor

dunn commented Jul 23, 2015

Thanks! Could you also post brew gist-logs giflib?

@HughP
Copy link

HughP commented Jul 28, 2015

I ran into this issue too:

==> Downloading from http://iweb.dl.sourceforge.net/project/giflib/giflib-4.x/giflib-4.2.3.tar.bz2
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/giflib/4.2.3
==> make install
libtool: link: gcc-4.2 -dynamiclib  -o .libs/libgif.4.dylib  .libs/dgif_lib.o .libs/egif_lib.o .libs/gif_font.o .libs/gif_hash.o .libs/gifalloc.o .libs/gif_err.o   -L/usr/X11/lib -lSM -lICE -lX11  -O2   -install_name  /usr/local/Cellar/giflib/4.2.3/lib/libgif.4.dylib -compatibility_version 6 -current_version 6.7 -Wl,-single_module
ld: library not found for -lSM
collect2: ld returned 1 exit status
make[1]: *** [libgif.la] Error 1
make: *** [install-recursive] Error 1

gits file is here: https://gist.github.com/76f72b501f5139e6ac48

@DomT4
Copy link
Member

DomT4 commented Aug 4, 2015

Wondering if this is a compiler problem rather than a formula problem, to be honest. Any thoughts @mistydemeo?

@gm6
Copy link

gm6 commented Aug 10, 2015

10.7.5 here. Same problem, any progress?

@russelldavies
Copy link

Having the same problem in 10.7.5. I've tried changing the compiler by setting the HOMEBREW_CC env var to clang then gcc-4.2 but still fails.

@gm6
Copy link

gm6 commented Aug 13, 2015

Moved to MacPorts already. The problem is gone. In addition, MacPorts allows installing TexLive.

@DomT4
Copy link
Member

DomT4 commented Aug 14, 2015

This problem should be resolved by #42921. Feel free to test it locally.

@DomT4 DomT4 closed this in 3abb1de Aug 14, 2015
@Homebrew Homebrew locked and limited conversation to collaborators Jul 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants