Bonjour,

Je suis GNU/Linux Ubuntu 9.10 et je cherche à compiler un programme utilisant la libpthread
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
g++ -o essai essai.cc -lpthread
Quand je le compile avec la bibliothèque dynamique, aucun problème:


En revanche, si j'essaie de le compiler en statique avec:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
g++ -o essai essai.cc /usr/lib/libpthread.a
/usr/lib/libpthread.a(pthread_create.o): In function `allocate_stack':
/build/buildd/eglibc-2.10.1/nptl/allocatestack.c:444: undefined reference to `_dl_stack_flags'
/build/buildd/eglibc-2.10.1/nptl/allocatestack.c:586: undefined reference to `_dl_stack_flags'
/usr/lib/libpthread.a(ptw-close.o): In function `__close_nocancel':
(.text+0x18): undefined reference to `__syscall_error'
/usr/lib/libpthread.a(ptw-close.o): In function `__close_nocancel':
(.text+0x5a): undefined reference to `__syscall_error'
/usr/lib/libpthread.a(ptw-open.o): In function `__open_nocancel':
(.text+0x18): undefined reference to `__syscall_error'
/usr/lib/libpthread.a(ptw-open.o): In function `__open_nocancel':
(.text+0x6e): undefined reference to `__syscall_error'
/usr/lib/libpthread.a(ptw-pause.o): In function `__pause_nocancel':
(.text+0x18): undefined reference to `__syscall_error'
/usr/lib/libpthread.a(ptw-pause.o):(.text+0x50): more undefined references to `__syscall_error' follow
/usr/lib/libpthread.a(nptl-init.o): In function `__pthread_initialize_minimal_internal':
/build/buildd/eglibc-2.10.1/nptl/nptl-init.c:277: undefined reference to `__libc_setup_tls'
/build/buildd/eglibc-2.10.1/nptl/nptl-init.c:295: undefined reference to `_dl_cpuclock_offset'
/build/buildd/eglibc-2.10.1/nptl/nptl-init.c:437: undefined reference to `_dl_init_static_tls'
/build/buildd/eglibc-2.10.1/nptl/nptl-init.c:439: undefined reference to `_dl_wait_lookup_done'
collect2: ld returned 1 exit status
Et je n'arrive pas à fixer ces messages d'erreur. Quelqu'un pourrait-il m'aider?

Merci d'avance,