undefined symbol: curl_easy_setopt

Started by
4 comments, last by FGFS 8 years, 9 months ago

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

Advertisement

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

undefined symbol: GSS_C_NT_HOSTBASED_SERVICE

Thanks

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.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

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.

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.

Stephen M. Webb
Professional Free Software Developer

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".

This topic is closed to new replies.

Advertisement