[PATCH] Use automake (v3)

Jon Turney jon.turney@dronecode.org.uk
Mon Nov 30 17:02:14 GMT 2020


On 30/11/2020 10:47, Corinna Vinschen wrote:
> On Nov 30 11:25, Corinna Vinschen wrote:
> 
> Also, after applying the patch and autogen-ing, a full build from
> top-level fails with some warnings and a final undefined symbol:

The warnings are expected at this stage.

> make[5]: Entering directory '[...]/x86_64-pc-cygwin/winsup/utils/mingw'
>    CXX      ../bloda.o
>    CXX      ../cygcheck.o
>    CXX      ../dump_setup.o
>    CXX      ../ldh.o
>    CXX      ../path.o
>    CXX      ../cygwin-console-helper.o
>    CXX      ../path_testsuite-path.o
>    CXX      ../strace.o
>    CXX      ../path_testsuite-testsuite.o
> [...]/winsup/utils/mingw/../testsuite.cc:18: warning: "TESTSUITE" redefined
>     18 | #define TESTSUITE

This redefinition should probably be inside #ifndef TESTSUITE/#endif

> <command-line>: note: this is the location of the previous definition
>    CXXLD    cygwin-console-helper.exe
>    CXXLD    ldh.exe
> In file included from [...]/winsup/utils/mingw/../path.cc:263:
> [...]/winsup/utils/mingw/../testsuite.h:22:24: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
>     22 | #define TESTSUITE_ROOT "X:\\xyzroot"

I'm not sure how to restructure things to avoid this warning.

The '-Wno-error=write-strings' flag is added when building this test to 
avoid this being fatal.

>    CXXLD    path-testsuite.exe
> /usr/lib/gcc/x86_64-w64-mingw32/9.2.1/../../../../x86_64-w64-mingw32/bin/ld: ../path_testsuite-path.o:path.cc:(.rdata$.refptr.max_mount_entry[.refptr.max_mount_entry]+0x0): undefined reference to `max_mount_entry'

This is a bit puzzling.  I don't get this when building locally, but idk 
why since there is only a tentative definition of this variable.

I'm not sure how this being built is changed by automaking to stop it 
working for you (perhaps optimization flags are now being used?)

Perhaps the attached helps, although what is getting stubbed out when 
testing could be clearer.

-------------- next part --------------
From ddf8c0c059dd666f4138a5b0b123713af1af3ab1 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Mon, 30 Nov 2020 16:58:02 +0000
Subject: [PATCH] Fix building of utils testsuite

---
 winsup/utils/path.cc | 4 ++++
 winsup/utils/path.h  | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/winsup/utils/path.cc b/winsup/utils/path.cc
index d8c208123..4c1bb4029 100644
--- a/winsup/utils/path.cc
+++ b/winsup/utils/path.cc
@@ -824,8 +824,10 @@ vcygpath (const char *cwd, const char *s, va_list v)
   size_t max_len = 0;
   mnt_t *m, *match = NULL;
 
+#ifndef TESTSUITE
   if (!max_mount_entry)
     read_mounts ();
+#endif
   char *path;
   if (s[0] == '.' && isslash (s[1]))
     s += 2;
@@ -912,8 +914,10 @@ extern "C" FILE *
 setmntent (const char *, const char *)
 {
   m = mount_table;
+#ifndef TESTSUITE
   if (!max_mount_entry)
     read_mounts ();
+#endif
   return NULL;
 }
 
diff --git a/winsup/utils/path.h b/winsup/utils/path.h
index af5deeba6..a1840a003 100644
--- a/winsup/utils/path.h
+++ b/winsup/utils/path.h
@@ -24,8 +24,8 @@ bool from_fstab_line (mnt_t *m, char *line, bool user);
 
 #ifndef TESTSUITE
 extern mnt_t mount_table[255];
-#endif
 extern int max_mount_entry;
+#endif
 
 #ifndef SYMLINK_MAX
 #define SYMLINK_MAX 4095  /* PATH_MAX - 1 */
-- 
2.29.2



More information about the Cygwin-patches mailing list