When I run a simple test script from within R:
system("sh test.scr, intern=TRUE")
where test.scr is:
I get an error:
/home/alobo/OTB-6.6.1-Linux64/bin/otbApplicationLauncherCommandLine: symbol lookup error: /usr/lib/x86_64-linux-gnu/libotbossimplugins-6.6.so.1: undefined symbol: _ZThn16_NK15ossimProjection5printERSo
If checked that the 1st line of the script works and that the PATH gets actually set.
The same script works from the linux terminal
Also, this used to work with 6.6.0 (actually had problems until I introduced the 1st line in the script)
/usr/lib/x86_64-linux-gnu/libotbossimplugins-6.6.so.1 come from?
Also You need to make sure that if you have a LD_LIBRARY_PATH it includes the correct lib from the correct version of OTB. If you do not have this variable set it should take the correct path.
no idea where /usr/lib/x86_64-linux-gnu/libotbossimplugins-6.6.so.1 comes from, how could I check it?
I thought all requirements were included in the OTB-6.6.1-Linux64.run file
I do not have LD_LIBRARY_PATH set to anything, but note that otbcli apps (and the mentioned script)
work fine from the linux terminal:
alobo@Delia:~/OTB-6.6.1-Linux64$ . otbenv.profile
alobo@Delia:~/OTB-6.6.1-Linux64$ echo $LD_LIBRARY_PATH
Usage: /home/alobo/OTB-6.6.1-Linux64/bin/otbApplicationLauncherCommandLine module_name [MODULEPATH] [arguments]
In any case, to what should I set LD_LIBRARY_PATH ?
You should not set LD_LIBRARY_PATH, it is not needed by otb, and can lead to error.
My idea on this is that you already tried to install otb (I do not know how, and what version) and that this libotbossimplugins is coming from that. The environment of R and bash is certainly different. That is why I was asking for a LD_LIBRARY_PATH.
If you are sure to use only 6.6.1 version you can safely delete all the lib coming from otb in the /usr/lib/x86_64-linux-gnu/ but I suspect that this is coming from a packages installation, so be careful if you have other stuff build on that.
But /usr/lib/x86_64-linux-gnu/libotbossimplugins-6.6.so.1 is an otb thing, isn’t it?
No other package would install it or use it.
Anyway, I’ve moved libotb* and libOTB* to a directory named libOTBresiduals just in case
and now the script works from within R too!
I have a linux terminal in R now (the same environment as used by R command system())) so I’ve been able to check there that
$ echo LD_LIBRARY_PATH
Do not understand why, probably R sets that environment.
Yes it is.
Maybe you installed otb from a package manager and that is why you have stuff here. You may also have otb executables under /usr/bin but the otbenv takes care of that as it is linked to the PATH variable.