Welcome, Guest
Username Password: Remember me

Compiling sample code
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Compiling sample code

Compiling sample code 8 years, 7 months ago #102

hello,

I have problems compiling with g++ your example code in /reetiDevel/Samples/Urbi/StandAloneCPP/:
-- I've created an executable file compiler.sh from HOWTO_Without_CMake file in this directory:
compiler.sh ==
--->
#Pour compiler sans utiliser cmake :
LD_LIBRARY_PATH=/usr/local/gostai/lib:$LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH
export LD_LIBRARY_PATH
sudo ldconfig
g++ StandAloneCPP.cpp -L/usr/local/gostai/lib -lboost_filesystem-gcc44-mt-1_38 -lboost_signals-gcc44-mt-1_38 -lboost_system-gcc44-mt-1_38 -lboost_thread-gcc44-mt-1_38 -I/usr/local/gostai/include/ -ljpeg4urbi -lpthread -lurbi -lport -o test
ldd test
echo "---- apres ldd test ------"
./test

---> its execution trace:
reeti@reeti:~/reetiDevel/Samples/Urbi/StandAloneCPP$ ./compiler.sh
/usr/local/gostai/lib:
linux-gate.so.1 => (0x00de4000)
libboost_system-gcc44-mt-1_38.so.1.38.0 => /usr/local/gostai/lib/libboost_system-gcc44-mt-1_38.so.1.38.0 (0x00b98000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x001bc000)
liburbi.so => /usr/local/gostai/lib/liburbi.so (0x007e5000)
libport.so => /usr/local/gostai/lib/libport.so (0x003fc000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0x00904000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0x00110000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x009ef000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0x0012e000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x00d12000)
/lib/ld-linux.so.2 (0x00376000)
libboost_filesystem-gcc44-mt-1_38.so.1.38.0 => /usr/local/gostai/lib/libboost_filesystem-gcc44-mt-1_38.so.1.38.0 (0x00137000)
libboost_signals-gcc44-mt-1_38.so.1.38.0 => /usr/local/gostai/lib/libboost_signals-gcc44-mt-1_38.so.1.38.0 (0x00f9f000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x0021b000)
libboost_thread-gcc44-mt-1_38.so.1.38.0 => /usr/local/gostai/lib/libboost_thread-gcc44-mt-1_38.so.1.38.0 (0x00fd5000)
libjpeg4urbi.so => /usr/local/gostai/lib/libjpeg4urbi.so (0x00c49000)
---- apres ldd test ------
usage : ./test <IP>

---> executing test trace:
reeti@reeti:~/reetiDevel/Samples/Urbi/StandAloneCPP$ ./test
./test: error while loading shared libraries: libboost_system-gcc44-mt-1_38.so.1.38.0: cannot open shared object file: No such file or directory

---> check on referenced boost libraries: seems OK!:
reeti@reeti:~/reetiDevel/Samples/Urbi/StandAloneCPP$ ll /usr/local/gostai/lib/*boost*:
...
lrwxrwxrwx 1 reeti reeti 43 2011-10-27 17:51 /usr/local/gostai/lib/libboost_filesystem-gcc44-mt-1_38.so -> libboost_filesystem-gcc44-mt-1_38.so.1.38.0
-rw-r--r-- 1 reeti reeti 97004 2011-01-06 14:13 /usr/local/gostai/lib/libboost_filesystem-gcc44-mt-1_38.so.1.38.0
...
lrwxrwxrwx 1 reeti reeti 40 2011-10-27 17:51 /usr/local/gostai/lib/libboost_signals-gcc44-mt-1_38.so -> libboost_signals-gcc44-mt-1_38.so.1.38.0
-rw-r--r-- 1 reeti reeti 75740 2011-01-06 14:14 /usr/local/gostai/lib/libboost_signals-gcc44-mt-1_38.so.1.38.0
...
lrwxrwxrwx 1 reeti reeti 39 2011-10-27 17:51 /usr/local/gostai/lib/libboost_system-gcc44-mt-1_38.so -> libboost_system-gcc44-mt-1_38.so.1.38.0
-rw-r--r-- 1 reeti reeti 13888 2011-01-06 14:13 /usr/local/gostai/lib/libboost_system-gcc44-mt-1_38.so.1.38.0
...
lrwxrwxrwx 1 reeti reeti 39 2011-10-27 17:51 /usr/local/gostai/lib/libboost_thread-gcc44-mt-1_38.so -> libboost_thread-gcc44-mt-1_38.so.1.38.0
-rw-r--r-- 1 reeti reeti 83944 2011-01-06 14:14 /usr/local/gostai/lib/libboost_thread-gcc44-mt-1_38.so.1.38.0
...

I just don't get it..!

PS: I am working with the Reeti SN:12062011 which is currently in the GIPSA lab in Grenoble (Michele.Rombaut@gipsa-lab.inpg.fr).
Note I have other problems with this machine but I am not sure if the Forum is a suitable place for them (let me know, please).

Re: Compiling sample code 8 years, 7 months ago #103

The problem is that you execute the LD_LIBRARY_PATH instructions in a bash script. So the export is valid only in the scope of execution of the bash, and it is lost at the end of the bash.
What we need is to export it for the all life of the console.
To confirm the diagnostix, if you execute "ldd test" in line after you run your bash script, it won't have the same output. Boost link will be unresolved.

3 solutions should address your problem :

Sol 1 : execute the 3 first line outside of the bash (in comman line). To make it shorter you can just do it in one line as follow :
export LD_LIBRARY_PATH=/usr/local/gostai/lib:$LD_LIBRARY_PATH

Sol 2 : in your bash script change line 1 with
LD_LIBRARY_PATH=/usr/local/gostai/lib:$LD_LIBRARY_PATH ./test

Sol 3 : add the export line in your .bashrc
export LD_LIBRARY_PATH=/usr/local/gostai/lib:$LD_LIBRARY_PATH



For other problems with your Reeti, if the problem could be of public interest, just do a separate post. If it is a very specific problem or a damage, send me an email on contact[at]robopec.com

Re: Compiling sample code 8 years, 7 months ago #104

OK , I got it! Thanks!

In fact, I AM aware that LD_LIBRARY_PATH is only valid within the scope of the script,but I overlooked the fact that ./test needs an argument and therefore
could not be executed within the script...

My further suggestions:
-- I guess you should update the instructions within the file 'HOWTO_Without_CMake' (in reetiDevel\Samples\Urbi\StandAloneCPP).
-- Also note that the code given in file StandAloneCPP.cpp (the one demanding an arg on exec) is different from the code given page 14 of the documentation 03-Documentation Générale Reeti.pdf (which doesn't need an arg).
  • Page:
  • 1
Time to create page: 0.18 seconds