Hi,
I’m trying to compile a C program with the -static gcc option, and I’m using the pcre library.
After installing the pcre-devel-static I got the following message while trying to compile my program:
gcc -pedantic -Wall -static -pipe -O2 -march=native -mtune=native -fomit-frame-pointer -o gop.exe atom.o bhmc.o cg.o conquer.o data.o ecn.o energy.o filter.o force.o ga.o input.o info.o interface_aims.o main.o operators.o op_list.o output.o potential.o random.o selection.o bhsa.o mc.o util.o -lm -lpcre
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../lib64/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `allocator_grab_lock':
/home/abuild/rpmbuild/BUILD/pcre-8.30/sljit/sljitUtils.c:87: undefined reference to `pthread_mutex_lock'
/home/abuild/rpmbuild/BUILD/pcre-8.30/sljit/sljitUtils.c:87: undefined reference to `pthread_mutex_lock'
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../lib64/libpcre.a(libpcre_la-pcre_jit_compile.o): In function `allocator_release_lock':
/home/abuild/rpmbuild/BUILD/pcre-8.30/sljit/sljitUtils.c:92: undefined reference to `pthread_mutex_unlock'
/home/abuild/rpmbuild/BUILD/pcre-8.30/sljit/sljitUtils.c:92: undefined reference to `pthread_mutex_unlock'
/home/abuild/rpmbuild/BUILD/pcre-8.30/sljit/sljitUtils.c:92: undefined reference to `pthread_mutex_unlock'
/usr/lib64/gcc/x86_64-suse-linux/4.7/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__gthread_mutex_lock':
/home/abuild/rpmbuild/BUILD/gcc-4.7.1-20120723/obj-x86_64-suse-linux/x86_64-suse-linux/libgcc/./gthr-default.h:767: undefined reference to `pthread_mutex_lock'
/home/abuild/rpmbuild/BUILD/gcc-4.7.1-20120723/obj-x86_64-suse-linux/x86_64-suse-linux/libgcc/./gthr-default.h:767: undefined reference to `pthread_mutex_lock'
/home/abuild/rpmbuild/BUILD/gcc-4.7.1-20120723/obj-x86_64-suse-linux/x86_64-suse-linux/libgcc/./gthr-default.h:767: undefined reference to `pthread_mutex_lock'
/usr/lib64/gcc/x86_64-suse-linux/4.7/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__gthread_mutex_unlock':
/home/abuild/rpmbuild/BUILD/gcc-4.7.1-20120723/obj-x86_64-suse-linux/x86_64-suse-linux/libgcc/./gthr-default.h:797: undefined reference to `pthread_mutex_unlock'
/usr/lib64/gcc/x86_64-suse-linux/4.7/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__gthread_mutex_lock':
/home/abuild/rpmbuild/BUILD/gcc-4.7.1-20120723/obj-x86_64-suse-linux/x86_64-suse-linux/libgcc/./gthr-default.h:767: undefined reference to `pthread_mutex_lock'
/usr/lib64/gcc/x86_64-suse-linux/4.7/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `__gthread_mutex_unlock':
/home/abuild/rpmbuild/BUILD/gcc-4.7.1-20120723/obj-x86_64-suse-linux/x86_64-suse-linux/libgcc/./gthr-default.h:797: undefined reference to `pthread_mutex_unlock'
/home/abuild/rpmbuild/BUILD/gcc-4.7.1-20120723/obj-x86_64-suse-linux/x86_64-suse-linux/libgcc/./gthr-default.h:797: undefined reference to `pthread_mutex_unlock'
/home/abuild/rpmbuild/BUILD/gcc-4.7.1-20120723/obj-x86_64-suse-linux/x86_64-suse-linux/libgcc/./gthr-default.h:797: undefined reference to `pthread_mutex_unlock'
collect2: error: ld returned 1 exit status
make: ** [gop.exe] Erro 1
It looks like it’s a problem of the pcre package with pthread.
Any ideas of how can I solve this problem?
Thanks,
Henrique.