cURL / Mailing Lists / curl-library / Single Mail


RE: Using HTTPS in multi-threaded dynamic library plugin on CentOS

From: Adal Chiriliuc <>
Date: Thu, 15 Apr 2010 17:23:23 +0100

I have pulled the libcurl *.c files into my project and I build it together with my code. No intermediary libcurl.a is built.

-fPIC is used. The gcc flags are: -m32 -fno-strict-aliasing -ggdb -c -O2 -fPIC -MMD -MP -MF. I also define CURL_STATICLIB
Linker flags: -lrt -ldl -lz -lidn -lcrypto -lssl

> Are you statically linking the CentOS supplied on into your .so, or
> having the main application link to both your .so and the CentOS
> dynamic

Running ldd against my .so or the main application doesn't list libcurl. Is there a way to link against a lib on linux without using -l as above? On Windows you can do something like "#pragma comment(lib, "libcurl.lib")". Maybe I have something like this in the code which pulls in libcurl.a

> If it is truly "impossible" to have ssl_version pointing to an empty
> string, and not merely a coding or API error, that suggests to me a
> problem with the dynamic/static linking combination, resulting in
> multiple instances of some variables with the same name (so the one
> you see isn't the one libcurl sees), or other weird variations on that
> theme.

All the code paths in Curl_ossl_version write to ssl_version, that's why I say it's impossible. This function is called when I build my code as a simple application. I didn't confirm yet that it's still called inside my plugin.

> If you are linking libcurl.a statically into your .so, I can imagine
> obscure problems due to lack of -fPIC in libcurl.a's code. But more
> likely, if you're doing that, perhaps the main application or some
> other library used by the main application links to as
> well, making multiple instances of libcurl in the same application?

That's what I'm thinking. But if I don't link the libcurl c files into my dynamic library, the plugin can't be loaded because of missing imports. If something else linked to, wouldn't the plugin be loaded without a problem?

I just tried building libcurl with the latest yassl, but I get compilation errors on Windows and missing include files (dsa.h, df.h, ...) which are not present in the yassl OpenSSL emulation headers.

Another thing: libcurl fails with this error message: "libcurl was built with SSL disabled, https: not supported!" But I have looked for it (and parts of it) all over the libcurl source code, and I can't find from where does it come.

List admin:
Received on 2010-04-15