[gnutls-devel] GnuTLS | GnuTLS static library wrongly exports private symbols (#1703)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Sun Apr 20 07:30:00 CEST 2025



Paul Eggert created an issue: https://gitlab.com/gnutls/gnutls/-/issues/1703



## Description of problem:
GNU Emacs cannot be linked to GnuTLS statically, because GnuTLS mistakenly exports the private symbols `hash_string` and `hash_lookup`, and Emacs wants to use these symbols for its own purposes.

This bug was reported to Emacs as [Bug#77476 [PATCH] Rename various hash functions to avoid clashing with GnuTLS](https://bugs.gnu.org/77476) and I installed a [workaround by renaming Emacs functions](https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=c8eed90eb4d0583dc3463edfad176b9d3f98d11f), but the original problem really should be fixed in GnuTLS.

## Version of gnutls used:
3.8.9

## Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)
Fedora 42

## How reproducible:
```
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-3.8.9.tar.xz
xz -d <gnutls-3.8.9.tar.xz | tar xf -
(cd gnutls-3.8.9
 ./configure --prefix=/tmp/prefix 'CC=gcc -std=gnu17'
 make install)
wget https://ftp.gnu.org/pub/gnu/emacs/emacs-30.1.tar.xz
xz -d <emacs-30.1.tar.xz | tar xf -
cd emacs-30.1
./configure LIBGNUTLS_LIBS=/tmp/prefix/lib/libgnutls.a
make
```

## Actual results:
The build fails as follows:

```
...
  CCLD     temacs                                                                                                                                             
/usr/bin/ld: /tmp/prefix/lib/libgnutls.a(libgnu_la-hash.o): in function `hash_lookup':
/home/eggert/src/gnu/gnutls/gl/hash.c:243: multiple definition of `hash_lookup'; fns.o:/home/eggert/junk/emacs-30.1/src/fns.c:5109: first defined here
/usr/bin/ld: /tmp/prefix/lib/libgnutls.a(libgnu_la-hash.o): in function `hash_string':
/home/eggert/src/gnu/gnutls/gl/hash.c:386: multiple definition of `hash_string'; fns.o:/home/eggert/junk/emacs-30.1/src/fns.c:5348: first defined here
...
```


## Expected results:
The build should work.

I suggest that GnuTLS should use [Gnulib's `lib-symbol-visibility` module](https://www.gnu.org/software/gnulib/manual/html_node/Exported-Symbols-of-Shared-Libraries.html) to fix the problem.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/issues/1703
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20250420/17a97989/attachment-0001.html>


More information about the Gnutls-devel mailing list