【问题标题】:GDAL install on Mac OS X LionGDAL 安装在 Mac OS X Lion 上
【发布时间】:2011-08-02 16:59:45
【问题描述】:

我正在尝试使用以下方法在 Mac OS X Lion 上安装 GDAL 1.7.1:

python setup.py build
python setup.py install

并得到错误:

running build
running build_py
running build_ext
building 'osgeo._gdal' extension
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -arch i386 -arch x86_64 -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Library/Python/2.7/site-packages/numpy-2.0.0.dev_e2af7b7_20110721-py2.7-macosx-10.7-x86_64.egg/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/1.7/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.7-intel-2.7/extensions/gdal_wrap.o
unable to execute llvm-gcc-4.2: No such file or directory
error: command 'llvm-gcc-4.2' failed with exit status 1

这是正确的编译器吗?我怎样才能让它工作?

更新:

安装 Xcode 后我会更进一步:

running build
running build_py
running build_ext
building 'osgeo._gdal' extension
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Library/Python/2.7/site-packages/numpy-2.0.0.dev_e2af7b7_20110721-py2.7-macosx-10.7-x86_64.egg/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/1.7/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.7-intel-2.7/extensions/gdal_wrap.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
extensions/gdal_wrap.cpp:2813:22: error: cpl_port.h: No such file or directory
extensions/gdal_wrap.cpp:2814:24: error: cpl_string.h: No such file or directory
extensions/gdal_wrap.cpp:2815:27: error: cpl_multiproc.h: No such file or directory
extensions/gdal_wrap.cpp:2817:18: error: gdal.h: No such file or directory
extensions/gdal_wrap.cpp:2818:23: error: gdal_priv.h: No such file or directory
extensions/gdal_wrap.cpp:2819:22: error: gdal_alg.h: No such file or directory
extensions/gdal_wrap.cpp:2820:24: error: gdalwarper.h: No such file or directory
extensions/gdal_wrap.cpp:2837: error: expected initializer before ‘VeryQuietErrorHandler’
extensions/gdal_wrap.cpp:2713: warning: ‘swig_module’ defined but not used
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
extensions/gdal_wrap.cpp:2813:22: error: cpl_port.h: No such file or directory
extensions/gdal_wrap.cpp:2814:24: error: cpl_string.h: No such file or directory
extensions/gdal_wrap.cpp:2815:27: error: cpl_multiproc.h: No such file or directory
extensions/gdal_wrap.cpp:2817:18: error: gdal.h: No such file or directory
extensions/gdal_wrap.cpp:2818:23: error: gdal_priv.h: No such file or directory
extensions/gdal_wrap.cpp:2819:22: error: gdal_alg.h: No such file or directory
extensions/gdal_wrap.cpp:2820:24: error: gdalwarper.h: No such file or directory
extensions/gdal_wrap.cpp:2837: error: expected initializer before ‘VeryQuietErrorHandler’
extensions/gdal_wrap.cpp:2713: warning: ‘swig_module’ defined but not used
lipo: can't open input file: /var/tmp//ccgnLEPX.out (No such file or directory)
error: command 'llvm-gcc-4.2' failed with exit status 1

【问题讨论】:

    标签: python osx-lion gdal


    【解决方案1】:

    如果你真的想从源代码构建,但想要一种方便的安装方式,可以从 MacPorts 获得一个 gdal 包 - 只需安装 MacPorts,然后在命令行输入:

    port install gdal
    

    Macports 将为您获取并编译源代码。截至撰写本文时,MacPorts 中的版本为 1.9.0

    【讨论】:

    • 如果可以的话,我会给 +10。 Brew 已经恨我一段时间了
    • ports 而不是 brew 有 2.0.1 版本
    • 伟大的。它应该是“端口”而不是“端口”
    【解决方案2】:

    Homebrew 非常适合我。要使用 Homebrew 安装 GDAL 1.9,您所要做的就是

          brew install gdal
    

    Homebrew 需要 xcode,我认为是命令行工具。更多信息可以找到here

    【讨论】:

    • 是的...整个“kyngchaos”事情让我很紧张,而且一直很麻烦
    • ports 而不是 brew 有 2.0.1 版本
    • 我认为这应该是公认的答案。正如第一位评论者所说,“kyngchaos”在安装 GDAL 时确实不是一个有用的指南。 Ports 使安装过程变得无缝。但是我遇到了麻烦,bash 仍然引用旧版本,而不是新的端口版本。
    【解决方案3】:

    如何使用http://www.kyngchaos.com/software/frameworks 提供的预编译二进制文件

    另外,您是否出于特定原因使用 1.7.1?我相信 1.8.1 是当前版本。

    警告:我不知道 GDAL OSX 二进制文件是否支持 Lion。

    【讨论】:

    • 预编译的二进制文件并不能真正解决从源代码构建的问题。
    • 绝对正确,但如果您的最终目标是使用 GDAL 并且存在二进制文件,为什么不使用它们。您也可以处理编译问题,但在此期间仍然可以访问 GDAL。你搞定了吗?
    • 我没有从源代码编译 GDAL,但是在尝试编译 GEOS 时遇到了很多麻烦......到了保释和使用 Shapely(python 库)的地步。你能以某种方式注释掉 GEOS 构建吗?另外,你见过bugs.python.org/issue5755。该链接可能有助于您收到 cc1plus 警告?不过,我会从 GEOS 开始。我知道 KyngChaos(二进制创建者)由于问题放弃了 GEOS 编译......
    • kyngchaos 又做了一次。只能等新版本了。安装 GDAL 完成 2011-9-17...
    • 我无法使用相同的 GDAL 版本。 . .您是否只是双击要安装的软件包,然后可以从终端使用它?还是我缺少一些额外的东西?谢谢!
    【解决方案4】:

    您是否真的在 10.7 上安装了 Xcode 4.1?从 App Store 下载是不够的;你必须手动运行它下载到/Applications的安装程序。

    【讨论】:

    • 查看我的编辑,Xcode 现在已安装,但这并没有解决问题。
    【解决方案5】:

    用于在 mac 上安装 GDAL:

    brew install gdal

    然后

    pip install gdal

    帮我解决了这个问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-30
      • 2011-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-01
      • 1970-01-01
      • 2012-02-22
      相关资源
      最近更新 更多