[PATCH] Use automake (v3)
Corinna Vinschen
corinna-cygwin@cygwin.com
Tue Dec 1 09:18:33 GMT 2020
Hi Jon,
On Nov 30 17:02, Jon Turney wrote:
> 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.
It helps to build the whole lot. The warnings are still generated.
I applied the attached patch to avoid the warnings when building
path-testsuite.exe. Still TODO are the warnings generated when
building libltp, though.
What bugs me is that the mingw executables are built in utils/mingw,
but the object files are still in utils. Any problem generating the
object files in utils/mingw, too?
Thanks,
Corinna
-------------- next part --------------
>From d9445d0fcbea11a9240141a5234b3ff5f0de5f63 Mon Sep 17 00:00:00 2001
From: Corinna Vinschen <corinna@vinschen.de>
Date: Tue, 1 Dec 2020 10:10:40 +0100
Subject: [PATCH] Cygwin: fix remaining warnings building path-testsuite.exe
---
winsup/utils/path.cc | 6 ++----
winsup/utils/testsuite.cc | 2 ++
winsup/utils/testsuite.h | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/winsup/utils/path.cc b/winsup/utils/path.cc
index 4c1bb4029da5..29344be02033 100644
--- a/winsup/utils/path.cc
+++ b/winsup/utils/path.cc
@@ -559,6 +559,7 @@ from_fstab (bool user, PWCHAR path, PWCHAR path_end)
#ifndef FSTAB_ONLY
+#ifndef TESTSUITE
static int
mnt_sort (const void *a, const void *b)
{
@@ -580,9 +581,6 @@ extern "C" WCHAR cygwin_dll_path[];
static void
read_mounts ()
{
-/* If TESTSUITE is defined, bypass this whole function as a harness
- mount table will be provided. */
-#ifndef TESTSUITE
HKEY setup_key;
LONG ret;
DWORD len;
@@ -654,8 +652,8 @@ read_mounts ()
from_fstab (false, path, path_end);
from_fstab (true, path, path_end);
qsort (mount_table, max_mount_entry, sizeof (mnt_t), mnt_sort);
-#endif /* !defined(TESTSUITE) */
}
+#endif /* !defined(TESTSUITE) */
/* Return non-zero if PATH1 is a prefix of PATH2.
Both are assumed to be of the same path style and / vs \ usage.
diff --git a/winsup/utils/testsuite.cc b/winsup/utils/testsuite.cc
index c0a800b01e86..23ed8e0d81c0 100644
--- a/winsup/utils/testsuite.cc
+++ b/winsup/utils/testsuite.cc
@@ -15,7 +15,9 @@ details. */
#include <unistd.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#ifndef TESTSUITE
#define TESTSUITE
+#endif
#include "testsuite.h"
typedef struct
diff --git a/winsup/utils/testsuite.h b/winsup/utils/testsuite.h
index d0a47b23aa9f..0dd6315398de 100644
--- a/winsup/utils/testsuite.h
+++ b/winsup/utils/testsuite.h
@@ -30,12 +30,12 @@ details. */
#if defined(TESTSUITE_MOUNT_TABLE)
static mnt_t mount_table[] = {
/* native posix flags */
- { TESTSUITE_ROOT, (char*)"/", MOUNT_SYSTEM},
- { "O:\\other", (char*)"/otherdir", MOUNT_SYSTEM},
- { "S:\\some\\dir", (char*)"/somedir", MOUNT_SYSTEM},
- { TESTSUITE_ROOT"\\bin", (char*)"/usr/bin", MOUNT_SYSTEM},
- { TESTSUITE_ROOT"\\lib", (char*)"/usr/lib", MOUNT_SYSTEM},
- { ".", (char*)TESTSUITE_CYGDRIVE, MOUNT_SYSTEM | MOUNT_CYGDRIVE},
+ { (char*)TESTSUITE_ROOT, (char*)"/", MOUNT_SYSTEM},
+ { (char*)"O:\\other", (char*)"/otherdir", MOUNT_SYSTEM},
+ { (char*)"S:\\some\\dir", (char*)"/somedir", MOUNT_SYSTEM},
+ { (char*)TESTSUITE_ROOT"\\bin", (char*)"/usr/bin", MOUNT_SYSTEM},
+ { (char*)TESTSUITE_ROOT"\\lib", (char*)"/usr/lib", MOUNT_SYSTEM},
+ { (char*)".", (char*)TESTSUITE_CYGDRIVE, MOUNT_SYSTEM | MOUNT_CYGDRIVE},
{ NULL, (char*)NULL, 0}
};
--
2.26.2
More information about the Cygwin-patches
mailing list