Skip to content

Commit 0068881

Browse files
committed
libxcrypt: fix cygwin build
1 parent be8c8ea commit 0068881

2 files changed

Lines changed: 49 additions & 2 deletions

File tree

pkgs/development/libraries/libxcrypt/default.nix

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ stdenv.mkDerivation (finalAttrs: {
1919
hash = "sha256-cVE6McAaQovM1TZ6Mv2V8RXW2sUPtbYMd51ceUKuwHE=";
2020
};
2121

22+
patches = [
23+
./fix-symver-on-non-elf.patch
24+
];
25+
2226
# this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
2327
# necessary for FreeBSD code path in configure
2428
postPatch = ''
@@ -36,15 +40,16 @@ stdenv.mkDerivation (finalAttrs: {
3640
"--disable-failure-tokens"
3741
# required for musl, android, march=native
3842
"--disable-werror"
39-
];
43+
]
44+
++ lib.optional stdenv.hostPlatform.isCygwin "--disable-symvers";
4045

4146
makeFlags =
4247
let
4348
lld17Plus = stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17";
4449
in
4550
[ ]
4651
# fixes: can't build x86_64-w64-mingw32 shared library unless -no-undefined is specified
47-
++ lib.optionals stdenv.hostPlatform.isWindows [ "LDFLAGS+=-no-undefined" ]
52+
++ lib.optionals stdenv.hostPlatform.isPE [ "LDFLAGS+=-no-undefined" ]
4853

4954
# lld 17 sets `--no-undefined-version` by default and `libxcrypt`'s
5055
# version script unconditionally lists legacy compatibility symbols, even
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From c3afeaaa5a715380caa7209d4596ff2b8aeb73a0 Mon Sep 17 00:00:00 2001
2+
From: David McFarland <corngood@gmail.com>
3+
Date: Thu, 11 Sep 2025 16:58:06 -0300
4+
Subject: [PATCH] cygwin: fix symver
5+
6+
---
7+
lib/crypt-port.h | 8 ++++++++
8+
1 file changed, 8 insertions(+)
9+
10+
diff --git a/lib/crypt-port.h b/lib/crypt-port.h
11+
index a707939..25ad957 100644
12+
--- a/lib/crypt-port.h
13+
+++ b/lib/crypt-port.h
14+
@@ -213,6 +213,7 @@ extern size_t strcpy_or_abort (void *dst, size_t d_size, const void *src);
15+
16+
/* Starting with GCC 10, we can use the symver attribute, which is also
17+
needed at the point we decide to enable link-time optimization. */
18+
+#ifdef __ELF__
19+
# if defined HAVE_FUNC_ATTRIBUTE_SYMVER
20+
21+
/* Set the symbol version for EXTNAME, which uses INTNAME as its
22+
@@ -234,10 +235,17 @@ extern size_t strcpy_or_abort (void *dst, size_t d_size, const void *src);
23+
24+
# endif
25+
26+
+#else
27+
+#define symver_set(...) symver_nop()
28+
+#endif
29+
+
30+
#else
31+
# error "Don't know how to do symbol versioning with this compiler"
32+
#endif
33+
34+
+
35+
+
36+
+
37+
/* A construct with the same syntactic role as the expansion of symver_set,
38+
but which does nothing. */
39+
#define symver_nop() __asm__ ("")
40+
--
41+
2.50.1
42+

0 commit comments

Comments
 (0)