cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Trouble building NSS variant

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Thu, 17 Jul 2014 13:30:25 +0200

On Thursday, July 17, 2014 12:49:36 Alessandro Ghedini wrote:
> Hi,
>
> I'm having trouble building the NSS variant (both from git and 7.37.1):
> > libtool: link: gcc -O2 -Wno-system-headers -o .libs/curl
> > curl-tool_binmode.o curl-tool_bname.o curl-tool_cb_dbg.o
> > curl-tool_cb_hdr.o curl-tool_cb_prg.o curl-tool_cb_rea.o
> > curl-tool_cb_see.o curl-tool_cb_wrt.o curl-tool_cfgable.o
> > curl-tool_convert.o curl-tool_dirhie.o curl-tool_doswin.o
> > curl-tool_easysrc.o curl-tool_formparse.o curl-tool_getparam.o
> > curl-tool_getpass.o curl-tool_help.o curl-tool_helpers.o
> > curl-tool_homedir.o curl-tool_hugehelp.o curl-tool_libinfo.o
> > curl-tool_main.o curl-tool_metalink.o curl-tool_mfiles.o curl-tool_msgs.o
> > curl-tool_operate.o curl-tool_operhlp.o curl-tool_panykey.o
> > curl-tool_paramhlp.o curl-tool_parsecfg.o curl-tool_setopt.o
> > curl-tool_sleep.o curl-tool_urlglob.o curl-tool_util.o curl-tool_vms.o
> > curl-tool_writeenv.o curl-tool_writeout.o curl-tool_xattr.o
> > ../lib/curl-strtoofft.o ../lib/curl-strdup.o ../lib/curl-rawstr.o
> > ../lib/curl-nonblock.o ../lib/curl-warnless.o ../lib/.libs/libcurl.so
> > -lz /usr/bin/ld: curl-tool_main.o: undefined reference to symbol
> > 'PL_ArenaFinish' //usr/lib/x86_64-linux-gnu/libplds4.so: error adding
> > symbols: DSO missing from command line collect2: error: ld returned 1
> > exit status
>
> This on Debian with gcc-4.9.

Thanks for heads up!

> Manually passing "-lnspr4 -lplds4" (or the output of pkg-config --libs nss)
> to the above command resolves the problem.
>
> The configure command is simply "./configure --without-ssl --with-nss".
> Setting "link_all_deplibs" to "yes" for linux in configure works as well,
> but there doesn't seem to be any ./configure option for doing that
> automatically (also it seems overkill, since only the NSS libraries are
> needed).

I believe the correct fix is to link the curl tool with NSS libs when compiled
against NSS. I remember we hit the same problem when we ported the metalink
support to use NSS for crypto.

> Maybe the code in the "#ifdef USE_NSS" in src/tool_main.c should be moved to
> Curl_nss_cleanup() to avoid having the curl binary itself link to all the
> $(LIBCURL_LIBS).

That would break complex programs where curl is not the only user of NSS/NSPR.
PR_Cleanup() needs to be called near the end of the main function:

https://developer.mozilla.org/en-US/docs/PR_Cleanup

Otherwise libcurl could call PR_Cleanup() while another lib is still using it.

Kamil

> There's also the chance that I'm doing something wrong, but the Debian
> package build, which works for previous releases, broke because of this, so
> I imagine others may have the same problem as well.
>
> Cheers
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-07-18