GNU bug report logs - #74677
[PATCH] nix/local.mk: fix -lgcrypt link on --as-needed toolchains

Previous Next

Package: guix-patches;

Reported by: Sergei Trofimovich <slyich <at> gmail.com>

Date: Tue, 3 Dec 2024 21:16:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74677 in the body.
You can then email your comments to 74677 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#74677; Package guix-patches. (Tue, 03 Dec 2024 21:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sergei Trofimovich <slyich <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 03 Dec 2024 21:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sergei Trofimovich <slyich <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Sergei Trofimovich <slyich <at> gmail.com>
Subject: [PATCH] nix/local.mk: fix -lgcrypt link on --as-needed toolchains
Date: Tue,  3 Dec 2024 21:15:15 +0000
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=8a7bd211d21f06c1234fbb82bb905d202d58f598
introduced a build regression on Gentoo as:

    x86_64-pc-linux-gnu-g++ -Wall -std=c++11 -O2 -pipe   -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--hash-style=gnu -lgcrypt -o guix-daemon nix/nix-daemon/guix_daemon-nix-daemon.o nix/nix-daemon/guix_daemon-guix-daemon.o libstore.a libutil.a libformat.a -lz -lsqlite3  -lbz2
    /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: nix/nix-daemon/guix_daemon-guix-daemon.o: in function `main':
guix-daemon.cc:(.text.startup+0x62): undefined reference to `gcry_check_version'

This happens because:
- Gentoo linker is using --Wl,-as-needed by default
- -lgcrypt is passed before actual use of it's symbols in `guix-daemon.cc`

The change uses `LIBGCRYPT_LDFLAGS` as if it was `LIBGCRYPT_LIBS`.

* nix/local.mk (guix_daemon_LDADD): Use LIBGCRYPT_LDFLAGS instead of
  unset LIBGCRYPT_LIBS.
---
 nix/local.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nix/local.mk b/nix/local.mk
index 8a2b2b88e8..50368457dd 100644
--- a/nix/local.mk
+++ b/nix/local.mk
@@ -124,7 +124,7 @@ guix_daemon_CPPFLAGS =				\
 
 guix_daemon_LDADD =				\
   libstore.a libutil.a libformat.a -lz		\
-  $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS)
+  $(SQLITE3_LIBS) $(LIBGCRYPT_LDFLAGS)
 
 guix_daemon_headers =				\
   %D%/nix-daemon/shared.hh
-- 
2.47.0





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 09 Dec 2024 22:18:02 GMT) Full text and rfc822 format available.

Notification sent to Sergei Trofimovich <slyich <at> gmail.com>:
bug acknowledged by developer. (Mon, 09 Dec 2024 22:18:02 GMT) Full text and rfc822 format available.

Message #10 received at 74677-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Sergei Trofimovich <slyich <at> gmail.com>
Cc: 74677-done <at> debbugs.gnu.org
Subject: Re: [bug#74677] [PATCH] nix/local.mk: fix -lgcrypt link on
 --as-needed toolchains
Date: Mon, 09 Dec 2024 23:17:31 +0100
Hi Sergei,

Sergei Trofimovich <slyich <at> gmail.com> skribis:

> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=8a7bd211d21f06c1234fbb82bb905d202d58f598
> introduced a build regression on Gentoo as:
>
>     x86_64-pc-linux-gnu-g++ -Wall -std=c++11 -O2 -pipe   -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--hash-style=gnu -lgcrypt -o guix-daemon nix/nix-daemon/guix_daemon-nix-daemon.o nix/nix-daemon/guix_daemon-guix-daemon.o libstore.a libutil.a libformat.a -lz -lsqlite3  -lbz2
>     /usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: nix/nix-daemon/guix_daemon-guix-daemon.o: in function `main':
> guix-daemon.cc:(.text.startup+0x62): undefined reference to `gcry_check_version'
>
> This happens because:
> - Gentoo linker is using --Wl,-as-needed by default
> - -lgcrypt is passed before actual use of it's symbols in `guix-daemon.cc`

I pushed as dcaccc8b722cee279c00bb321baa48ae73563931 the patch
Doğan Çeçen submitted to fix this regression and more:

  https://issues.guix.gnu.org/74686

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 07 Jan 2025 12:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 161 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.