Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build of 0.111 fails with undefined reference to symbol pthread_rwlock_rwlock #15

Closed
mirco opened this issue Nov 22, 2015 · 3 comments
Closed

Comments

@mirco
Copy link
Contributor

mirco commented Nov 22, 2015

Hey. Building 0.111 on arch-linux fails with the following message:

/usr/bin/gcc pesigcheck.o pesigcheck_context.o certdb.o cms_common.o content_info.o oid.o password.o signed_data.o signer_info.o wincert.o ucs2.o /home/mirco/build/build/pesign/src/pesign-0.111/libdpe/libdpe.a -lefivar -lssl3 -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4 -lpopt -o pesigcheck
/usr/bin/ld: /tmp/cc6kuUCi.ltrans1.ltrans.o: undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5'
/usr/lib/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
: recipe for target 'pesigcheck' failed
make[1]: *** [pesigcheck] Error 1

So for some reason -lpthread is missing. I can't figure out your makefiles though so I need your help to fix this ;)
Thanks

@vathpela
Copy link
Contributor

We're not using pthread_rwlock_rwlock() directly - nspr is. So I think this is your distro having /usr/lib64/pkgconfig/nspr.pc (or maybe it's in /usr/lib/ there) say "Libs.private: -lpthread" instead of it being in "Libs:". But users of the nspr library must be linked against libpthread as well, so it is not private and that is wrong. This needs to be fixed in your nspr build. That said, the following patch will make pesigcheck compile while that's still broken. You may need to do the same thing for the other targets, though.

--- a/src/Makefile
+++ b/src/Makefile
@@ -41,6 +41,7 @@ efisiglist : PKGS=efivar nss nspr popt
 pesigcheck : $(call objects-of,$(PESIGCHECK_SOURCES) $(COMMON_SOURCES)) \
             $(TOPDIR)/libdpe/libdpe.a
 pesigcheck : PKGS=efivar nss nspr popt
+pesigcheck : LDLIBS+=-lpthread
 
 pesign : $(call objects-of,$(PESIGN_SOURCES) $(COMMON_SOURCES)) \
         $(TOPDIR)/libdpe/libdpe.a

@vathpela
Copy link
Contributor

I'm going to go ahead and close this; if there's more related to it, please feel free to re-open it.

@foutrelis
Copy link

This is not an issue with nspr. libdpe is using the function the linker is complaining about; see the calls to rwlock_wrlock() which are translated via preprocessor defines to pthread_rwlock_wrlock().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants