2014-06-27 40 views
5
  1. 我试图复制pyLearn2文档中的教程示例。当我运行python make_dataset.py,在这个例子中,我得到这个错误:编译错误ld:在MacOSX中未找到-lgcc_ext库

    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

    我可以在命令行中输入matplotlib和python中的图像。有人能帮我理解它在抱怨什么,以及如何解决错误?

  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)]') 
    

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

    /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的路径,但未解决问题。

    任何帮助将不胜感激。

回答

0

看起来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.