Bug report #13043

Custom GRASS location not found, wrong GRASS_PREFIX (6) used

Added by William Kyngesburye over 5 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Build/Install
Affected QGIS version:master Regression?:No
Operating System:OS X Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:21117

Description

This is a combination of an old issue and the recent split GRASS 6/7 build mechanism.

When configuring QGIS for GRASS 6 on OS X, I use a custom GRASS prefix for a custom build to bundle with the app. I also have the GRASS app installed. Configure uses the custom GRASS_PREFIX yet finds the app (one of the default search paths for GRASS) for the GRASS_INCLUDE_DIR, but this has not been a problem in the past because my app and custom builds were the same version so the app's includes worked. If I rename the GRASS app, FindGRASS does not find GRASS at all, even from my custom path.

The new wrinkle added by the split GRASS 6/7 configuring is that the GRASS plugin and provider cmakelists don't appear to use the right GRASS_PREFIX for GRASS 6. FindGRASS sets GRASS_PREFIX${GRASS_CACHE_VERSION} where GRASS_CACHE_VERSION is empty for G6 to keep the old variable name. But the ADD_GRASSLIB macros for the GRASS provider and plugin use the GRASS_BUILD_VERSION passed to them to get the GRASS_PREFIX${GRASS_BUILD_VERSION}, but GRASS_PREFIX6 is not set, it's GRASS_PREFIX. And the build fails because headers are not found. The workaround is to specify both GRASS_PREFIX and GRASS_PREFIX6.

History

#1 Updated by William Kyngesburye over 5 years ago

Ugh, and somehow it's still linking the GRASS.app libraries. So it's not using any prefix I set to find the GRASS libraries, but I can't check it since I don't see any GRASS_LIBRARY* variables in the cmakecache.

#2 Updated by Radim Blazek about 5 years ago

Sorry for the troubles. I have also GRASS 6 and 7 in custom paths and configure can find them, tested on Linux and Windows. I don't have GRASS package in standard path however. Can we start first fixing the problem when you remove GRASS app in standard path and you use the custom build only?

The GRASS_PREFIX6 is set in FindGRASS.cmake

          IF(GRASS_FIND_VERSION EQUAL 6)
            # Set also normal variable with number
            SET(GRASS_INCLUDE_DIR${GRASS_FIND_VERSION} ${GRASS_INCLUDE_DIR${GRASS_CACHE_VERSION}})
            SET(GRASS_PREFIX${GRASS_FIND_VERSION} ${G_PREFIX})
          ENDIF(GRASS_FIND_VERSION EQUAL 6)

so even if it is configured with GRASS_PREFIX (for GRASS 6), the GRASS_PREFIX6 variable should be available everywhere in cmake build system.

#3 Updated by William Kyngesburye about 5 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

Argh! I'm an idiot. Somehow my custom GRASS build lost its headers. Works now. Sorry for the noise. But I do need to fix the Mac bundling to account for the new GRASS build stuff.

Also available in: Atom PDF