[Qgis-developer] problems building c++ qgis plugin and/or qgis
William Kyngesburye
woklist at kyngchaos.com
Thu Aug 16 06:34:54 PDT 2012
On Aug 16, 2012, at 7:23 AM, Tasos Varoudis wrote:
> I end up getting this: (of course with the 'hacked' lib folder)
> ##########################
> g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.6 -single_module -dynamiclib -compatibility_version 1.0 -current_version 1.0.0 -install_name libMyQGISDemoPlugin.dylib.1 -o libMyQGISDemoPlugin.dylib.1.0.0 qgspointconverterplugin.o qgspointconverterplugin.o moc_qgspointconverterplugin.o -F/Library/Frameworks -L/Library/Frameworks -L//Users/varoudis/Desktop/Projects/Quantum-GIS/lib -lqgis_core -lqgis_gui -framework Qt3Support -framework QtXml -framework QtGui -framework QtCore
> Undefined symbols for architecture x86_64:
> "QgsFeature::QgsFeature(long long, QString)", referenced from:
> QgsPointConverterPlugin::convertToPoint() in qgspointconverterplugin.o
> QgsPointConverterPlugin::convertToPoint() in qgspointconverterplugin.o
> ld: symbol(s) not found for architecture x86_64
> collect2: ld returned 1 exit status
> make: *** [libMyQGISDemoPlugin.dylib.1.0.0] Error 1
> make: Leaving directory `/Users/varoudis/Dropbox/Git/Other/MyQGISDemoPlugin/MyQGISDemoPlugin-build-desktop-Qt_4_8_2_in_PATH__System__Debug'
> 12:48:06: The process "/usr/bin/make" exited with code 2.
> Error while building/deploying project MyQGISDemoPlugin (target: Desktop)
> When executing step 'Make'
> ##########################
>
> I tried to do all the lame hacks because I have tried to build Qgis from source in both MACOSX10.8 and Ubuntu12.04 with no luck!
> Im not sure if I do something wrong. Im not that inexperienced in *nix systems...
>
>
> MacOSX 10.8 with homebrew:
> grass building is a problem…
> geos is there:
> brew -v info geos
> Homebrew 0.9.2
> geos: stable 3.3.5
> http://trac.osgeo.org/geos
> /usr/local/Cellar/geos/3.3.5 (367 files, 8.8M) *
> https://github.com/mxcl/homebrew/commits/master/Library/Formula/geos.rb
>
> #############
> bart150-115:Quantum-GIS varoudis$ cmake .
> -- Quantum GIS version: 1.9.0 Master (10900)
> -- Could not find GRASS
> -- Found Iconv: /usr/lib/libiconv.dylib
> -- Found Proj: /Library/Frameworks/PROJ.framework
> CMake Error at cmake/FindGEOS.cmake:60 (MESSAGE):
> Could not determine GEOS version from framework.
> Call Stack (most recent call first):
> CMakeLists.txt:148 (FIND_PACKAGE)
>
> -- Configuring incomplete, errors occurred!
> bart150-115:Quantum-GIS varoudis$
> #########
>
For OS X, if you want cmake to find your Homebrew libraries instead of the standard frameworks, you need to add to your cmake command:
-D CMAKE_FIND_FRAMEWORK=LAST
BUT, there is a bug in cmake currently that this setting is completely ignored. You will have to either apply the patch mentioned in the bug report to your cmake source and recompile cmake, or install cmake from dev sources.
http://public.kitware.com/Bug/view.php?id=13261
Also, for building external plugins for QGIS on OS X, QGIS libs are frameworks, so you can't link your plugin with the -l flags, that's why you're getting linking errors. But the QGIS frameworks bundled in the app aren't suitable for linking, so you need to tell cmake to install dev frameworks with:
-D QGIS_MACAPP_INSTALL_DEV=TRUE
These will install in /Library/Frameworks, so all you need to do for your plugin is link with:
-framework qgis_core -framework qgis_gui
You don't need '-L//Users/varoudis/Desktop/Projects/Quantum-GIS/lib' (assuming you extracted them from the app to there).
-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/
The equator is so long, it could encircle the earth completely once.
More information about the Qgis-developer
mailing list