[Qgis-developer] GRASS Direct

Larry Shaffer larrys at dakotacarto.com
Mon Dec 10 14:12:58 PST 2012


Hi Radim,

On Mon, Dec 10, 2012 at 2:32 PM, Radim Blazek <radim.blazek at gmail.com> wrote:
> On Mon, Dec 10, 2012 at 10:08 PM, Larry Shaffer <larrys at dakotacarto.com> wrote:
>> On Mon, Dec 10, 2012 at 1:53 PM, John C. Tull <jctull at gmail.com> wrote:
>>> I wanted to bring my comment I made elsewhere on my Mac testing into this, more appropriate thread:
>>>
>>> I just tested one of the available modules on a local DEM file, and here is there error message that appeared when I ran it:
>>>
>>> Cannot start module r.slope.aspect
>>> command: /usr/local/Cellar/grass/6.4.2/grass-6.4.2/bin/r.slope.aspect --interface-description
>>>
>>> ERROR: GISRC - variable not set
>>>
>>> Note that I am running a version of grass installed locally, not from the application that William makes available.
>
>> Getting the same thing as John here, but with Kyngchaos.com GRASS.
>> When using the Kyngchaos.com GRASS, the app starts via an internal
>> shell script that configures most of those GRASS env variables [0].
>
> What is the 'app' in this context? GRASS, QGIS or a single GRASS
> module? Which variables are set by the script?

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

> As I wrote, there was missing DYLD_LIBRARY_PATH on Mac, please try
> also with current master.

Getting compile errors. I think you need to use (works for me):

#elif defined(Q_OS_MAC)

instead of:

#elif Q_OS_MAC

I think because Q_OS_MAC is a macro. Again, since DYLD_LIBRARY_PATH is
not passed to QGIS.app a launch from terminal session is needed to
test.

Larry

> Radim


More information about the Qgis-developer mailing list