Open sdbbs opened 2 years ago
Since the OP is already quite long, just wanted to add this comment:
Having realized that the default is C++17, I wanted to see how the build would behave for C++11; so I replaced this line:
diff --git a/GNUmakefile b/GNUmakefile
index 2033339..c263cf6 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -156,7 +156,7 @@ ifeq ($(OS), windows_nt)
EXEPOSTFIX=.exe
endif
ifeq ($(OSTYPE), cygwin)
- $(info using settings for OS=Windows_NT, OSTYPE=cygwin)
+ $(info using settings for OS=Windows_NT, OSTYPE=cygwin)
# call make OSTYPE=cygwin
BSWITCH=103
DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
@@ -164,7 +164,7 @@ ifeq ($(OS), windows_nt)
DUMA_DYN_DEPS=
DUMASO=
CFLAGS=-g -O0 -DWIN32 -Wall -Wextra
- CPPFLAGS=-g -O0 -DWIN32 -Wall -Wextra
+ CPPFLAGS=-g -O0 -DWIN32 -Wall -Wextra -std=gnu++11
LIBS=
EXEPOSTFIX=.exe
endif
... and now the process looks like this:
$ make -f ./GNUmakefile OS=$(echo "$OS" | tr '[:upper:]' '[:lower:]' 2>/dev/null || true) OSTYPE=cygwin
using settings for OS=Windows_NT, OSTYPE=cygwin
using default prefix [/usr]
using default srcdir [.]
using default exec_prefix [/usr]
./make_git_source_version.sh > ./verinfo.h
c++ -g -O0 -DWIN32 -Wall -Wextra -std=gnu++11 -c dumapp.cpp -o dumapp.o
dumapp.cpp: In function ‘void* duma_new_operator(std::size_t, _DUMA_Allocator, bool, const char*, int)’:
dumapp.cpp:166:29: warning: catching polymorphic type ‘class std::bad_alloc’ by value [-Wcatch-value=]
166 | catch (std::bad_alloc) // error occured in new_handler
| ^~~~~~~~~
cc -g -O0 -DWIN32 -Wall -Wextra -c duma.c -o duma.o
cc -g -O0 -DWIN32 -Wall -Wextra -c sem_inc.c -o sem_inc.o
cc -g -O0 -DWIN32 -Wall -Wextra -c print.c -o print.o
print.c: In function ‘DUMA_Abort’:
print.c:278:13: warning: variable ‘lenb’ set but not used [-Wunused-but-set-variable]
278 | int lena, lenb;
| ^~~~
print.c: In function ‘DUMA_Exit’:
print.c:363:13: warning: variable ‘lenb’ set but not used [-Wunused-but-set-variable]
363 | int lena, lenb;
| ^~~~
rm -f libduma.a
ar crv libduma.a dumapp.o duma.o sem_inc.o print.o
a - dumapp.o
a - duma.o
a - sem_inc.o
a - print.o
ranlib libduma.a
Build complete - you can now run make test.
$ make -f ./GNUmakefile OS=$(echo "$OS" | tr '[:upper:]' '[:lower:]' 2>/dev/null || true) OSTYPE=cygwin check
using settings for OS=Windows_NT, OSTYPE=cygwin
using default prefix [/usr]
using default srcdir [.]
using default exec_prefix [/usr]
./make_git_source_version.sh > ./verinfo.h
cc -g -O0 -DWIN32 -Wall -Wextra -c duma.c -o duma.o
rm -f libduma.a
ar crv libduma.a dumapp.o duma.o sem_inc.o print.o
a - dumapp.o
a - duma.o
a - sem_inc.o
a - print.o
ranlib libduma.a
cc -g -O0 -DWIN32 -Wall -Wextra -c tests/tstheap.c -o tstheap.o
rm -f tstheap.exe
cc -g -O0 -DWIN32 -Wall -Wextra tstheap.o libduma.a -o tstheap.exe
cc -g -O0 -DWIN32 -Wall -Wextra -c tests/dumatest.c -o dumatest.o
rm -f dumatest.exe
cc -g -O0 -DWIN32 -Wall -Wextra dumatest.o libduma.a -o dumatest.exe
cc -g -O0 -DWIN32 -Wall -Wextra -c tests/thread-test.c -o thread-test.o
rm -f thread-test.exe
cc -g -O0 -DWIN32 -Wall -Wextra thread-test.o libduma.a -o thread-test.exe
cc -g -O0 -DWIN32 -Wall -Wextra -c tests/testmt.c -o testmt.o
rm -f testmt.exe
cc -g -O0 -DWIN32 -Wall -Wextra testmt.o libduma.a -o testmt.exe
c++ -g -O0 -DWIN32 -Wall -Wextra -std=gnu++11 -c tests/dumatestpp.cpp -o dumatestpp.o
rm -f dumatestpp.exe
c++ -g -O0 -DWIN32 -Wall -Wextra -std=gnu++11 dumatestpp.o libduma.a -o dumatestpp.exe
c++ -g -O0 -DWIN32 -Wall -Wextra -std=gnu++11 -c tests/testoperators.cpp -o testoperators.o
tests/testoperators.cpp:40:65: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
40 | void * operator new( DUMA_SIZE_T ) throw(std::bad_alloc);
| ^~~~~
tests/testoperators.cpp:46:65: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
46 | void * operator new[]( DUMA_SIZE_T ) throw(std::bad_alloc);
| ^~~~~
tests/testoperators.cpp:53:81: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
53 | void * operator new( DUMA_SIZE_T, const char *, int ) throw( std::bad_alloc );
| ^~~~~
tests/testoperators.cpp:59:83: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
59 | void * operator new[]( DUMA_SIZE_T, const char *, int ) throw( std::bad_alloc );
| ^~~~~
tests/testoperators.cpp:73:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
73 | throw(std::bad_alloc)
| ^~~~~
tests/testoperators.cpp:104:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
104 | throw(std::bad_alloc)
| ^~~~~
tests/testoperators.cpp:132:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
132 | throw( std::bad_alloc )
| ^~~~~
tests/testoperators.cpp:160:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
160 | throw( std::bad_alloc )
| ^~~~~
rm -f testoperators.exe
c++ -g -O0 -DWIN32 -Wall -Wextra -std=gnu++11 testoperators.o libduma.a -o testoperators.exe
.
Testing DUMA (static library):
./dumatest.exe
DUMA 2.5.21-0-ge214a6e-dirty, built 10/11/21 08:07:13 (static library, EXPLICIT_INIT)
Copyright (C) 2006 Michael Eddington <meddington@gmail.com>
Copyright (C) 2002-2009 Hayati Ayguen <h_ayguen@web.de>, Procitec GmbH
Copyright (C) 1987-1999 Bruce Perens <bruce@perens.com>
.
./tstheap.exe 3072
DUMA 2.5.21-0-ge214a6e-dirty, built 10/11/21 08:07:13 (static library, EXPLICIT_INIT)
Copyright (C) 2006 Michael Eddington <meddington@gmail.com>
Copyright (C) 2002-2009 Hayati Ayguen <h_ayguen@web.de>, Procitec GmbH
Copyright (C) 1987-1999 Bruce Perens <bruce@perens.com>
.
./testoperators.exe
DUMA 2.5.21-0-ge214a6e-dirty, built 10/11/21 08:07:13 (static library, EXPLICIT_INIT)
Copyright (C) 2006 Michael Eddington <meddington@gmail.com>
Copyright (C) 2002-2009 Hayati Ayguen <h_ayguen@web.de>, Procitec GmbH
Copyright (C) 1987-1999 Bruce Perens <bruce@perens.com>
.
DUMA static confidence test PASSED.
So now the "dynamic exception specifications" are warnings, not errors, and the make test
/make check
proceeds to the end.
And, another note - I tried this patch, to build the dynamic library (the .dll
):
diff --git a/GNUmakefile b/GNUmakefile
index 2033339..c93e0fa 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -156,15 +156,16 @@ ifeq ($(OS), windows_nt)
EXEPOSTFIX=.exe
endif
ifeq ($(OSTYPE), cygwin)
- $(info using settings for OS=Windows_NT, OSTYPE=cygwin)
+ $(info using settings for OS=Windows_NT, OSTYPE=cygwin)
# call make OSTYPE=cygwin
BSWITCH=103
DUMA_OPTIONS += -DDUMA_EXPLICIT_INIT
CURPATH=./
- DUMA_DYN_DEPS=
- DUMASO=
+ #DUMA_DYN_DEPS=
+ DUMASO=libduma.dll
+ DUMASO_LINK1=libduma.dll
CFLAGS=-g -O0 -DWIN32 -Wall -Wextra
- CPPFLAGS=-g -O0 -DWIN32 -Wall -Wextra
+ CPPFLAGS=-g -O0 -DWIN32 -Wall -Wextra -std=gnu++11
LIBS=
EXEPOSTFIX=.exe
endif
@@ -595,9 +596,9 @@ testmemlimit_so$(EXEPOSTFIX): testmemlimit_so.o
$(OBJECTS) tstheap.o dumatest.o thread-test.o testmt.o dumatestpp.o: duma.h
-ifeq ($(OS), windows_nt)
- # do nothing
-else
+#ifeq ($(OS), windows_nt)
+# # do nothing
+#else
ifeq ($(OS), darwin)
$(DUMASO): duma_config.h verinfo.h $(SO_OBJECTS)
@@ -611,8 +612,8 @@ $(DUMASO): duma_config.h verinfo.h $(SO_OBJECTS)
# $(CXX) -g -shared -o $(DUMASO) $(SO_OBJECTS) -lpthread -lc
endif
-
-endif
+#
+#endif
#
# define rules how to build objects for createconf
Build log is like this:
$ make -f ./GNUmakefile OS=$(echo "$OS" | tr '[:upper:]' '[:lower:]' 2>/dev/null || true) OSTYPE=cygwin
using settings for OS=Windows_NT, OSTYPE=cygwin
using default prefix [/usr]
using default srcdir [.]
using default exec_prefix [/usr]
./make_git_source_version.sh > ./verinfo.h
c++ -g -O0 -DWIN32 -Wall -Wextra -std=gnu++11 -c dumapp.cpp -o dumapp.o
dumapp.cpp: In function ‘void* duma_new_operator(std::size_t, _DUMA_Allocator, bool, const char*, int)’:
dumapp.cpp:166:29: warning: catching polymorphic type ‘class std::bad_alloc’ by value [-Wcatch-value=]
166 | catch (std::bad_alloc) // error occured in new_handler
| ^~~~~~~~~
cc -g -O0 -DWIN32 -Wall -Wextra -c duma.c -o duma.o
cc -g -O0 -DWIN32 -Wall -Wextra -c sem_inc.c -o sem_inc.o
cc -g -O0 -DWIN32 -Wall -Wextra -c print.c -o print.o
print.c: In function ‘DUMA_Abort’:
print.c:278:13: warning: variable ‘lenb’ set but not used [-Wunused-but-set-variable]
278 | int lena, lenb;
| ^~~~
print.c: In function ‘DUMA_Exit’:
print.c:363:13: warning: variable ‘lenb’ set but not used [-Wunused-but-set-variable]
363 | int lena, lenb;
| ^~~~
rm -f libduma.a
ar crv libduma.a dumapp.o duma.o sem_inc.o print.o
a - dumapp.o
a - duma.o
a - sem_inc.o
a - print.o
ranlib libduma.a
c++ -g -O0 -DWIN32 -Wall -Wextra -std=gnu++11 -fPIC -DPIC -DDUMA_SO_LIBRARY -c dumapp.cpp -o dumapp_so.o
dumapp.cpp: In function ‘void* duma_new_operator(std::size_t, _DUMA_Allocator, bool)’:
dumapp.cpp:166:29: warning: catching polymorphic type ‘class std::bad_alloc’ by value [-Wcatch-value=]
166 | catch (std::bad_alloc) // error occured in new_handler
| ^~~~~~~~~
cc -g -O0 -DWIN32 -Wall -Wextra -fPIC -DPIC -DDUMA_SO_LIBRARY -c duma.c -o duma_so.o
duma.c:141:19: warning: ‘unknown_file’ defined but not used [-Wunused-const-variable=]
141 | static const char unknown_file[] =
| ^~~~~~~~~~~~
cc -g -O0 -DWIN32 -Wall -Wextra -fPIC -DPIC -DDUMA_SO_LIBRARY -c sem_inc.c -o sem_inc_so.o
cc -g -O0 -DWIN32 -Wall -Wextra -fPIC -DPIC -DDUMA_SO_LIBRARY -c print.c -o print_so.o
print.c: In function ‘DUMA_Abort’:
print.c:278:13: warning: variable ‘lenb’ set but not used [-Wunused-but-set-variable]
278 | int lena, lenb;
| ^~~~
print.c: In function ‘DUMA_Exit’:
print.c:363:13: warning: variable ‘lenb’ set but not used [-Wunused-but-set-variable]
363 | int lena, lenb;
| ^~~~
c++ -g -shared -Wl,-soname,libduma.dll -o libduma.dll dumapp_so.o duma_so.o sem_inc_so.o print_so.o -lpthread -lc
cc -g -O0 -DWIN32 -Wall -Wextra -fPIC -DPIC -DDUMA_SO_LIBRARY -c tests/tstheap.c -o tstheap_so.o
rm -f tstheap_so.exe
cc -g -O0 -DWIN32 -Wall -Wextra tstheap_so.o -o tstheap_so.exe
c++ -g -O0 -DWIN32 -Wall -Wextra -std=gnu++11 -fPIC -DPIC -DDUMA_SO_LIBRARY -c tests/dumatestpp.cpp -o dumatestpp_so.o
rm -f dumatestpp_so.exe
c++ -g -O0 -DWIN32 -Wall -Wextra -std=gnu++11 dumatestpp_so.o -o dumatestpp_so.exe
Build complete - you can now run make test.
... and running make check
basically just outputs this as extra at end:
DUMA static confidence test PASSED.
.
Testing DUMA (dynamic library).
(export LD_PRELOAD=./libduma.dll; export DYLD_INSERT_LIBRARIES=./libduma.dll; export DYLD_FORCE_FLAT_NAMESPACE=1 ; exec ./tstheap_so 3072)
DUMA 2.5.21-0-ge214a6e-dirty, built 10/11/21 09:17:01 (shared library, NO_LEAKDETECTION)
Copyright (C) 2006 Michael Eddington <meddington@gmail.com>
Copyright (C) 2002-2009 Hayati Ayguen <h_ayguen@web.de>, Procitec GmbH
Copyright (C) 1987-1999 Bruce Perens <bruce@perens.com>
.
DUMA dynamic confidence test PASSED.
.
You may now run make install and then installcheck
.
@sdbbs
Thank you for the report.
As you can obviously tell, I've not tried to use DUMA on Cygwin recently (that is, in many years), and not since changes were made to the Makefiles, hence the issues you had. I apologize for that, and I'll get your Cygwin-related Makefile fixes integrated into master sometime this week.
I've installed the current Cygwin release in Windows 11 in a virtual machine here, and I'll be testing it this week.
I recall there was some issue using the dynamic library as well, but your confidence test passing above seems to indicate that's also outdated. I'll do a few other tests but I think this default is also safe to change.
As far as I can tell, there aren't any "old" Cygwin versions easily available - the Cygwin installer is a network installer that installs the most recent software, in the style of a "rolling" distribution -- while that makes things a little tough to pin down and to document, such as when something started working, it also means there isn't any major concerns about backwards (in)compatibilities.
About the C++ warning - it is, for now, just warning and should have no effect on your use of DUMA at this time. I'm aware of it and will probably have to make changes in the future, but I've avoided making major and possibly breaking changes that aren't strictly necessary, at least for now. We have enough "churn" that I don't want to introduce it into my debugging tools unnecessarily.
A quick test on Windows shows another minor but annoying bug - the version information script doesn't like to run from a directory that contains spaces, so I'll fix that too.
Have you tried using the CMake build system on Cygwin? If you have (or you get to it before I do), please advise me of the experience.
Thanks for the response, @johnsonjh - great to have a status on how thing are!
As far as I can tell, there aren't any "old" Cygwin versions easily available - the Cygwin installer is a network installer that installs the most recent software, in the style of a "rolling" distribution
Yeah, that is my experience as well...
while that makes things a little tough to pin down and to document, such as when something started working, it also means there isn't any major concerns about backwards (in)compatibilities.
Agreed!
About the C++ warning - it is, for now, just warning and should have no effect on your use of DUMA at this time.
Good - thanks for confirming!
Have you tried using the CMake build system on Cygwin? If you have (or you get to it before I do), please advise me of the experience.
No I haven't - I'm not much of a CMake guy, so I only use it when instructions tell me I have to :) So unfortunately, I will not be able to report back on the experience...
Thanks again for the response!
Just got a working Cygwin configuration up.
Just to update you, looks like some extra adjustments will need to be done to get current Cygwin working in master, and have it work the same way in both Cmake and GNU Make.
If your local changes above are sufficient for you, they should work sufficiently for now.
Will handle with #193
I'm trying to build the DUMA library on cygwin:
I'm trying to follow https://github.com/johnsonjh/duma/blob/b35dea7/README.md:
Ok:
skipped, because:
OK:
https://stackoverflow.com/questions/16135945/is-there-a-cygwin-version-of-gnu-make :
Ok, then, let's try with
make
:Now, I've been setting variables on the
make
command line before, it should work - I have no idea why it does not work here?!Even trying to set as an environment variable (in front of the command line) fails:
Strangely, both $OS and $OSTYPE exist in cygwin - in a brand new bash shell:
Actually, it seems that the makefile depends on OS being lowercase:
... and also:
So, I added this line
$(info using OS $(OS) OSTYPE $(OSTYPE))
to Makefile (before "# some OS specifics"), and I can see:Right, so cygwin_nt-10.0 is definitely not a match; trying this, having removed my print line from above
For some reason, there is a tab at start of line 159:
If I manually replace the TAB with four spaces, finally I get something:
Well,
/bin/sh: ./make_git_source_version.sh: No such file or directory
occurs because we're inbuild
subdirectory, andmake_git_source_version.sh
exists in its parent ... The problem here is that the makefile uses:CURPATH gets set per OS/OSTYPE, and for cygwin it is
./
, so here, I replaced it with this (via https://stackoverflow.com/a/23324703/6197439):Now we get a bit further, but still:
Again looks like this is some path mess, due to being in
build
subdirectory ...So, I decided to check out everything again, and try run the commands without
mkdir build && cd build
; I still had to change the tab to spaces as per above, but now I got:And
make test
seems to work (sort of):(Note, I get the same result, if I replace the
test
in the above command line withcheck
)Well, it turns out, the current C++ standard for
g++
in Cygwin is indeed C++17 (via https://stackoverflow.com/a/44735016/6197439):So, I cannot really tell if the above works as expected, or not - it does look like it works, but I'm not really sure ...
Anyways, just wanted to report this - hope at least I can manage to use what I have, so I can debug my program :)