[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: chown tests: Fix link error on mingw 10
From: |
Bruno Haible |
Subject: |
Re: chown tests: Fix link error on mingw 10 |
Date: |
Thu, 20 Apr 2023 02:51:58 +0200 |
> On mingw 10, I see a link error:
And another one in the lchown tests:
x86_64-w64-mingw32-gcc -Wno-error -g -O2 -L/usr/local/mingw64/lib -o
test-lchown.exe test-lchown.o libtests.a ../gllib/libgnu.a libtests.a
../gllib/libgnu.a libtests.a
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld:
test-lchown.o: in function `test_lchown':
/home/bruno/testdir-all/build-mingw64/gltests/../../gltests/test-lchown.h:85:
undefined reference to `getgid'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld:
/home/bruno/testdir-all/build-mingw64/gltests/../../gltests/test-lchown.h:156:
undefined reference to `getgid'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld:
/home/bruno/testdir-all/build-mingw64/gltests/../../gltests/test-lchown.h:187:
undefined reference to `getgid'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld:
/home/bruno/testdir-all/build-mingw64/gltests/../../gltests/test-lchown.h:204:
undefined reference to `getgid'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:18363: test-lchown.exe] Error 1
Extending the previous patch fixes it:
2023-04-19 Bruno Haible <bruno@clisp.org>
chown, lchown tests: Fix link error on mingw 10.
* modules/chown-tests (configure.ac): Test whether getgid() exists.
* modules/lchown-tests (configure.ac): Likewise.
* modules/fchownat-tests (configure.ac): Likewise.
* tests/test-chown.h (getgid): Define a fallback.
* tests/test-lchown.h (getgid): Likewise.
diff --git a/modules/lchown-tests b/modules/lchown-tests
index 10119f22eb..2954701eeb 100644
--- a/modules/lchown-tests
+++ b/modules/lchown-tests
@@ -16,7 +16,7 @@ stdbool
symlink
configure.ac:
-AC_CHECK_FUNCS_ONCE([getegid])
+AC_CHECK_FUNCS_ONCE([getgid getegid])
Makefile.am:
TESTS += test-lchown
diff --git a/tests/test-lchown.h b/tests/test-lchown.h
index 1c68f4a1ba..3f5d0bc54c 100644
--- a/tests/test-lchown.h
+++ b/tests/test-lchown.h
@@ -18,6 +18,10 @@
#include "nap.h"
+#if !HAVE_GETGID
+# define getgid() ((gid_t) -1)
+#endif
+
#if !HAVE_GETEGID
# define getegid() ((gid_t) -1)
#endif