Should "std.net.curl" be moved from Phobos to Deimos?

Marco Leise Marco.Leise at gmx.de
Tue Nov 26 19:35:48 PST 2013


Am Tue, 26 Nov 2013 12:04:59 -0800
schrieb Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:

> What flags are we requiring for use with std.net.curl? Are those 
> depending on what specific calls are being used (e.g. using https etc)? 
> We could document that stuff. All in all it doesn't seem unreasonable to 
> me to require certain specifics for using std.net.curl.
> 
> Andrei

Yes, listing requirements is always good to do. But let's take
a look at some hard facts first. `ldd libphobos2.so' on the
linux amd64 version from the zip (for 2.064.2) reveals:

	linux-vdso.so.1 (0x00007fff2fd96000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f1294e66000)
	libcurl-gnutls.so.4 => not found
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1294c48000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f1294951000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f1294748000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f12943a0000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003989a00000)

libcurl-gnutls is not found on *my* installation of Linux.
You correctly made out https (SSL) as a culprit. It is not a
single flag though, but up to 6(!) different SSL "backends"
you can chose from. Typically it comes down to OpenSSL and
GnuTLS. The Debian system that this phobos.so was compiled on
obviously used a GnuTLS version that was suffixed with
"-gnutls" to allow a parallel installation of a curl
version with e.g. OpenSSL. On my Linux on the other hand, I
can only install one version of curl at a time and no suffix
is used. So:

1. curl library names differ on distributions

Next, when you issue:
`readelf --version-info libphobos2.so | less'
you will get a dump of the .gnu.version section that contains
entries like "CURL_GNUTLS_3". These correlate to the
respective "versioned symbols" from libcurl.so. Versioned
symbols are the regular C export names with an @-suffix. The
following command should reveal them:
`readelf -s /usr/lib64/libcurl-gnutls.so.4 | grep GNUTLS_3'
What this means, is that not only the library name phobos.so
uses is linked to the gnutls version, but also each of the SSL
specific functions! This makes for:

2. phobos.so uses GNUTLS version of curl functions

You can rely on the fact that curl is installed on Linux and
that it exposes SSL functionality, but the way phobos.so is
created it is Debian and GnuTLS specific at the moment.

-- 
Marco



More information about the Digitalmars-d mailing list