我怎么告诉Homebrew我确实满足sdl_ttf库依赖安装pygame?

时间:2014-07-19 05:22:00

标签: python makefile pygame homebrew sdl-ttf

我是新手酿造,直到现在才一直使用它。我正在尝试安装pygame,它不会让我通过其中一个依赖项sdl_ttf。我正在运行OS X 10.9(Mavericks)。最重要的是我现在已经下载并成功安装了包装,但酿造仍然一直要求它并失败。

从我的角度来看,我已经安装了依赖项,所以brew应该让我先行。一种选择是“说服”酿造我有依赖性。另一个选择是帮助brew再次安装它,这样很开心。我不太了解make,但brew似乎在libtool: link: clang部分失败了。如果我可以将-lpng15覆盖为-lpng16,那么我的预感是它会继续(但我可能是错的)。

尝试安装pygame(和sdl_ttf依赖项):

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

lpng15的问题卡在我的记忆中,因为我之前的安装问题是缺少一个名为libpng15和libpng16的库。我认为我的预感是对的 - 当我下载SDL2_ttf-2.0.12源并运行./configure,make,make install时,它使用了lpng16,而不是上面的lpng15:

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

查看最后一部分 - 它使用了lpng16,可能基于运行的配置:

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

记得当brew运行此段时,它尝试使用lpng15并找不到它:

ld: library not found for -lpng15

这种情况下的安装继续顺利进行(但是在brew之后仍然不知道并希望从帖子的开头有sdl_ttf依赖项):

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'

2 个答案:

答案 0 :(得分:2)

我认为问题是你安装了freetype后升级了libpng,所以freetype-config --libs给出了错误的答案。 brew update; brew upgrade; brew reinstall freetype应该以正确的方式解决这个问题。"

答案 1 :(得分:0)

似乎libpng15可能已被libpng16取代。我会尝试创建一个从libpng16libpng15的符号链接(它应该向后兼容)。

所以假设libpng在/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

确保验证这是您机器上库的实际位置(我没有要测试的OS X盒)

修改 根据{{​​1}}的输出,尝试以下操作 - 它将任何丢失的libpng15文件链接到libpng16。

/usr/local/lib