Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 29/12/2012, à 19:27

BjBoY

Bibliothèques non-trouvées (Code:Blocks)

Bonjour !

J'essaye de faire un programme sous code-blocks utilisant libusb mais j'ai l'erreur suivante au link :

/usr/local/lib/libusb-1.0.a(libusb_1_0_la-io.o)||In function `libusb_try_lock_events':|
/home/benjiboy/Bureau/libusb-1.0.9/libusb/io.c|1547|undefined reference to `pthread_mutex_trylock'|
/usr/local/lib/libusb-1.0.a(libusb_1_0_la-linux_usbfs.o)||In function `find_monotonic_clock':|
/home/benjiboy/Bureau/libusb-1.0.9/libusb/os/linux_usbfs.c|262|undefined reference to `clock_gettime'|
/usr/local/lib/libusb-1.0.a(libusb_1_0_la-linux_usbfs.o)||In function `op_clock_gettime':|
/home/benjiboy/Bureau/libusb-1.0.9/libusb/os/linux_usbfs.c|2379|undefined reference to `clock_gettime'|
/home/benjiboy/Bureau/libusb-1.0.9/libusb/os/linux_usbfs.c|2381|undefined reference to `clock_gettime'|
/usr/local/lib/libusb-1.0.a(libusb_1_0_la-threads_posix.o)||In function `usbi_mutex_init_recursive':|
/home/benjiboy/Bureau/libusb-1.0.9/libusb/os/threads_posix.c|44|undefined reference to `pthread_mutexattr_settype'|
/home/benjiboy/Bureau/libusb-1.0.9/libusb/os/threads_posix.c|39|undefined reference to `pthread_mutexattr_init'|
/home/benjiboy/Bureau/libusb-1.0.9/libusb/os/threads_posix.c|52|undefined reference to `pthread_mutexattr_destroy'|
||=== Build finished: 7 errors, 0 warnings ===|

Si j'essaye d'ajouter les options "-lrt" et "-lpthread" cela ne change rien, si par contre j'ajoute explicitement la bibliothèque /usr/lib/x86_64-linux-gnu/libpthread.a , j'ai les erreurs suivantes :

/usr/local/lib/libusb-1.0.a(libusb_1_0_la-linux_usbfs.o)||In function `find_monotonic_clock':|
/home/benjiboy/Bureau/libusb-1.0.9/libusb/os/linux_usbfs.c|262|undefined reference to `clock_gettime'|
/usr/local/lib/libusb-1.0.a(libusb_1_0_la-linux_usbfs.o)||In function `op_clock_gettime':|
/home/benjiboy/Bureau/libusb-1.0.9/libusb/os/linux_usbfs.c|2379|undefined reference to `clock_gettime'|
/home/benjiboy/Bureau/libusb-1.0.9/libusb/os/linux_usbfs.c|2381|undefined reference to `clock_gettime'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-write.o)||In function `__write_nocancel':|
/build/buildd/eglibc-2.15/nptl/../sysdeps/unix/syscall-template.S|82|undefined reference to `__syscall_error'|
/build/buildd/eglibc-2.15/nptl/../sysdeps/unix/syscall-template.S|82|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-read.o)||In function `__read_nocancel':|
/build/buildd/eglibc-2.15/nptl/../sysdeps/unix/syscall-template.S|82|undefined reference to `__syscall_error'|
/build/buildd/eglibc-2.15/nptl/../sysdeps/unix/syscall-template.S|82|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-close.o)||In function `__close_nocancel':|
/build/buildd/eglibc-2.15/nptl/../sysdeps/unix/syscall-template.S|82|undefined reference to `__syscall_error'|
/usr/lib/x86_64-linux-gnu/libpthread.a(ptw-close.o):/build/buildd/eglibc-2.15/nptl/../sysdeps/unix/syscall-template.S|82|more undefined references to `__syscall_error' follow|
/usr/lib/x86_64-linux-gnu/libpthread.a(nptl-init.o)||In function `__pthread_initialize_minimal_internal':|
/build/buildd/eglibc-2.15/nptl/nptl-init.c|296|undefined reference to `__libc_setup_tls'|
/build/buildd/eglibc-2.15/nptl/nptl-init.c|314|undefined reference to `_dl_cpuclock_offset'|
/build/buildd/eglibc-2.15/nptl/nptl-init.c|430|undefined reference to `_dl_pagesize'|
/build/buildd/eglibc-2.15/nptl/nptl-init.c|456|undefined reference to `_dl_init_static_tls'|
/build/buildd/eglibc-2.15/nptl/nptl-init.c|458|undefined reference to `_dl_wait_lookup_done'|
/usr/lib/x86_64-linux-gnu/libpthread.a(nptl-init.o)||In function `__pthread_get_minstack':|
/build/buildd/eglibc-2.15/nptl/nptl-init.c|479|undefined reference to `_dl_pagesize'|
/usr/lib/x86_64-linux-gnu/libpthread.a(pthread_create.o)||In function `allocate_stack':|
/build/buildd/eglibc-2.15/nptl/allocatestack.c|457|undefined reference to `_dl_stack_flags'|
/build/buildd/eglibc-2.15/nptl/allocatestack.c|596|undefined reference to `_dl_stack_flags'|
||=== Build finished: 17 errors, 0 warnings ===|

J'ai donc bien résolu les références à libpthread mais comment est_ce que je dois faire pour que les dépendances soient satisfaites ?

Dernière modification par BjBoY (Le 29/12/2012, à 19:29)

Hors ligne

#2 Le 30/12/2012, à 00:52

telliam

Re : Bibliothèques non-trouvées (Code:Blocks)

tu vx compiler en statique ou en dynamique?


"- Un intellectuel assis va moins loin qu'un con qui marche."
Maurice Biraud - Un Taxi pour Tobrouk
Michel Audiard

Hors ligne

#3 Le 30/12/2012, à 10:30

BjBoY

Re : Bibliothèques non-trouvées (Code:Blocks)

Bonjour !

telliam a écrit :

tu vx compiler en statique ou en dynamique?

Merci pour ta réponse !

J'étais plutôt parti pour le faire en statique mais c'est que ce n'est pas un gros impératif ...

Hors ligne

#4 Le 30/12/2012, à 10:41

telliam

Re : Bibliothèques non-trouvées (Code:Blocks)

je te le déconseille, ton exécutable va être énorme.
px tu donner la ligne de commande gcc générée par code:beurk ?


"- Un intellectuel assis va moins loin qu'un con qui marche."
Maurice Biraud - Un Taxi pour Tobrouk
Michel Audiard

Hors ligne

#5 Le 01/01/2013, à 16:06

BjBoY

Re : Bibliothèques non-trouvées (Code:Blocks)

Bonjour !
Pour le moment j'essaye de compiler et linker mon code et n'arrivant pas à avoir les bonnes bibliothèques en dynamique, peut être qu'en statique je verrais mieux ce qui ce passe, quand tout sera au point je remettrai en dynamique.

Pour répondre à ta question voici la ligne de commande générée par code:blocks :
Si je link "pthread" en dynamique :

g++  -o bin/Debug/arm obj/Debug/main.o    /usr/local/lib/libusb-1.0.a /usr/lib/x86_64-linux-gnu/libpthread.a 

Et là j'ai les erreurs mentionnées plus haut qui semblent montrer que la bibliothèque n'est pas linkée.

Si je link en statique j'ai :

g++  -o bin/Debug/arm obj/Debug/main.o    /usr/local/lib/libusb-1.0.a /usr/lib/x86_64-linux-gnu/libpthread.a 

Les fonctions "pthread" sont bien trouvées mais je me demande si il est normal d'avoir autant de fonctions non-résolues.

Et surtout je ne sais pas quoi mettre comme bibliothèque statique pour résoudre les fonctions clocks.

Hors ligne