gpt4 book ai didi

python - 编译错误ld : library not found for -lgcc_ext in MacOSX

转载 作者:太空狗 更新时间:2023-10-30 01:38:09 25 4
gpt4 key购买 nike

  1. 我正在尝试复制 pyLearn2 中的教程示例文档。当我运行 python make_dataset.py 时,在这个例子中,我得到了这个错误:

    11:17 $ python make_dataset.py

    /Users/user/pylearn2/pylearn2/utils/image.py:16: UserWarning: Unable to import matplotlib. Some features unavailable. Original exception: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/backends/_macosx.so, 2): Symbol not found: __cg_jpeg_resync_to_restart

    引用自:/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO

    预计在:/usr/local/lib/libjpeg.8.dylib

    我可以在命令行的 python 中导入 matplotlib 和图像。有人可以帮助我了解它在提示什么以及如何解决错误吗?

  2. 另一个问题(可能与上述问题有关,也可能无关)是链接错误

    使用以下命令行编译时出现问题:

    g++ -dynamiclib -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=core-avx-i -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=core-avx-i -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -fPIC -undefined dynamic_lookup -I/Library/Python/2.7/site-packages/numpy-1.9.0.dev_297f54b-py2.7-macosx-10.9-intel.egg/numpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -o /Users/user/.theano/compiledir_Darwin-13.2.0-x86_64-i386-64bit-i386-2.7.5-64/tmpBdy9w9/49d70155ef39a124cbfa83c600416644.so /Users/user/.theano/compiledir_Darwin-13.2.0-x86_64-i386-64bit-i386-2.7.5-64/tmpBdy9w9/mod.cpp -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib

    ld: library not found for -lgcc_ext.10.5

    collect2: error: ld returned 1 exit status

    Exception: ('The following error happened while compiling the node', InplaceDimShuffle{x,0}(mean), '\n', 'Compilation failed (return status=1): ld: library not found for -lgcc_ext.10.5. collect2: error: ld returned 1 exit status. ', '[InplaceDimShuffle{x,0}(mean)]')

    我在 Mac OSX Mavericks 上运行 pyLearn2。我不确定如何修复错误:该库似乎在我的系统中的几个地方:

    /usr/local/Cellar/gcc47/4.7.3/lib/gcc/x86_64-apple-darwin13.0.0/4.7.3/libgcc_ext.10.5.dylib
    /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgcc_ext.10.5.dylib
    /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.7.3/libgcc_ext.10.5.dylib

    我不确定要链接哪一个以及我应该如何链接。

    我已经更改(添加)到 DYLD_LIBRARY_PATH 的路径,但这并没有解决问题。

    如有任何帮助,我们将不胜感激。

最佳答案

看起来像one possible solution就是手动创建.dylib文件的链接:

sudo ln -sf /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib /opt/local/lib/libGL.dylib

sudo ln -sf /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib /opt/local/lib/libpng.dylib

sudo ln -sf /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib /opt/local/lib/libtiff.dylib

sudo ln -sf /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib /opt/local/lib/libjpeg.dylib

Why does this work? Because for whatever reason, when Apple requests libJPEG.dyld, whatever system searches for it finds /opt/local/lib/libjpeg.dyld because the search is case insensitive. For a Unix operating system. Go figure. The lines above will force any program looking for libjpeg.dyld to be redirected to Apple's libJPEG.dyld.

另一个用户建议 setting DYLD_FALLBACK_LIBRARY_PATH :

You could also use DYLD_FALLBACK_LIBRARY_PATH. I had to use that to avoid Apple's libJPEG getting in the way of apps that expected the libjpeg port. See the man page for dlopen() for details.

关于python - 编译错误ld : library not found for -lgcc_ext in MacOSX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24459062/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com