[Qgis-developer] Mac OS Build Architecture Setting?

William Kyngesburye woklist at kyngchaos.com
Fri Feb 17 09:30:40 EST 2012


On Feb 16, 2012, at 11:10 PM, Dan Dittmann wrote:

> I am now able to build QGIS. As far as I can tell, there were two issues affecting the build.
> 
> 2) The portion of the script FindGDAL.cmake script which verifies the GDAL version does not play nice with libraries which are not structured as OS X style frameworks (as is the case for many frameworks installed by MacPorts). To rectify this, I commented out lines 56 through 64 of the script ./cmake/FindGDAL.cmake. 
> 
> I suspect I maybe over simplifying or even overlooking something, but wouldn't it make more sense to attempt parsing the output from running
> gdal-config --version
> rather than grabbing it from a plist file?
> 
> 
> 
> === Lines 56 through 64 of ./cmake/FindGDAL.cmake ===
> 
> #          GET_VERSION_PLIST (${GDAL_LIBRARY}/Resources/Info.plist GDAL_VERSION)
> #          IF (NOT GDAL_VERSION)
> #            MESSAGE (FATAL_ERROR "Could not determine GDAL version from framework.")
> #          ENDIF (NOT GDAL_VERSION)
> #          STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}")
> #          STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
> #          IF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4)
> #            MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
> #          ENDIF (GDAL_VERSION_MAJOR LESS 1 OR GDAL_VERSION_MINOR LESS 4)
> 
> === ===


The QGIS findGDAL.cmake is designed to prefer the framework GDAL.  If it is present and you want to use a library GDAL (ie Macports), add to your cmake config:

-D CMAKE_FIND_FRAMEWORK=LAST

The only problem is that ALL frameworks (except Qt and system) will be skipped completely.

But your verbose compile still looks good:

> /usr/bin/c++   -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -bundle -Wl,-headerpad_max_install_names   -o ../../../PlugIns/qgis/libogrprovider.so CMakeFiles/ogrprovider.dir/qgsogrprovider.cpp.o CMakeFiles/ogrprovider.dir/qgsogrdataitems.cpp.o CMakeFiles/ogrprovider.dir/moc_qgsogrprovider.cxx.o CMakeFiles/ogrprovider.dir/moc_qgsogrdataitems.cxx.o -L/Users/dandittmann/Desktop/qgis-Quantum-GIS/build/src/core -L/Users/dandittmann/Desktop/qgis-Quantum-GIS/build/src/gui ../../../output/lib/qgis_core.framework/Versions/1.9/qgis_core -framework CoreFoundation -framework IOKit /opt/local/lib/libQtXml.dylib /opt/local/lib/libQtCore.dylib /opt/local/lib/libQtGui.dylib /opt/local/lib/libQtNetwork.dylib /opt/local/lib/libQtSvg.dylib -framework PROJ -framework GEOS -framework GDAL -framework SQLite3 

From this, I don't see any way that it can accidentally find a different GDAL than intended.  Cmake is very explicit with linking to avoid accidental linking.

So it's still a mystery.  Probably something wierd in Macports.  Personally I don't care for Macports (or Fink), and my ultimate advice would be to uninstall it completely and follow the QGIS install instructions for compiling cmake and the other dependencies manually and installing the stock Qt.  But it's your choice...

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Oh, look, I seem to have fallen down a deep, dark hole.  Now what does that remind me of?  Ah, yes - life."

- Marvin




More information about the Qgis-developer mailing list