I am on Ubuntu building QGIS with GRASS plugin. I have build GRASS code separately and used --prefix to provide the path
GRASS_PREFIX
is /usr/local/grass-6.4.2
and GRASS_INCLUDE_DIR
is /usr/local/grass-6.4.2/include
and LIB_PATH
is /usr/local/grass-6.4.2/lib/libgrass_gproj.so
. I have unchecked WITH_GRASS
When I compile QGIS I get the following
[ 0%] Built target version
[ 17%] Built target qgis_core
[ 19%] Built target qgis_analysis
[ 19%] Built target qgis_networkanalysis
[ 27%] Built target ui
[ 40%] Built target qgis_gui
[ 40%] Built target memoryprovider
[ 41%] Built target delimitedtextprovider
[ 42%] Built target osmprovider
[ 43%] Built target qgissqlanyconnection
[ 44%] Built target sqlanywhereprovider
[ 44%] Built target gdalprovider
[ 45%] Built target mssqlprovider
[ 47%] Built target postgresprovider
[ 48%] Built target spatialiteprovider
[ 48%] Built target crssync
[ 73%] Built target qgis
[ 75%] Built target diagramoverlay
[ 76%] Built target interpolationplugin
[ 76%] Built target dxf2shpconverterplugin
[ 77%] Built target spatialqueryplugin
[ 78%] Built target sqlanywhereplugin
[ 79%] Built target roadgraphplugin
[ 80%] Built target zonalstatisticsplugin
Linking CXX shared module ../../../output/lib/qgis/plugins/libgrassplugin.so
/usr/bin/ld: cannot find -lqgisgrass
collect2: ld returned 1 exit status
make[2]: *** [output/lib/qgis/plugins/libgrassplugin.so] Error 1
make[1]: *** [src/plugins/grass/CMakeFiles/grassplugin.dir/all] Error 2
make: *** [all] Error 2
What am I missing?
I solved it. I can see the GRASS plugin in QGIS but the plugin is not able to find the GRASS utilities.
Then I tried to build using WITH_GRASS = yes
; to link the grassplugin to grass, then I get the following. I think it says there is a build directory issue.
How do I fix it?
Found GRASS: /usr/lib/grass64 (6.4.2)
Touch support disabled
Found Proj: /usr/lib/libproj.so
Found GEOS: /usr/lib/libgeos_c.so
Found GDAL: /usr/lib/libgdal.so (1.9.1)
Found Expat: /usr/lib/x86_64-linux-gnu/libexpat.so
Found Spatialindex: /usr/lib/libspatialindex.so
Found Qwt: /usr/lib/libqwt-qt4.so (5.2.2)
Found Sqlite3: /usr/lib/x86_64-linux-gnu/libsqlite3.so
Found SpatiaLite: /usr/lib/libspatialite.so
Pedantic compiler settings enabled
Debug output enabled
Found Python executable: /usr/bin/python
Found Python version: 2.7.3
Found Python library: /usr/lib/libpython2.7.so
Found SIP version: 4.13.2
Found PyQt4 version: 4.9.1
CMake Error at src/plugins/grass/CMakeLists.txt:116 (ADD_LIBRARY):
add_library cannot create target "grassplugin" because another target with
the same name already exists. The existing target is a module library
created in source directory
"/home/develop1/QGIS_Develop/qgis-1.8.0/src/plugins/grass". See
documentation for policy CMP0002 for more details.
CMake Error at src/plugins/grass/CMakeLists.txt:140 (TARGET_LINK_LIBRARIES):
Attempt to add link library "qgisgrass" to target "grassplugin" which is
not built in this directory.
CMake Error at src/plugins/grass/CMakeLists.txt:140 (TARGET_LINK_LIBRARIES):
Attempt to add link library "qgis_gui" to target "grassplugin" which is not
built in this directory.
CMake Error at src/plugins/grass/CMakeLists.txt:140 (TARGET_LINK_LIBRARIES):
Attempt to add link library "util" to target "grassplugin" which is not
built in this directory.
CMake Error at src/plugins/grass/CMakeLists.txt:150 (ADD_EXECUTABLE):
add_executable cannot create target "qgis.g.browser" because another target
with the same name already exists. The existing target is an executable
created in source directory
"/home/develop1/QGIS_Develop/qgis-1.8.0/src/plugins/grass". See
documentation for policy CMP0002 for more details.
CMake Error at src/plugins/grass/CMakeLists.txt:152 (TARGET_LINK_LIBRARIES):
Attempt to add link library "/usr/lib/x86_64-linux-gnu/libQtGui.so" to
target "qgis.g.browser" which is not built in this directory.
CMake Error at src/plugins/grass/CMakeLists.txt:152 (TARGET_LINK_LIBRARIES):
Attempt to add link library "/usr/lib/x86_64-linux-gnu/libQtCore.so" to
target "qgis.g.browser" which is not built in this directory.
CMake Error at src/plugins/grass/CMakeLists.txt:160 (INSTALL):
install TARGETS given target "grassplugin" which does not exist in this
directory.
CMake Error at src/plugins/grass/CMakeLists.txt:172 (INSTALL):
install TARGETS given target "qgis.g.browser" which does not exist in this
directory.
2 Answers 2
Unless you have a special reason (you are customizing the code for instance), you should use the UbuntuGIS repository.
The 10.04 LTS Lucid repository section is loaded with stable GIS tools including QGIS, GRASS, GDAL 1.9.2, Spatialite and PostGIS. The 12.04 LTS Precise section has nearly as much available and prebuilt, ready to run. More information is available at UbuntuGIS page in Ubuntu Wiki
Someone else may be able to answer your compiling/building questions.
To compile Quantum GIS from source, including access to GRASS-GIS' (version 6.4) modules, a working GRASS-GIS installation is required. GRASS-GIS can be installed within Ubuntu in various ways, for example
- by using pre-compiled binaries from the UbuntuGIS repository (details to be found in Ubuntu's respective UbuntuGIS wiki-page)
- by compiling every dependency and GRASS-GIS itself from their sources (step-by-step documentation in the Ubuntu dedicated GRASS-wiki page)
Note, most likely an appropriate entry in the /etc/ld.so.conf
file (or in a dedicated file inside ld.so.conf.d/
directory, customarily named with an .conf
extension) will be necessary so a runnning QuantumGIS can detect the QGIS-GRASS plugin libqgisgrass.so
. The entry might be like /geo/osgeo/src/grass64_release/dist.x86_64-unknown-linux-gnu/lib
or similar -- it should point to GRASS librairies!
Having GRASS-GIS running on a system, QGIS can be compiled from source as documented in the INSTALL file included in QGIS' source code repository. In short, given that pre-required build tools and package dependencies are installed and functional, the steps are:
- getting the latest source code, using for example git
git clone git://github.com/qgis/Quantum-GIS.git
- or downloading a compressed package of the latest stable version (as of this answer's date 1.8) using
wget
and decompress it
wget http://qgis.org/downloads/qgis-1.8.0.tar.bz2
tar xvzf qgis_1.1.0.tar.gz
- enter (or create inside the QGIS source code directory) the directory where the compilation will take place and run the
ccmake
configuration tool
cd QuantumGIS
mkdir build
cd build
ccmake ..
At this point, don't forget to define the GRASS_PREFIX
parameter, i.e. set it to the directory that holds GRASS-GIS' in your system (might be /usr/lib/grass64
or even /some/directory/grass64_release/dist.x86_64-unknown-linux-gnu
in case you don't install GRASS-GIS system/user-wide)
Micha Silver recommends in a relevant blog-post, titled Compiling QGIS on Fedora 10, to check the configuration before compiling by instructing ccmake -L
. If no errors are encountered, go trough the actual compilation using make
(note, without sudo
). In case of errors (e.g. untraceable librairies) go through the respective manuals, fora and public mailiing lists. The installation can be completed then simply by executing sudo make install
.