On Thu 20-Dec-2018 at 14:57:38 +01, Agustin Lobo <alobolis...@gmail.com> wrote: > Solved by following your advice! > After uninstalling all otb* items with synaptic, just starting the script with > . /home/alobo/OTB-6.6.0-Linux64/otbenv.profile > let otbcli* and otbcli_BandMathX work fine from within R >
I think you should ask for official R bindings for OTB. I will ask for Julia and Haskell ;) > Thanks! > > Agus > > On Thu, Dec 20, 2018 at 1:42 PM Jordi Inglada <jordi.ingl...@cesbio.eu> wrote: >> >> >> I think that the remaining problem comes from the fact that you have OTB >> libraries in /usr/lib/x86_64-linux-gnu/. This is why I suggest avoiding >> packages from the distribution. >> >> Your LD_LIBRARY_PATH contains /usr/lib/x86_64-linux-gnu/ and does not >> contain /home/alobo/OTB-6.6.0-Linux64/lib where the good library is located. >> >> The fact that the correct otbcli_* is found is misleading, because the >> command line applications are just wrappers for shared libs. >> >> On Thu 20-Dec-2018 at 13:02:13 +01, Agustin Lobo <alobolis...@gmail.com> >> wrote: >> > Thanks. >> > ok, I can solve the source problem, but not the main problem. If my >> > script is just >> > . /home/alobo/OTB-6.6.0-Linux64/otbenv.profile >> > echo $OTB_APPLICATION_PATH >> > echo $LD_LIBRARY_PATH >> > which otbcli >> > which otbcli_BandMathX >> > >> > I run from within R with system() and get: >> >> system("sh /home/alobo/test.scr", intern=TRUE) >> > [1] "/home/alobo/OTB-6.6.0-Linux64/lib/otb/applications" >> > [2] >> > "/usr/lib/R/lib::/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/lib/server" >> > [3] "/home/alobo/OTB-6.6.0-Linux64/bin/otbcli" >> > [4] "/home/alobo/OTB-6.6.0-Linux64/bin/otbcli_BandMathX" >> > >> > which is correct. >> > >> > But the poblem with otbcli_BandMathX remains. As soon as I add >> > otbcli_BandMathX >> > . /home/alobo/OTB-6.6.0-Linux64/otbenv.profile >> > echo $OTB_APPLICATION_PATH >> > echo $LD_LIBRARY_PATH >> > which otbcli >> > which otbcli_BandMathX >> > otbcli_BandMathX >> > >> > I get: >> > >> >> system("sh /home/alobo/test.scr", intern=TRUE) >> > /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 >> > >> > Same problem for otbcli commands (which are now >> > /home/alobo/OTB-6.6.0-Linux64/bin/otbcli) >> > >> > So, something else has to be set for these commands to work from >> > within R, both otbcli and otbcli_BandMathX run ok from the terminal. >> > What could be different between this version and the older one that >> > actually works from within R? >> > >> > Agus >> > >> > On Thu, Dec 20, 2018 at 11:37 AM Jordi Inglada <jordi.ingl...@cesbio.eu> >> > wrote: >> >> >> >> >> >> The problem you have when sourcing from R is that "source" is not a >> >> command, but a built-in bash function which may not be available. >> >> >> >> Try with '.' instead of source, or include the contents of the config >> >> script in your scr file. >> >> >> >> On Thu 20-Dec-2018 at 11:08:52 +01, Agustin Lobo <alobolis...@gmail.com> >> >> wrote: >> >> > 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 >> >> > <guillaume.pas...@c-s.fr> 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 <alobolis...@gmail.com>: >> >> >> >> >> >> > 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 otb-users@googlegroups.com >> >> >> > To unsubscribe from this group, send email to >> >> >> > otb-users+unsubscr...@googlegroups.com >> >> >> > 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 otb-users+unsubscr...@googlegroups.com. >> >> >> > 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 otb-users@googlegroups.com >> >> >> To unsubscribe from this group, send email to >> >> >> otb-users+unsubscr...@googlegroups.com >> >> >> 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 otb-users+unsubscr...@googlegroups.com. >> >> >> 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 otb-users@googlegroups.com >> >> To unsubscribe from this group, send email to >> >> otb-users+unsubscr...@googlegroups.com >> >> 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 otb-users+unsubscr...@googlegroups.com. >> >> 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 otb-users@googlegroups.com >> To unsubscribe from this group, send email to >> otb-users+unsubscr...@googlegroups.com >> 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 otb-users+unsubscr...@googlegroups.com. >> 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 otb-users@googlegroups.com To unsubscribe from this group, send email to otb-users+unsubscr...@googlegroups.com 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 otb-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.