[Qgis-developer] GRASS Direct

Radim Blazek radim.blazek at gmail.com
Tue Dec 11 02:10:27 PST 2012


On Mon, Dec 10, 2012 at 11:12 PM, Larry Shaffer <larrys at dakotacarto.com> wrote:
> The GRASS-6.4.app, which is a bundled Mac app [0, Qt example] from
> Kyngchaos.com. But the same holds for the bundled QGIS.app: the Mac
> operating system, by default, does not pass in the full shell
> environment, as per a user's terminal profile, to a double-clicked
> bundled app. It only passes in a very basic env that does NOT even
> include /usr/local, PATH, DYLD_LIBRARY_PATH, etc. There are tricks to
> get around this, but my idea is to allow the user to set the env
> inside of the QGIS preferences (much better).
>
> The custom env setup in QGIS for Mac could offer a button to load in
> common env setups, like for Kyngchaos.com frameworks, etc.
>
> If a Mac user starts the bundled app's embedded binary (e.g.
> QGIS.app/Contents/MacOS/QGIS) from a terminal session, then the env is
> passed in, but this is NOT normal Mac usage, certainly not for a
> regular user.
>
> The Mac GRASS-6.4.app gets around these issues by first running a
> shell script to set up the env before launching the embedded binary
> [1]. So, when the user double-clicks GRASS-6.4.app everything is
> configured on launch. This could be the same with QGIS (for Mac
> users), but in a custom way, allowing the user to configure their env
> in the QGIS app preferences (would require QGIS restart after a
> change). This could be similar to what's done in QtDesigner [2]. Then,
> all components of QGIS would benefit from a custom inherited env
> setup, at least for Mac users, and all done from within the GUI (user
> friendly).
>
> [0] http://doc.qt.digia.com/qt/deployment-mac.html
> [1] https://dl.dropbox.com/u/4058089/qgis/grass.sh
> [2] https://dl.dropbox.com/u/4058089/qgis/env-vars_like-in-qtcreator.png

It is not necessary to set DYLD_LIBRARY_PATH before QGIS is started to
run GRASS modules because GRASS modules are executed as new processes
and it is enough to set DYLD_LIBRARY_PATH when the process is started.
I am not sure however where the GRASS libs are located. I see the
libraries in

  GRASS-6.4.pkg/Contents/GRASS-6.4.app/Contents/MacOS/lib

but the grass.sh [0] is setting DYLD_LIBRARY_PATH to

  $HOME/Library/GRASS/Modules/lib:/Library/GRASS/6.4/Modules/lib

Where is pointing the cmake GRASS_PREFIX? To the
GRASS-6.4.app/Contents/MacOS? Can we get the path to GRASS libs as
${GRASS_PREFIX}/lib?

However, to get the QGIS GRASS plugin fully working (display and edit
GRASS maps, manage region), it is necessary to set the environment
before QGIS is started as you suggested.

> Getting compile errors. I think you need to use (works for me):
>
> #elif defined(Q_OS_MAC)

Thanks.

Radim


More information about the Qgis-developer mailing list