简体   繁体   中英

How do I tell Homebrew that I indeed do satisfy a sdl_ttf library dependency for installing pygame?

I am new to brew and have been using it to great effect until now. I am trying to install pygame, and it is not letting me get past one of the dependencies, sdl_ttf . I am running OS X 10.9 (Mavericks). The bottom line is that I have now downloaded and successfully installed the package myself but brew still keeps asking for it and failing.

From my perspective I have installed the dependency, so brew should let me proceed in the first place. One option is to "convince" brew that I have the dependency. Another option is to help brew install it again so it is happy. I don't know too much about make, but brew seems to be failing in the libtool: link: clang section. If I could override -lpng15 to be -lpng16 my hunch is that it will proceed (but I could be wrong).

Attempt to install pygame (and sdl_ttf dependency):

brew install pygame
==> Installing dependencies for pygame: sdl_ttf, pixman, harfbuzz, homebr
==> Installing pygame dependency: sdl_ttf
==> Downloading http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.11.ta
Already downloaded: /Library/Caches/Homebrew/sdl_ttf-2.0.11.tar.gz
==> ./configure --prefix=/usr/local/Cellar/sdl_ttf/2.0.11 --disable-sdltest
==> make install
/bin/sh ./libtool --tag=CC   --mode=link clang  -g -O2 -I/usr/local/Cellar/freetype/2.5.2/include/freetype2 -D_GNU_SOURCE=1 -D_THREAD_SAFE -I/usr/local/include/SDL  -DHAVE_OPENGL -no-undefined -release 2.0 -version-info 10:1:10  -o libSDL_ttf.la -rpath /usr/local/Cellar/sdl_ttf/2.0.11/lib SDL_ttf.lo  -L/usr/local/Cellar/freetype/2.5.2/lib -lfreetype -lz -lbz2 -lpng15 -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa 
libtool: link: clang -dynamiclib  -o .libs/libSDL_ttf-2.0.0.dylib  .libs/SDL_ttf.o   -L/usr/local/Cellar/freetype/2.5.2/lib -lfreetype -lz -lbz2 -lpng15 -L/usr/local/lib -lSDLmain -lSDL  -Wl,-framework -Wl,Cocoa   -install_name  /usr/local/Cellar/sdl_ttf/2.0.11/lib/libSDL_ttf-2.0.0.dylib -compatibility_version 11 -current_version 11.1 -Wl,-single_module
ld: library not found for -lpng15
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libSDL_ttf.la] Error 1

The issue with lpng15 stuck in my memory because I had a previous install issue with a missing library called libpng15 versus libpng16. I think my hunch was right -- when I downloaded the SDL2_ttf-2.0.12 source and ran ./configure, make, make install, it used lpng16, not lpng15 as above:

the successful (non-brew) make output for SDL2_ttf-2.0.12:

make
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.0.12\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -I.     -g -O2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -DHAVE_OPENGL -MT SDL_ttf.lo -MD -MP -MF .deps/SDL_ttf.Tpo -c -o SDL_ttf.lo SDL_ttf.c
libtool: compile:  gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.0.12\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -I. -g -O2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -DHAVE_OPENGL -MT SDL_ttf.lo -MD -MP -MF .deps/SDL_ttf.Tpo -c SDL_ttf.c  -fno-common -DPIC -o .libs/SDL_ttf.o
libtool: compile:  gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.0.12\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -I. -g -O2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -DHAVE_OPENGL -MT SDL_ttf.lo -MD -MP -MF .deps/SDL_ttf.Tpo -c SDL_ttf.c -o SDL_ttf.o >/dev/null 2>&1
mv -f .deps/SDL_ttf.Tpo .deps/SDL_ttf.Plo
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -O2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -DHAVE_OPENGL -no-undefined -release 2.0 -version-info 10:2:10  -o libSDL2_ttf.la -rpath /usr/local/lib SDL_ttf.lo  -L/opt/local/lib -lfreetype -lz -lbz2 -lpng16 -L/usr/local/lib -lSDL2
libtool: link: gcc -dynamiclib  -o .libs/libSDL2_ttf-2.0.0.dylib  .libs/SDL_ttf.o   -L/opt/local/lib -lfreetype -lz -lbz2 -lpng16 -L/usr/local/lib -lSDL2    -install_name  /usr/local/lib/libSDL2_ttf-2.0.0.dylib -compatibility_version 11 -current_version 11.2 -Wl,-single_module
libtool: link: dsymutil .libs/libSDL2_ttf-2.0.0.dylib || :
libtool: link: (cd ".libs" && rm -f "libSDL2_ttf.dylib" && ln -s "libSDL2_ttf-2.0.0.dylib" "libSDL2_ttf.dylib")
libtool: link: ar cru .libs/libSDL2_ttf.a  SDL_ttf.o
libtool: link: ranlib .libs/libSDL2_ttf.a
libtool: link: ( cd ".libs" && rm -f "libSDL2_ttf.la" && ln -s "../libSDL2_ttf.la" "libSDL2_ttf.la" )
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.0.12\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -I.     -g -O2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -DHAVE_OPENGL -MT showfont.o -MD -MP -MF .deps/showfont.Tpo -c -o showfont.o showfont.c
showfont.c:302:47: warning: format specifies type 'short' but the argument has
      type 'int' [-Wformat]
                        TTF_FontHeight(font), text->h);
                                              ^~~~~~~
