• Advertisement
Sign in to follow this  

undefined symbol: curl_easy_setopt

This topic is 999 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi

I try to link curl statically on Ubuntu/Eclipse/GCC:

Invoking: GCC C++ Linker
g++ -Bstatic -l:libcurl-gnutls.a -l:libcurl.a -L/usr/lib/x86_64-linux-gnu/ -shared -o "lin.xpl"  ./BitmapSupport.o ./main.o   -lopenal -lSDL -lGL
Finished building target: lin.xpl

and get the runtime error:

undefined symbol: curl_easy_setopt

What am I missing?
Many thanks in advance and regards

Share this post


Link to post
Share on other sites
Advertisement

I've changed the link order on commandline and now get:

 

undefined symbol: GSS_C_NT_HOSTBASED_SERVICE

 

Thanks

Share this post


Link to post
Share on other sites

When linking, object files must come before their dependencies (because the linker resolves symbols from left to right on the command-line). Hence the correct order is your object files followed by libcurl followed by gnutls (probably) because your code needs symbols from libcurl which itself needs symbols from gnutls.

Share this post


Link to post
Share on other sites

Yes thanks, I found that out just today. So the hostbased error means that static curl was not correctly compiled? I only need libcurl-gnutls.a. With all those dependencies, I don't think I would go through the hassle of recompiling curl and rather tell users to use dynamic libcurl-gnutls which seems to be a problem for Fedora users. Well then I add "Ubuntu compatible" to the description.

Share this post


Link to post
Share on other sites

It's highly likely you're going to need a whackload of additional libraries linked in statically.

 

For example, libcurl-gnutls will require libgnutls to also be lined in, which in turn requires libpgp-error, and so on.  It's turtles all the way down.

 

Also, statically linking security libraries used to be considered a severe security hole.  You'll need to rebuild most of those libraries yourself from source to statically link them because on Ubuntu, at least, the static versions are not available.

Share this post


Link to post
Share on other sites

Ok thanks, so I'll leave it dynamic. I think it's ok to tell Fedora users to compile libcurl-gnutls themselves and leave the description as "Linux supported".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement