我是 brew 新手,直到现在一直在使用它,效果很好。我正在尝试安装 pygame,但它并没有让我通过其中一个依赖项,sdl_ttf
. 我正在运行 OS X 10.9(小牛)。最重要的是,我现在已经自己下载并成功安装了该软件包,但 brew 仍然不断要求它并失败。
从我的角度来看,我已经安装了依赖项,所以 brew 应该让我首先继续。一种选择是“说服” 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 的成功(非 brew)输出:
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:链接: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
./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'