1 warning generated.
mv -f .deps/showfont.Tpo .deps/showfont.Po
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -O2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -DHAVE_OPENGL   -o showfont showfont.o libSDL2_ttf.la -L/opt/local/lib -lfreetype -lz -lbz2 -lpng16 -L/usr/local/lib -lSDL2
libtool: link: gcc -g -O2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -DHAVE_OPENGL -o .libs/showfont showfont.o  ./.libs/libSDL2_ttf.dylib -L/opt/local/lib -L/usr/local/lib -lfreetype -lz -lbz2 -lpng16 -lSDL2
gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.0.12\" -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -I.     -g -O2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -DHAVE_OPENGL -MT glfont.o -MD -MP -MF .deps/glfont.Tpo -c -o glfont.o glfont.c
glfont.c:386:47: warning: format specifies type 'short' but the argument has
      type 'int' [-Wformat]
                        TTF_FontHeight(font), text->h);
                                              ^~~~~~~
1 warning generated.
mv -f .deps/glfont.Tpo .deps/glfont.Po
/bin/sh ./libtool  --tag=CC   --mode=link gcc  -g -O2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -DHAVE_OPENGL   -o glfont glfont.o libSDL2_ttf.la -Wl,-framework,OpenGL  -L/opt/local/lib -lfreetype -lz -lbz2 -lpng16 -L/usr/local/lib -lSDL2
libtool: link: gcc -g -O2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -DHAVE_OPENGL -o .libs/glfont glfont.o -Wl,-framework -Wl,OpenGL  ./.libs/libSDL2_ttf.dylib -L/opt/local/lib -L/usr/local/lib -lfreetype -lz -lbz2 -lpng16 -lSDL2

look in that last part - it used lpng16, probably based on the config that ran:

libtool: link: gcc -g -O2 -I/opt/local/include/freetype2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -DHAVE_OPENGL -o .libs/glfont glfont.o -Wl,-framework -Wl,OpenGL ./.libs/libSDL2_ttf.dylib -L/opt/local/lib -L/usr/local/lib -lfreetype -lz -lbz2 -lpng16 -lSDL2

remember when brew ran this segment it tried to use lpng15 and couldn't find it:

ld: library not found for -lpng15

the install in this case continues to go smoothly (but after brew still has no idea and wants the sdl_ttf dependency from the beginning of the post):

make install output:

  make install
     ./install-sh -c -d '/usr/local/lib'
     /bin/sh ./libtool   --mode=install /usr/bin/install -c   libSDL2_ttf.la '/usr/local/lib'
    libtool: install: /usr/bin/install -c .libs/libSDL2_ttf-2.0.0.dylib /usr/local/lib/libSDL2_ttf-2.0.0.dylib
    libtool: install: (cd /usr/local/lib && { ln -s -f libSDL2_ttf-2.0.0.dylib libSDL2_ttf.dylib || { rm -f libSDL2_ttf.dylib && ln -s libSDL2_ttf-2.0.0.dylib libSDL2_ttf.dylib; }; })
    libtool: install: /usr/bin/install -c .libs/libSDL2_ttf.lai /usr/local/lib/libSDL2_ttf.la
    libtool: install: /usr/bin/install -c .libs/libSDL2_ttf.a /usr/local/lib/libSDL2_ttf.a
    libtool: install: chmod 644 /usr/local/lib/libSDL2_ttf.a
    libtool: install: ranlib /usr/local/lib/libSDL2_ttf.a
    ----------------------------------------------------------------------
    Libraries have been installed in:
       /usr/local/lib

    If you ever happen to want to link against installed libraries
    in a given directory, LIBDIR, you must either use libtool, and
    specify the full pathname of the library, or use the `-LLIBDIR'
    flag during linking and do at least one of the following:
       - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
         during execution

    See any operating system documentation about shared libraries for
    more information, such as the ld(1) and ld.so(8) manual pages.
    ----------------------------------------------------------------------
     ./install-sh -c -d '/usr/local/include/SDL2'
     /usr/bin/install -c -m 644 SDL_ttf.h '/usr/local/include/SDL2'
     ./install-sh -c -d '/usr/local/lib/pkgconfig'
     /usr/bin/install -c -m 644 SDL2_ttf.pc '/usr/local/lib/pkgconfig'

I think the problem is that you upgraded libpng since you installed freetype, so freetype-config --libs is giving a bad answer. brew update; brew upgrade; brew reinstall freetype brew update; brew upgrade; brew reinstall freetype should fix this "the right way."

It seems that libpng15 may have been replaced with libpng16 . What I would try is creating a symlink from libpng16 to libpng15 (It should be backwards compatible).

So assuming libpng is in /usr/local/lib

#create a link so any requests for lpng15 use lpng16 instead
sudo ln -s /usr/local/lib/lpng16.so /usr/local/lib/lpng15.so

Make sure you verify this is the actual location of the library on your machine (I don't have an OS X box to test on)

EDIT Based on the output of your /usr/local/lib , try the following - it links any missing libpng15 files to use libpng16.

sudo ln -s /usr/local/lib/libpng16.a /usr/local/lib/libpng15.a
sudo ln -s /usr/local/lib/libpng16.dylib /usr/local/lib/libpng15.dylib

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM