Thanks Guillaume. I think I have "environment problems"!!

1. Outside R
Whenever I start a shell (Xfce Terminal) I get
bash: LD_LIBRARY_PATH: command not found
(do not know why and do not know if it matters)

Then I do
alobo@Delia:~$ echo $OTB_APPLICATION_PATH

alobo@Delia:~$ echo $LD_LIBRARY_PATH
:/usr/local/lib/otb

All otbcli work:
alobo@Delia:~$ otbcli
Usage: /usr/bin/otbApplicationLauncherCommandLine module_name
[MODULEPATH] [arguments]

But
alobo@Delia:~$ which otbcli
/usr/bin/otbcli

And BandMathX does not work:
alobo@Delia:~$ BandMathX
bash: BandMathX: command not found

BandMathX works if I use the path:
alobo@Delia:~$ /home/alobo/OTB-6.6.0-Linux64/bin/otbcli_BandMathX
ERROR: Waiting for at least one parameter.
etc

Then I do
alobo@Delia:~$ source /home/alobo/OTB-6.6.0-Linux64/otbenv.profile
alobo@Delia:~$ echo $OTB_APPLICATION_PATH
/home/alobo/OTB-6.6.0-Linux64/lib/otb/applications
alobo@Delia:~$ echo $LD_LIBRARY_PATH
:/usr/local/lib/otb

Which sets the path for the new version
alobo@Delia:~$ which otbcli
/home/alobo/OTB-6.6.0-Linux64/bin/otbcli
alobo@Delia:~$ which otbcli_BandMathX
/home/alobo/OTB-6.6.0-Linux64/bin/otbcli_BandMathX

2. Given test.scr
source /home/alobo/OTB-6.6.0-Linux64/otbenv.profile
echo $OTB_APPLICATION_PATH
echo $LD_LIBRARY_PATH
otbcli
/home/alobo/OTB-6.6.0-Linux64/bin/otbcli_BandMathX

Running from within R with system("sh /home/alobo/test.scr") I get:

/home/alobo/test.scr: 1: /home/alobo/test.scr: source: not found
Usage: /usr/bin/otbApplicationLauncherCommandLine module_name
[MODULEPATH] [arguments]
/home/alobo/OTB-6.6.0-Linux64/bin/otbApplicationLauncherCommandLine:
symbol lookup error: /usr/lib/x86_64-linux-gnu/libOTBCommon-6.6.so.1:
undefined symbol:
_ZN3itk10LoggerBase5WriteENS0_17PriorityLevelTypeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Error in system("sh /home/alobo/test.scr", intern = TRUE) :
  error in running command

So, from within R, otbcli commands work,
/home/alobo/OTB-6.6.0-Linux64/bin/otbcli_BandMathX  does not work
source is unknown (!!!??)

I think I have found a clue, because
/home/alobo/OTB-6.6.0-Linux64/bin/otbcli
does not work either from within R (same error as otbcli_BandMathX)
so the otbcli that is run from within R is a different one.

Running an script with
echo $OTB_APPLICATION_PATH
echo $LD_LIBRARY_PATH
which otbcli

from within R results in:
[1] ""
[2] 
"/usr/lib/R/lib::/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server"
[3] "/usr/bin/otbcli"

Which means I have an older otbcli that is the one actually working
from within R (but otbcli_BandMatX did not exist yet),
and I have a problem for running the new version OTB-6.6.0-Linux64
from within R because I cannot source otbenv.profile
from within R, but why???

Any help appreciated...
Agus

On Wed, Dec 19, 2018 at 6:00 PM PASERO Guillaume
<[email protected]> wrote:
>
> Hi,
>
> I would say it is a conflict between your standalone package
> '/home/alobo/OTB-6.6.0-Linux64' and your system OTB libs
> '/usr/lib/x86_64-linux-gnu/libOTBCommon-6.6.so.1'.
>
> Maybe add some prints in the ./tmp/test.scr script to check the
> content of variables like OTB_APPLICATION_PATH, LD_LIBRARY_PATH, just
> before calling otbcli_BandMathX
>
> Regards,
> Guillaume
>
> Quoting Agustin Lobo <[email protected]>:
>
> > In order to run otbcli* commands from within R, I normally use the R
> > system() command that let run any system command as if it were on the
> > terminal.
> >
> > For otbcli_BandMathX I have a problem. I write from within R a simple
> > text file with the following script (as ./tmp/test.scr)
> >
> > source /home/alobo/OTB-6.6.0-Linux64/otbenv.profile
> > /home/alobo/OTB-6.6.0-Linux64/bin/otbcli_BandMathX -il ima1.tif
> > ima2.tif -out result.tif -exp 'im1 div im2'
> >
> > and then try to execute with
> > system("sh ./tmp/test.scr")
> >
> > But surprisingly I get a weird error:
> >
> > /home/alobo/OTB-6.6.0-Linux64/bin/otbApplicationLauncherCommandLine:
> > symbol lookup error: /usr/lib/x86_64-linux-gnu/libOTBCommon-6.6.so.1:
> > undefined symbol:
> > _ZN3itk10LoggerBase5WriteENS0_17PriorityLevelTypeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
> >
> > I can run
> > sh ./tmp/test.scr
> > on the terminal with no problems.
> >
> > Does this error mean anything to you?
> > I'm not trying that you solve an R problem, but I guess this is rather
> > a problem with otbcli_BandMathX, because the same approach works for
> > the rest of otbcli* commands.
> >
> > Agus
> >
> > --
> > --
> > Check the OTB FAQ at
> > http://www.orfeo-toolbox.org/FAQ.html
> >
> > You received this message because you are subscribed to the Google
> > Groups "otb-users" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> > http://groups.google.com/group/otb-users?hl=en
> > ---
> > You received this message because you are subscribed to the Google
> > Groups "otb-users" group.
> > To unsubscribe from this group and stop receiving emails from it,
> > send an email to [email protected].
> > For more options, visit https://groups.google.com/d/optout.
>
>
> --
> --
> Check the OTB FAQ at
> http://www.orfeo-toolbox.org/FAQ.html
>
> You received this message because you are subscribed to the Google
> Groups "otb-users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/otb-users?hl=en
> ---
> You received this message because you are subscribed to the Google Groups 
> "otb-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
Check the OTB FAQ at
http://www.orfeo-toolbox.org/FAQ.html

You received this message because you are subscribed to the Google
Groups "otb-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/otb-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"otb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to