Librairie dynamique - probleme avec les liens

Fermé
++ - 3 juin 2010 à 12:37
 ++ - 3 juin 2010 à 14:54
Bonjour,
Je dois pour mon projet utiliser une librairie open source C++ "poco" (http://www.poco-project.org/home.asp) afin de réaliser un client http en C++ pour une camera axis. Je cherche a executer un code tout simple donnée en exemple dans cette librairie mais je n'y arrive pas. Aucune erreur a la compilation mais lorsque je tente d'executer le programme :

./bin/httpget: error while loading shared libraries: libPocoFoundationd.so.9: cannot open shared object file: No such file or directory


Je me suis renseigné sur internet et j'ai verifié si les fichiers de liens symboliques étaient présents :

root@ubuntu-vaio:/usr/local/lib# ls -l
totale 36048
(...)
lrwxrwxrwx 1 root root       23 2010-06-03 11:41 libPocoFoundationd.so -> libPocoFoundationd.so.9
-rwxr-xr-x 1 root root  8370071 2010-06-03 11:41 libPocoFoundationd.so.9
lrwxrwxrwx 1 root root       22 2010-06-03 11:41 libPocoFoundation.so -> libPocoFoundation.so.9
-rwxr-xr-x 1 root root  1637232 2010-06-03 11:41 libPocoFoundation.so.9
lrwxrwxrwx 1 root root       16 2010-06-03 11:41 libPocoNetd.so -> libPocoNetd.so.9
-rwxr-xr-x 1 root root  5064451 2010-06-03 11:41 libPocoNetd.so.9
lrwxrwxrwx 1 root root       15 2010-06-03 11:41 libPocoNet.so -> libPocoNet.so.9
-rwxr-xr-x 1 root root   927132 2010-06-03 11:41 libPocoNet.so.9
lrwxrwxrwx 1 root root       17 2010-06-03 11:41 libPocoUtild.so -> libPocoUtild.so.9
-rwxr-xr-x 1 root root  2198258 2010-06-03 11:41 libPocoUtild.so.9
lrwxrwxrwx 1 root root       16 2010-06-03 11:41 libPocoUtil.so -> libPocoUtil.so.9
-rwxr-xr-x 1 root root   314532 2010-06-03 11:41 libPocoUtil.so.9
lrwxrwxrwx 1 root root       16 2010-06-03 11:41 libPocoXMLd.so -> libPocoXMLd.so.9
-rwxr-xr-x 1 root root  3223791 2010-06-03 11:41 libPocoXMLd.so.9
lrwxrwxrwx 1 root root       15 2010-06-03 11:41 libPocoXML.so -> libPocoXML.so.9
-rwxr-xr-x 1 root root   556392 2010-06-03 11:41 libPocoXML.so.9


Dans mon makefile je specifie bien les librairie a utiliser :
LDFLAGS=-lPocoFoundation -lPocoUtil -lPocoXML -lPocoNet

(...)
./bin/httpget: ./src/httpget.cpp
	-@$(CC) $(CPPFLAGS) $(CCFLAGS) $^ -o $@ $(LDFLAGS)


Je ne comprend pas d'ou viens l'erreur et comment la resoudre.

Merci d'avance pour votre aide !

4 réponses

dubcek Messages postés 18719 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 4 mai 2024 5 615
3 juin 2010 à 14:07
hello
que répond : ldd httpget
essaye d'exécuter avec:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
1
La commande ldd ./bin/httpget me renvoie :
mivia@ubuntu-vaio:~/Scrivania/cochet/Projet_Stage/httpget$ ldd ./bin/httpget 
	linux-gate.so.1 =>  (0x00a09000)
	libPocoFoundation.so.9 => /usr/local/lib/libPocoFoundation.so.9 (0x0046e000)
	libPocoUtil.so.9 => /usr/local/lib/libPocoUtil.so.9 (0x00b40000)
	libPocoXML.so.9 => /usr/local/lib/libPocoXML.so.9 (0x001c3000)
	libPocoNet.so.9 => /usr/local/lib/libPocoNet.so.9 (0x00634000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0024c000)
	libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x00110000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00c58000)
	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00784000)
	libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0x00184000)
	libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0x00b12000)
	librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0x001b1000)
	/lib/ld-linux.so.2 (0x00997000)


J'avoue ne pas y comprendre grand chose... Mais l'export de la variable LD_LIBRARY_PATH a bien marché ! Le programme fonctionne parfaitement merci !

Ce que je ne comprend pas puisque je pensais que le chemin "/usr/local/lib" était le chemin pas defaut. Cette commande est un peu contraignante pour mon application puisqu'il faut que je tape la ligne de commande à chaque nouvelle console. Y a t'il un moyen pour eviter ca ?

Merci beaucoup !
0
dubcek Messages postés 18719 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 4 mai 2024 5 615
3 juin 2010 à 14:38
la variable LD_LIBRARY_PATH contient la liste des répertoires pour chercher des librairies dynamiques, je pense que que le défaut est juste /lib et /usr/lib.
Ajouter la ligne export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib dans ~/.bashrc pour que la définition soit permanente
0
Parfait merci ;)
0