[GRASS-stats] Initiation Error: "dyld: Library not loaded" (rgrass7)

Rainer M Krug Rainer at krugs.de
Fri Mar 6 00:22:27 PST 2015


Benjamin Holland <ben.holland at gmail.com> writes:

Hi Benjamin,

Please keep the discussion on the mailing list as others might benefit
From it.

> Thanks, Rainer. Did you install Grass 7 with homebrew. Or are you using
> 6.4?

Grass70, grass 64, R gdal, proj - everything via homebrew.

See https://github.com/OSGeo/homebrew-osgeo4mac tap for the formulas -
very useful tap!

>
> Just to clarify, you're saying that a command needs to be run within R that
> sets the library path? I ran the command line code mentioned earlier. Is
> there something additional to do in R?

The code I used in R is as follow:

--8<---------------cut here---------------start------------->8---
switch(
    Sys.info()[['sysname']],
    Windows = { print("I'm a Windows PC.") },
    Linux   = { print("I'm a Penguin.") },
    Darwin  = { print("I'm a Mac.");
                Sys.setenv( DYLD_LIBRARY_PATH = paste(
                                "/Applications/GRASS-7.0.app/Contents/MacOS/lib",
                                "/Users/rainerkrug/Library/GRASS/7.0/Modules/lib",
                                "/Library/GRASS/7.0/Modules/lib",
                                "/Applications/GRASS-7.0.app/Contents/MacOS/lib/FFTW3.framework/Versions/3",
                                ":DYLD_LIBRARY_PATH",
                                sep = ":"
                                )
                           )
            }
    )
--8<---------------cut here---------------end--------------->8---

This should be done before you start using grass from R. 

Please be aware that you might have to change some paths. 
Also, if you start R in grass, you don't need this as it is done by
GRASS GIS. It also depends which commands you are using in GRASS -
different some commands require additional paths.

The reason is that the frameworks are kind of isolated containers which
contain everything, including libraries. To avoid conflicts between
different installation (Frameworks or .app folders - they are in these
respect similar), they are not in the universal paths - which is also
the reason that they are not available easily as in Linux from the
terminal. SO programs have to set the paths so that they can find the
libraries in the frameworks.

Homebrew kind of avoids this and has a linux approach with all libraries
which are installed via homebrew are available globally as they are in
the path.

So as I see it, homebrew provides a more consistent environment for the
kind of work one is doing with R and grass.

Hope this helps,

Rainer

>
> Thanks,
>
> Ben
>
> On Thu, Mar 5, 2015 at 3:37 PM, Rainer M Krug <r.m.krug at gmail.com> wrote:
>
>>
>>
>> Envoyé de mon iPhone
>>
>> Le 5 mars 2015 à 20:57, Benjamin Holland <ben.holland at gmail.com> a écrit :
>>
>> Hi, Rainer,
>>
>> I downloaded and installed Grass 7.0 (stable) from here:
>> http://grassmac.wikidot.com/downloads
>>
>> Up until now, I've been using the Grass 7.0 GUI.
>>
>> I'm using R version 3.1.2Installed rgrass7 with this
>> command: install.packages("rgrass7", repos="http://R-Forge.R-project.org",
>> type="source")
>>
>> Here is the command I ran to initiate:
>>
>> initGRASS(gisBase ='/Applications/GRASS-7.0.app/Contents/MacOS',
>>
>>           location = 'test', mapset = 'test',
>>
>>           gisDbase = '/Users/benholland/grassdata', override = TRUE)
>>
>> The complete error message I received a few minutes ago:
>>
>> dyld: Library not loaded:
>> /Applications/GRASS/GRASS-7.0.app/Contents/MacOS/lib/libgrass_gis.7.0.0.dylib
>>
>>   Referenced from: /Applications/GRASS-7.0.app/Contents/MacOS/bin/g.gisenv
>>
>>   Reason: no suitable image found.  Did find:
>>
>> /Applications/GRASS/GRASS-7.0.app/Contents/MacOS/lib/libgrass_gis.7.0.0.dylib:
>> stat() failed with errno=13
>>
>>
>> When I open the Grass 7 GUI, there is a new location, so part of this code
>> is working. However, there is no mapset.
>>
>>
>> Thanks for the info.
>>
>> I remember having the same problem when using grass installed from the dmg
>> file. (I am now using homebrew). You have to set a library path from R so
>> that the libraries can be found. I can see if I can find the code tomorrow
>> afternoon.
>>
>> Cheers,
>>
>> Rainer
>>
>>
>>
>> Thanks,
>>
>> Ben
>>
>> On Thu, Mar 5, 2015 at 12:46 PM, Rainer M Krug <r.m.krug at gmail.com> wrote:
>>
>>>
>>>
>>> Envoyé de mon iPhone
>>>
>>> Le 5 mars 2015 à 19:39, Benjamin Holland <ben.holland at gmail.com> a
>>> écrit :
>>>
>>> Hi, all. After some research, I've seen that the dyld error is quite
>>> common. After successfully installing rgrass7 from source, I tried to
>>> initiate GRASS in R. This is my first time trying this, so I could be doing
>>> some things incorrectly. I'm running on OSX Yosemite.
>>>
>>>
>>> What is the exact error message?
>>> When do you get it?
>>> Which commands did you execute?
>>> How did you install grass, R, gdal, ... ?
>>> Which versions?
>>>
>>> More information is needed to provide any help.
>>>
>>> Cheers,
>>>
>>> Rainer
>>>
>>> I tried the troubleshooting suggestion on the grass wiki, but after
>>> establishing the link to /user/local/lib I'm still getting the same error.
>>> Does anyone have any suggestions?
>>>
>>> Thanks,
>>>
>>> Ben Holland
>>>
>>>
>>> _______________________________________________
>>> grass-stats mailing list
>>> grass-stats at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/grass-stats
>>>
>>>
>>

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer at krugs.de

Skype:      RMkrug

PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-stats/attachments/20150306/52df6dfe/attachment.pgp>


More information about the grass-stats mailing list