我最近將OSX機器升級到了OSX El Capitan(1.11.6),並且遇到了編譯GDAL 1.11.x的問題。我已經試過1.11.4和1.11.5,我得到了同樣的結果。由於libiconv鏈接錯誤,無法在OSX 1.11.6上編譯GDAL
我們使用GDAL 1.11.x作爲我們其中一個項目的依賴項 - 現在我們無法更新到GDAL 2.x,因爲存在遺留軟件問題,這些問題被一些在GDAL中棄用的函數2.X ...
由於我的機器搬到酋長,GDAL 1.11.x失敗,出現以下鏈接錯誤信息來構建下來,對鏈接的最後一步:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C pdf
make[3]: Nothing to be done for `default'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make libgdal.la
/bin/sh /test/gdal-1.11.5/libtool --mode=link g++ -L/opt/local/lib -lgeos_c -lsqlite3 -lpthread -ldl -liconv -L/opt/local/lib -lxml2 -lz -lpthread -liconv -lm -o libgdal.la /test/gdal-1.11.5/frmts/o/*.lo /test/gdal-1.11.5/gcore/*.lo /test/gdal-1.11.5/port/*.lo /test/gdal-1.11.5/alg/*.lo /test/gdal-1.11.5/ogr/ogrsf_frmts/o/*.lo ./ogr/ogrgeometryfactory.lo ./ogr/ogrpoint.lo ./ogr/ogrcurve.lo ./ogr/ogrlinestring.lo ./ogr/ogrlinearring.lo ./ogr/ogrpolygon.lo ./ogr/ogrutils.lo ./ogr/ogrgeometry.lo ./ogr/ogrgeometrycollection.lo ./ogr/ogrmultipolygon.lo ./ogr/ogrsurface.lo ./ogr/ogrmultipoint.lo ./ogr/ogrmultilinestring.lo ./ogr/ogr_api.lo ./ogr/ogrfeature.lo ./ogr/ogrfeaturedefn.lo ./ogr/ogrfeaturequery.lo ./ogr/ogrfeaturestyle.lo ./ogr/ogrfielddefn.lo ./ogr/ogrspatialreference.lo ./ogr/ogr_srsnode.lo ./ogr/ogr_srs_proj4.lo ./ogr/ogr_fromepsg.lo ./ogr/ogrct.lo ./ogr/ogr_opt.lo ./ogr/ogr_srs_esri.lo ./ogr/ogr_srs_pci.lo ./ogr/ogr_srs_usgs.lo ./ogr/ogr_srs_dict.lo ./ogr/ogr_srs_panorama.lo ./ogr/ogr_srs_ozi.lo ./ogr/ogr_srs_erm.lo ./ogr/swq.lo ./ogr/swq_expr_node.lo ./ogr/swq_parser.lo ./ogr/swq_select.lo ./ogr/swq_op_registrar.lo ./ogr/swq_op_general.lo ./ogr/ogr_srs_validate.lo ./ogr/ogr_srs_xml.lo ./ogr/ograssemblepolygon.lo ./ogr/ogr2gmlgeometry.lo ./ogr/gml2ogrgeometry.lo ./ogr/ogr_expat.lo ./ogr/ogrpgeogeometry.lo ./ogr/ogrgeomediageometry.lo ./ogr/ogr_geocoding.lo ./ogr/osr_cs_wkt.lo ./ogr/osr_cs_wkt_parser.lo ./ogr/ogrgeomfielddefn.lo \
-rpath /usr/local/lib \
-no-undefined \
-version-info 19:5:18
libtool: link: g++ -dynamiclib -o .libs/libgdal.1.dylib <snipped out the rest of the gigantic link line/>
Undefined symbols for architecture x86_64:
"_iconv", referenced from:
CPLRecodeIconv(char const*, char const*, char const*) in cpl_recode_iconv.o
CPLRecodeFromWCharIconv(wchar_t const*, char const*, char const*) in cpl_recode_iconv.o
"_iconv_close", referenced from:
CPLRecodeIconv(char const*, char const*, char const*) in cpl_recode_iconv.o
CPLRecodeFromWCharIconv(wchar_t const*, char const*, char const*) in cpl_recode_iconv.o
"_iconv_open", referenced from:
CPLRecodeIconv(char const*, char const*, char const*) in cpl_recode_iconv.o
CPLRecodeFromWCharIconv(wchar_t const*, char const*, char const*) in cpl_recode_iconv.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libgdal.la] Error 1
make: *** [check-lib] Error 2
我做了minimal configuration根據我在GDAL網站上找到的文件:
$ ./configure --with-netcdf=no \
--with-jpeg=no \
--with-threads \
--with-ogr \
--with-geos \
--with-libz=internal \
--with-libtiff=internal \
--with-geotiff=internal \
--without-gif \
--without-pg \
--without-grass \
--without-libgrass \
--without-cfitsio \
--without-pcraster \
--without-png \
--without-gif \
--without-ogdi \
--without-fme \
--without-hdf4 \
--without-hdf5 \
--without-jasper \
--without-ecw \
--without-kakadu \
--without-mrsid \
--without-jp2mrsid \
--without-bsb \
--without-grib \
--without-mysql \
--without-ingres \
--without-xerces \
--without-expat \
--without-odbc \
--without-curl \
--without-dwgdirect \
--without-idb \
--without-sde \
--without-perl \
--without-php \
--without-ruby \
--with-hide-internal-symbols \
--disable-rpath
我使用的MacPorts和已安裝libiconv的...
$ sudo port install libiconv
---> Cleaning libiconv
---> Scanning binaries for linking errors
---> No broken files found.
的/ opt/local/lib目錄也是我LD_LIBRARY_PATH和DYLD_LIBRARY_PATH和我覈實,libiconv的是在/ opt/local/lib目錄以及:
> ll /opt/local/lib/*iconv*
lrwxr-xr-x 1 root admin 16B Jan 29 2016 /opt/local/lib/[email protected] -> libiconv.2.dylib
-rw-r--r-- 1 root admin 1.0M Jan 29 2016 /opt/local/lib/libiconv.a
-rw-r--r-- 1 root admin 1.0M Jan 29 2016 /opt/local/lib/libiconv.2.dylib
有沒有人跑過這樣的事情?有任何想法嗎?
你弄明白了嗎? – Michele