Cygwin instructions in README do not work
- Dominant language
- C
- Stars
- 121
- Forks
- 12
- Avg merge
- 3h 13m
- Merged PRs (30d)
- 1
Description
I'm trying to build the DUMA library on cygwin:
```
$ uname -a
CYGWIN_NT-10.0 DESKTOP-MYPC 3.2.0(0.340/5/3) 2021-03-29 08:42 x86_64 Cygwin
```
I'm trying to follow https://github.com/johnsonjh/duma/blob/b35dea7/README.md:
> - Inside the unpacked **DUMA** source directory, create and change to a
> new `build` directory
> - `mkdir build && cd build`
>
Ok:
```
$ git clone https://github.com/johnsonjh/duma.git duma_git
$ cd duma_git/
$ git describe --abbrev=0
VERSION_2_5_21
$ git checkout VERSION_2_5_21
Updating files: 100% (301/301), done.
Note: switching to 'VERSION_2_5_21'.
...
$ mkdir build && cd build
```
> - (_Optionally_) review `GNUmakefile` for configuration, compilation,
> and installation options
>
skipped, because:
> - Build **DUMA**
> - ...
> - `gmake -f ../GNUmakefile OSTYPE=cygwin`
> (_for Microsoft Windows with Cygwin_)
>
OK:
```
$ gmake -f ../GNUmakefile OSTYPE=cygwin
bash: gmake: command not found
```
https://stackoverflow.com/questions/16135945/is-there-a-cygwin-version-of-gnu-make :
> The `make` package is GNU make
Ok, then, let's try with `make`:
```
$ make -f ../GNUmakefile OSTYPE=cygwin
../GNUmakefile:293: using default options. OS/OSTYPE not set or contain unknown values!
using default prefix [/usr]
using default srcdir [.]
using default exec_prefix [/usr]
./make_git_source_version.sh > ./verinfo.h
/bin/sh: ./make_git_source_version.sh: No such file or directory
make: [../GNUmakefile:540: verinfo.h] Error 127 (ignored)
make reconfig
make[1]: Entering directory '/cygdrive/c/src/duma_git/build'
make[1]: *** No rule to make target 'reconfig'. Stop.
make[1]: Leaving directory '/cygdrive/c/src/duma_git/build'
make: *** [../GNUmakefile:544: duma_config.h] Error 2
```
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:
```
$ OSTYPE=cygwin make -f ../GNUmakefile
../GNUmakefile:293: using default options. OS/OSTYPE not set or contain unknown values!
```
Strangely, both $OS and $OSTYPE exist in cygwin - in a brand new bash shell:
```
$ echo $OS
Windows_NT
$ echo $OSTYPE
cygwin
```
Actually, it seems that the makefile depends on OS being lowercase:
```
ifndef $(OS)
OS=$(shell uname -s 2>/dev/null | tr '[:upper:]' '[:lower:]' 2>/dev/null || true)
endif
```
... and also:
```
# some OS specifics:
ifeq ($(OS), windows_nt)
ifeq ($(OSTYPE), msys)
```
So, I added this line `$(info using OS $(OS) OSTYPE $(OSTYPE))` to Makefile (before "# some OS specifics"), and I can see:
```
$ make -f ../GNUmakefile OS=$(uname -s 2>/dev/null | tr '[:upper:]' '[:lower:]' 2>/dev/null || true) OSTYPE=cygwin
using OS cygwin_nt-10.0 OSTYPE cygwin
../GNUmakefile:295: using default options. OS/OSTYPE not set or contain unknown values!
```
Right, so cygwin_nt-10.0 is definitely not a match; trying this, having removed my print line from above
```
$ make -f ../GNUmakefile OS=$(echo "$OS" | tr '[:upper:]' '[:lower:]' 2>/dev/null || true) OSTYPE=cygwin
using OS windows_nt OSTYPE cygwin
../GNUmakefile:159: *** recipe commences before first target. Stop.
```
For some reason, there is a tab at start of line 159:
$(info using settings for OS=Windows_NT, OSTYPE=cygwin)
If I manually replace the TAB with four spaces, finally I get something:
```
$ 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
/bin/sh: ./make_git_source_version.sh: No such file or directory
make: [../GNUmakefile:540: verinfo.h] Error 127 (ignored)
make reconfig
make[1]: Entering directory '/cygdrive/c/src/duma_git/build'
make[1]: *** No rule to make target 'reconfig'. Stop.
make[1]: Leaving directory '/cygdrive/c/src/duma_git/build'
make: *** [../GNUmakefile:544: duma_config.h] Error 2
```
Well, `/bin/sh: ./make_git_source_version.sh: No such file or directory` occurs because we're in `build` subdirectory, and `make_git_source_version.sh` exists in its parent ... The problem here is that the makefile uses:
$(CURPATH)make_git_source_version.sh > $(CURPATH)verinfo.h
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):
CURPATH=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))/
Now we get a bit further, but still:
```
$ 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]
/cygdrive/c/src/duma_git/make_git_source_version.sh > /cygdrive/c/src/duma_git/verinfo.h
make reconfig
make[1]: Entering directory '/cygdrive/c/src/duma_git/build'
make[1]: *** No rule to make target 'reconfig'. Stop.
make[1]: Leaving directory '/cygdrive/c/src/duma_git/build'
make: *** [../GNUmakefile:544: duma_config.h] Error 2
```
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:
```
$ cd duma_git/
$ 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
make reconfig
make[1]: Entering directory '/cygdrive/c/src/duma_git'
using settings for OS=Windows_NT, OSTYPE=cygwin
using default prefix [/usr]
using default srcdir [.]
using default exec_prefix [/usr]
cc -g -O0 -DWIN32 -Wall -Wextra -DDUMA_SO_NO_LEAKDETECTION -DDUMA_EXPLICIT_INIT -c createconf.c -o createconf.o
createconf.c: In function ‘testAlignment’:
createconf.c:130:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
130 | TYPE addr = (TYPE)(buffer) + offset;
| ^
...
a - dumapp.o
a - duma.o
a - sem_inc.o
a - print.o
ranlib libduma.a
Build complete - you can now run make test.
```
And `make test` seems to work (sort of):
```
$ make -f ./GNUmakefile OS=$(echo "$OS" | tr '[:upper:]' '[:lower:]' 2>/dev/null || true) OSTYPE=cygwin test
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 -c tests/dumatestpp.cpp -o dumatestpp.o
rm -f dumatestpp.exe
c++ -g -O0 -DWIN32 -Wall -Wextra dumatestpp.o libduma.a -o dumatestpp.exe
c++ -g -O0 -DWIN32 -Wall -Wextra -c tests/testoperators.cpp -o testoperators.o
tests/testoperators.cpp:40:65: error: ISO C++17 does not allow dynamic exception specifications
40 | void * operator new( DUMA_SIZE_T ) throw(std::bad_alloc);
| ^~~~~
tests/testoperators.cpp:46:65: error: ISO C++17 does not allow dynamic exception specifications
46 | void * operator new[]( DUMA_SIZE_T ) throw(std::bad_alloc);
| ^~~~~
tests/testoperators.cpp:53:81: error: ISO C++17 does not allow dynamic exception specifications
53 | void * operator new( DUMA_SIZE_T, const char *, int ) throw( std::bad_alloc );
| ^~~~~
tests/testoperators.cpp:59:83: error: ISO C++17 does not allow dynamic exception specifications
59 | void * operator new[]( DUMA_SIZE_T, const char *, int ) throw( std::bad_alloc );
| ^~~~~
tests/testoperators.cpp:73:1: error: ISO C++17 does not allow dynamic exception specifications
73 | throw(std::bad_alloc)
| ^~~~~
tests/testoperators.cpp:104:1: error: ISO C++17 does not allow dynamic exception specifications
104 | throw(std::bad_alloc)
| ^~~~~
tests/testoperators.cpp:132:1: error: ISO C++17 does not allow dynamic exception specifications
132 | throw( std::bad_alloc )
| ^~~~~
tests/testoperators.cpp:160:1: error: ISO C++17 does not allow dynamic exception specifications
160 | throw( std::bad_alloc )
| ^~~~~
make: *** [GNUmakefile:679: testoperators.o] Error 1
```
(Note, I get the same result, if I replace the `test` in the above command line with `check`)
Well, it turns out, the current C++ standard for `g++` in Cygwin is indeed C++17 (via https://stackoverflow.com/a/44735016/6197439):
```
$ g++ -dM -E -x c++ /dev/null | grep -F __cplusplus
#define __cplusplus 201703L
```
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 :)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.