15

我正在尝试使用以下方法在 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
4

5 回答 5

22

自制对我来说很好用。要使用 Homebrew 安装 GDAL 1.9,您所要做的就是

      brew install gdal

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

于 2012-10-16T18:51:50.173 回答
5

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

于 2011-08-02T18:32:56.637 回答
5

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

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

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

于 2011-08-02T20:53:21.173 回答
3

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

port install gdal

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

于 2012-05-09T15:14:44.917 回答
0

在 mac 上安装 GDAL:

brew install gdal

进而

pip install gdal

为我解决了这个问题

于 2020-09-08T17:41:37.077 回答