0

Where can I find the source code and instructions for building libcurl-gnutls.so?

I'm working on a project that needs libcurl-gnutls.so. I am required to build it from source code - I am not allowed to simply install it with "apt-get install libcurl". Unfortunately, my google-fu is failing me and I can't find a source code repository or instructions to build libcurl-gnutls.so anywhere.

Here's what I have found:

Linux-from-scratch has well-documented instructions for building libcurl.so, here: https://www.linuxfromscratch.org/blfs/view/svn/basicnet/curl.html. That lets me build libcurl.so with gnutls, but not libcurl-gnutls.so.

The curl website (curl.se), has detailed instructions on its various options here: https://curl.se/docs/install.html. Those show me how to build libcurl with gnutls, but the end product is still libcurl.so, not libcurl-gnutls.so.

When I run ldd -r on my project, it identifies the functions it needs (curl_easy_init, curl_easy_setopt, curl_easy_perform, and curl_easy_cleanup). I can find those symbols in both libcurl.so and a pre-built libcurl-gnutls.so. This leads me to suspect that libcurl-gnutls.so is libcurl.so, published under a different name. However, renaming libcurl.so to libcurl-gnutls.so is not sufficient to meet the dependency requirements. I could try altering the libcurl project to set its name and version to libcurl-gnutls (not that I know how to do it - I would poke around until I figure it out), but I don't know how appropriate that would be.

I found one other question on Stack Overflow about libcurl-gnutls (How to create lib curl-gnutls.so.4), but the answers to that are to install a pre-built version via apt-get install, which I am not allowed to do.

user3149991
  • 101
  • 4
  • 20.04 https://packages.ubuntu.com/source/focal-updates/curl → → http://archive.ubuntu.com/ubuntu/pool/main/c/curl/curl_7.68.0.orig.tar.gz . .... There is a patch `debian/patches/90_gnutls.patch` in http://archive.ubuntu.com/ubuntu/pool/main/c/curl/curl_7.68.0-1ubuntu2.6.debian.tar.xz ..... `configure --with-gnutls --without-ssl` – Knud Larsen Jul 24 '21 at 08:26
  • Thanks, @KnudLarsen, but the patch file appears to fall short. It still builds as libcurl.so.4, and still has SONAME set to libcurl.so.4 internally. – user3149991 Jul 27 '21 at 22:24
  • I got **lib/** `{libcurl.a,libcurl-gnutls.a,libcurl-gnutls.la,libcurl-gnutls.so,libcurl-gnutls.so.4,libcurl-gnutls.so.4.6.0,libcurl.la,libcurl.so,libcurl.so.4,libcurl.so.4.6.0,pkgconfig/}` . – Knud Larsen Jul 28 '21 at 06:26

2 Answers2

0

libcurl-gnutls.so actually just comes from a cURL built with gnutls support. You can find the repository here: https://github.com/curl/curl

Check out the docs/INSTALL.md. It has all the information you need to build cURL, specifically the part about Building from git.

Here is a snippet you might need:

./configure --with-openssl [--with-gnutls --with-wolfssl]
make
make test (optional)
make install
Wassim Dhif
  • 1,278
  • 12
  • 21
0

Here's a complete answer cobbled together from everyone's input (Thanks especially to Knud Larsen and Wassim Dhif):

libcurl-gnutls.so is just libcurl.so built with gnutls support. Archives for the project are here: https://curl.se/download

  1. Change the SONAME that libcurl.so is built with by editing ltmain.sh to change:

     if test -n "$soname_spec";
     then eval soname=\"$soname_spec\"
    

To:

    if test -n "$soname_spec"; then
    soname=libcurl-gnutls.so.4

I'm sure there's a more elegant way to do it, but this works and I need to move on.

Alternatively, you can modify the the SONAME after libcurl.so is built with:

    patchelf –set-soname libcurl-gnutls.so.4 libcurl.so
  1. Check your client (the program or shared library that requires libcurl-gnutls.so as a dependency), to see if it requires version information. For instance, when I run objdump -p myprogram, I get this:

     Version References:
     required from libcurl-gnutls.so.4:
     0x0b103d23 0x00 14 CURL_GNUTLS_3
    

To build libcurl-gnutls.so with this version information:

2a. Set the version information to version 3: In lib/libcurl.vers.in change:

CURL_@CURL_LT_SHLIB_VERSIONED_FLAVOUR@4

To:

CURL_@CURL_LT_SHLIB_VERSIONED_FLAVOUR@3

2b. Use --enable-versioned-symbols when configuring the libcurl project. This adds the required version information.

./configure --with-gnutls --enable-versioned-symbols [other arguments as needed]

The final product may be named libcurl.so, but can be renamed. It will have its SONAME set to libcurl-gnutls.so.4 and will have the required version information.

user3149991
  • 101
  • 4