[GH-ISSUE #1250] Cygwin build problem #788

Closed
opened 2026-10-14 03:23:58 +07:00 by bsakaguchi · 61 comments
Owner

Originally created by @magnumripper on GitHub (May 1, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1250

Originally assigned to: @jfoug on GitHub.

Reported by Rich Rumble

./configure --enable-mpi &&  make clean && make
...
Configured for building John the Ripper jumbo:

Target CPU .................................. i686 AVX, 32-bit LE
AES-NI support .............................. depends on OpenSSL
Target OS ................................... cygwin
Cross compiling ............................. no
Legacy arch header .......................... x86-sse.h

Optional libraries/features found:
Experimental code ........................... no
OpenMPI support (default disabled) .......... yes
Fork support ................................ yes
OpenMP support .............................. yes
OpenCL support .............................. no
CUDA support ................................ no
Generic crypt(3) format ..................... yes
Rexgen (extra cracking mode) ................ no
GMP (PRINCE mode and faster SRP formats) .... yes
128-bit integer (faster PRINCE mode) ........ no
PCAP (vncpcap2john and SIPdump) ............. no
BZ2 (gpg2john extra decompression logic) .... yes
Memory map (share/page large files) ......... yes

Development options (these may hurt performance when enabled):
Memdbg memory debugging settings ............ disabled
AddressSanitizer ("ASan") ................... disabled
....

ERROR:

d-declarations -Wno-format-extra-args -std=gnu89 -D_GNU_SOURCE
-fopenmp -DHAVE_MPI    -funroll-loops -DJTR_MODE
-Wno-declaration-after-statement -std=c99 -c pp.c
pp.c: In function ‘do_prince_crack’:
pp.c:1466:22: warning: implicit declaration of function ‘fileno’
[-Wimplicit-function-declaration]
                      fileno(read_fp), 0);
                      ^
mpicc -DAC_BUILT -march=native -mavx -c -g -O2 -DARCH_LITTLE_ENDIAN=1
 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param
allow-store-data-races=0 -Wno-deprecated-declarations
-Wno-format-extra-args -std=gnu89 -D_GNU_SOURCE    -fopenmp -DHAVE_MPI
   -funroll-loops c3_fmt.c -o c3_fmt.o
mpicc -DAC_BUILT -march=native -mavx -c -g -O2 -DARCH_LITTLE_ENDIAN=1
 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param
allow-store-data-races=0 -Wno-deprecated-declarations
-Wno-format-extra-args -std=gnu89 -D_GNU_SOURCE    -fopenmp -DHAVE_MPI
   -funroll-loops unique.c -o unique.o
In file included from /usr/include/sys/_default_fcntl.h:196:0,
                 from /usr/include/sys/fcntl.h:3,
                 from /usr/include/fcntl.h:15,
                 from unique.c:37:
/usr/include/sys/time.h:99:34: error: unknown type name ‘u_int’
 bintime_mul(struct bintime *_bt, u_int _x)
                                  ^
Makefile:1328: recipe for target 'unique.o' failed
make[1]: *** [unique.o] Error 1
make[1]: Leaving directory '/cygdrive/c/cygwin/john/src'
Makefile:182: recipe for target 'default' failed
make: *** [default] Error 2
Originally created by @magnumripper on GitHub (May 1, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1250 Originally assigned to: @jfoug on GitHub. Reported by Rich Rumble ``` ./configure --enable-mpi && make clean && make ... Configured for building John the Ripper jumbo: Target CPU .................................. i686 AVX, 32-bit LE AES-NI support .............................. depends on OpenSSL Target OS ................................... cygwin Cross compiling ............................. no Legacy arch header .......................... x86-sse.h Optional libraries/features found: Experimental code ........................... no OpenMPI support (default disabled) .......... yes Fork support ................................ yes OpenMP support .............................. yes OpenCL support .............................. no CUDA support ................................ no Generic crypt(3) format ..................... yes Rexgen (extra cracking mode) ................ no GMP (PRINCE mode and faster SRP formats) .... yes 128-bit integer (faster PRINCE mode) ........ no PCAP (vncpcap2john and SIPdump) ............. no BZ2 (gpg2john extra decompression logic) .... yes Memory map (share/page large files) ......... yes Development options (these may hurt performance when enabled): Memdbg memory debugging settings ............ disabled AddressSanitizer ("ASan") ................... disabled .... ERROR: d-declarations -Wno-format-extra-args -std=gnu89 -D_GNU_SOURCE -fopenmp -DHAVE_MPI -funroll-loops -DJTR_MODE -Wno-declaration-after-statement -std=c99 -c pp.c pp.c: In function ‘do_prince_crack’: pp.c:1466:22: warning: implicit declaration of function ‘fileno’ [-Wimplicit-function-declaration] fileno(read_fp), 0); ^ mpicc -DAC_BUILT -march=native -mavx -c -g -O2 -DARCH_LITTLE_ENDIAN=1 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param allow-store-data-races=0 -Wno-deprecated-declarations -Wno-format-extra-args -std=gnu89 -D_GNU_SOURCE -fopenmp -DHAVE_MPI -funroll-loops c3_fmt.c -o c3_fmt.o mpicc -DAC_BUILT -march=native -mavx -c -g -O2 -DARCH_LITTLE_ENDIAN=1 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param allow-store-data-races=0 -Wno-deprecated-declarations -Wno-format-extra-args -std=gnu89 -D_GNU_SOURCE -fopenmp -DHAVE_MPI -funroll-loops unique.c -o unique.o In file included from /usr/include/sys/_default_fcntl.h:196:0, from /usr/include/sys/fcntl.h:3, from /usr/include/fcntl.h:15, from unique.c:37: /usr/include/sys/time.h:99:34: error: unknown type name ‘u_int’ bintime_mul(struct bintime *_bt, u_int _x) ^ Makefile:1328: recipe for target 'unique.o' failed make[1]: *** [unique.o] Error 1 make[1]: Leaving directory '/cygdrive/c/cygwin/john/src' Makefile:182: recipe for target 'default' failed make: *** [default] Error 2 ```
bsakaguchi 2026-10-14 03:23:58 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@magnumripper commented on GitHub (May 1, 2015):

pp.c:1466:22: warning: implicit declaration of function ‘fileno’

We seem to need a feature macro

fileno(): _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE

We seem to only get _GNU_SOURCE. But that's only a minor problem. I have no idea what could cause the unique.c problem.

<!-- gh-comment-id:98176911 --> @magnumripper commented on GitHub (May 1, 2015): > `pp.c:1466:22: warning: implicit declaration of function ‘fileno’` We seem to need a feature macro ``` fileno(): _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE ``` We seem to only get _GNU_SOURCE. But that's only a minor problem. I have no idea what could cause the unique.c problem.
Author
Owner

@richrumble commented on GitHub (May 1, 2015):

This was cygwin-x86 btw, not cygwin-x86_64. Just in case that makes a difference.

<!-- gh-comment-id:98188176 --> @richrumble commented on GitHub (May 1, 2015): This was cygwin-x86 btw, not cygwin-x86_64. Just in case that makes a difference.
Author
Owner

@magnumripper commented on GitHub (May 1, 2015):

Did you build this before without this problem? I'm not sure whether this is specific to some Cygwin version or a new-ish bug in Jumbo.

<!-- gh-comment-id:98241523 --> @magnumripper commented on GitHub (May 1, 2015): Did you build this before without this problem? I'm not sure whether this is specific to some Cygwin version or a new-ish bug in Jumbo.
Author
Owner

@magnumripper commented on GitHub (May 1, 2015):

c09d11c should fix the pp.c warning.

<!-- gh-comment-id:98246935 --> @magnumripper commented on GitHub (May 1, 2015): c09d11c should fix the pp.c warning.
Author
Owner

@magnumripper commented on GitHub (May 1, 2015):

I'm afraid we'll have to wait for @jfoug to come back for the rest.

<!-- gh-comment-id:98251227 --> @magnumripper commented on GitHub (May 1, 2015): I'm afraid we'll have to wait for @jfoug to come back for the rest.
Author
Owner

@frank-dittrich commented on GitHub (May 1, 2015):

Some googling suggests that u_int might be undefined due to

#define _POSIX_SOURCE /* for fdopen(3) */

see https://stackoverflow.com/questions/15393905/c-pcap-library-unknown-types-error

Since we need _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE for fileno, my only idea is trying to move

#if !AC_BUILT || HAVE_FCNTL_H
#include <fcntl.h>
#endif

above the

#define _POSIX_SOURCE /* for fdopen(3) */

and see if that helps.

<!-- gh-comment-id:98256208 --> @frank-dittrich commented on GitHub (May 1, 2015): Some googling suggests that u_int might be undefined due to ``` #define _POSIX_SOURCE /* for fdopen(3) */ ``` see https://stackoverflow.com/questions/15393905/c-pcap-library-unknown-types-error Since we need `_POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE` for fileno, my only idea is trying to move ``` #if !AC_BUILT || HAVE_FCNTL_H #include <fcntl.h> #endif ``` above the ``` #define _POSIX_SOURCE /* for fdopen(3) */ ``` and see if that helps.
Author
Owner

@frank-dittrich commented on GitHub (May 1, 2015):

Alternatively, try adding

#define _BSD_SOURCE /* for u_int */

before the

#define _POSIX_SOURCE /* for fdopen(3) */

and see if that helps.
That is the similar to the second suggestion from
https://stackoverflow.com/questions/15393905/c-pcap-library-unknown-types-error

<!-- gh-comment-id:98257025 --> @frank-dittrich commented on GitHub (May 1, 2015): Alternatively, try adding ``` #define _BSD_SOURCE /* for u_int */ ``` before the ``` #define _POSIX_SOURCE /* for fdopen(3) */ ``` and see if that helps. That is the similar to the second suggestion from https://stackoverflow.com/questions/15393905/c-pcap-library-unknown-types-error
Author
Owner

@magnumripper commented on GitHub (May 2, 2015):

Feature macros must be defined prior to including any system header - trying to shuffle things around is really asking for more trouble (even if it would work on this system, it may well break others). I guess adding _BSD_SOURCE might be a better option, if it helps.

I wonder though why this happens now and not before? unique.c hasn't change for a long time.

<!-- gh-comment-id:98344167 --> @magnumripper commented on GitHub (May 2, 2015): Feature macros must be defined prior to including any system header - trying to shuffle things around is really asking for more trouble (even if it would work on this system, it may well break others). I guess adding _BSD_SOURCE might be a better option, if it helps. I wonder though why this happens now and not before? unique.c hasn't change for a long time.
Author
Owner

@magnumripper commented on GitHub (May 2, 2015):

I suppose this is a core problem since the #define _POSIX_SOURCE 1 is in core.

<!-- gh-comment-id:98346742 --> @magnumripper commented on GitHub (May 2, 2015): I suppose this is a core problem since the `#define _POSIX_SOURCE 1` is in core.
Author
Owner

@magnumripper commented on GitHub (May 5, 2015):

Try using ./configure --enable-mpi CFLAGS="-g -O2 -D_BSD_SOURCE". Does that help?

<!-- gh-comment-id:98965234 --> @magnumripper commented on GitHub (May 5, 2015): Try using `./configure --enable-mpi CFLAGS="-g -O2 -D_BSD_SOURCE"`. Does that help?
Author
Owner

@magnumripper commented on GitHub (May 5, 2015):

BTW just to rule it out: Does omitting --enable-mpi help?

<!-- gh-comment-id:99228971 --> @magnumripper commented on GitHub (May 5, 2015): BTW just to rule it out: Does omitting `--enable-mpi` help?
Author
Owner

@magnumripper commented on GitHub (May 5, 2015):

Oh, and another thing to try: Can you build core 1.8.0 without problems?

<!-- gh-comment-id:99253488 --> @magnumripper commented on GitHub (May 5, 2015): Oh, and another thing to try: Can you build core 1.8.0 without problems?
Author
Owner

@richrumble commented on GitHub (May 6, 2015):

I can make 1.8.0 in 32-bit Cygwin on windows (make win32-cygwin-x86-sse2). The latest GIT I get the same errors above on 64 and 32. I left off mpi with no effect and the CFLAGS="-g -O2 -D_BSD_SOURCE" made no difference either.

<!-- gh-comment-id:99270811 --> @richrumble commented on GitHub (May 6, 2015): I can make 1.8.0 in 32-bit Cygwin on windows (make win32-cygwin-x86-sse2). The latest GIT I get the same errors above on 64 and 32. I left off mpi with no effect and the CFLAGS="-g -O2 -D_BSD_SOURCE" made no difference either.
Author
Owner

@magnumripper commented on GitHub (May 6, 2015):

So it's Jumbo-only. I really can't see what caused this, someone needs to bisect it. @frank-dittrich do you ever touch Windows stuff?

<!-- gh-comment-id:99356395 --> @magnumripper commented on GitHub (May 6, 2015): So it's Jumbo-only. I really can't see what caused this, someone needs to bisect it. @frank-dittrich do you ever touch Windows stuff?
Author
Owner

@frank-dittrich commented on GitHub (May 6, 2015):

Only if I have to (i.e., for work). And I wouldn't want to install cygwin etc. on those machines, not knowing how that might interfere with the stuff I really need.

But I think, given a pointer on how to do a git bisect, Rich should be able to do it as well.
Trouble is that we do have several broken commits which don't even compile for other architectures, so the git bisect could end up pointing to the wrong commit if you can't distinguish cygwin specific breakage from "normal" breakage.

BTW, is a legacy build working for cygwin?

<!-- gh-comment-id:99358435 --> @frank-dittrich commented on GitHub (May 6, 2015): Only if I have to (i.e., for work). And I wouldn't want to install cygwin etc. on those machines, not knowing how that might interfere with the stuff I really need. But I think, given a pointer on how to do a git bisect, Rich should be able to do it as well. Trouble is that we do have several broken commits which don't even compile for other architectures, so the `git bisect` could end up pointing to the wrong commit if you can't distinguish cygwin specific breakage from "normal" breakage. BTW, is a legacy build working for cygwin?
Author
Owner

@richrumble commented on GitHub (May 6, 2015):

On Wed, May 6, 2015 at 3:46 AM, frank-dittrich notifications@github.com
wrote:

Only if I have to (i.e., for work). And I wouldn't want to install cygwin
etc. on those machines, not knowing how that might interfere with the stuff
I really need.

But I think, given a pointer on how to do a git bisect, Rich should be
able to do it as well.
Trouble is that we do have several broken commits which don't even compile
for other architectures, so the git bisect could end up pointing to the
wrong commit if you can't distinguish cygwin specific breakage from
"normal" breakage.

BTW, is a legacy build working for cygwin?

I will do my best to find where cygwin broke, I know I compiled it a few
months ago, so I'll start looking around, might be this weekend before I
get to tracking it down.
-rich

<!-- gh-comment-id:99537413 --> @richrumble commented on GitHub (May 6, 2015): On Wed, May 6, 2015 at 3:46 AM, frank-dittrich notifications@github.com wrote: > Only if I have to (i.e., for work). And I wouldn't want to install cygwin > etc. on those machines, not knowing how that might interfere with the stuff > I really need. > > But I think, given a pointer on how to do a git bisect, Rich should be > able to do it as well. > Trouble is that we do have several broken commits which don't even compile > for other architectures, so the git bisect could end up pointing to the > wrong commit if you can't distinguish cygwin specific breakage from > "normal" breakage. > > BTW, is a legacy build working for cygwin? > > I will do my best to find where cygwin broke, I know I compiled it a few > months ago, so I'll start looking around, might be this weekend before I > get to tracking it down. > -rich
Author
Owner

@shinnok commented on GitHub (May 13, 2015):

I also stumbled on this. Here are my details:

Platform: Windows 7/ Cygwin 2.0 / gcc version 4.9.2 (fresh install)
Core(master): builds and runs fine
Jumbo: bleeding-jumbo, 1.8.0-jumbo-1, 1.7.9-jumbo-7 all fail under this issue
enable-mpi: doesn't affect outcome

By looking at the first occurrence in my build process and a subsequent git blame on ssh2john.c I think it might be worth first reviewing this fairly recent commits 6c19fd94c8 and 94b501da3d, before proceeding to the time consuming bisect.

<!-- gh-comment-id:101569675 --> @shinnok commented on GitHub (May 13, 2015): I also stumbled on this. Here are my details: Platform: Windows 7/ Cygwin 2.0 / gcc version 4.9.2 (fresh install) Core(master): builds and runs fine Jumbo: bleeding-jumbo, 1.8.0-jumbo-1, 1.7.9-jumbo-7 all fail under this issue enable-mpi: doesn't affect outcome By looking at the first occurrence in my build process and a subsequent git blame on ssh2john.c I think it might be worth first reviewing this fairly recent commits 6c19fd94c86ed13a36f340d41a781ba2b4a7afce and 94b501da3d265f52f91555253e8902cd1c632c28, before proceeding to the time consuming bisect.
Author
Owner

@magnumripper commented on GitHub (May 13, 2015):

Thank you! If even 1.7.9-jumbo-7 fails now, a Cygwin change must be the reason. 6c19fd9 and 94b501d are irrelevant since they happened way after 1.7.9.

This means it's not so much about finding out what we did or when, but what they did - so we can adopt. Installing/testing a bunch of older Cygwin versions might be tedious. I'll have a look at their listed changes for each version if I can find it.

<!-- gh-comment-id:101574026 --> @magnumripper commented on GitHub (May 13, 2015): Thank you! If even 1.7.9-jumbo-7 fails now, a Cygwin change must be the reason. 6c19fd9 and 94b501d are irrelevant since they happened way after 1.7.9. This means it's not so much about finding out what we did or when, but what **they** did - so we can adopt. Installing/testing a bunch of older Cygwin versions might be tedious. I'll have a look at their listed changes for each version if I can find it.
Author
Owner

@shinnok commented on GitHub (May 13, 2015):

@magnumripper I take the 1.7.9-jumbo-7 part back. I got confused yesterday by the amount of stuff I tried.

1.7.9-jumbo-7: builds fine in the same environ with target win32-cygwin-x86-any

<!-- gh-comment-id:101578743 --> @shinnok commented on GitHub (May 13, 2015): @magnumripper I take the 1.7.9-jumbo-7 part back. I got confused yesterday by the amount of stuff I tried. 1.7.9-jumbo-7: builds fine in the same environ with target win32-cygwin-x86-any
Author
Owner

@magnumripper commented on GitHub (May 13, 2015):

OK, then I'm suspecting the -std=gnu89 option we added to Makefile (because gcc 5.x needs it). What happens if you remove that?

It should work fine with -std=gnu89 though, but not -std=c89 if I got it right.

<!-- gh-comment-id:101587975 --> @magnumripper commented on GitHub (May 13, 2015): OK, then I'm suspecting the `-std=gnu89` option we added to Makefile (because gcc 5.x needs it). What happens if you remove that? It **should** work fine with `-std=gnu89` though, but not `-std=c89` if I got it right.
Author
Owner

@magnumripper commented on GitHub (May 13, 2015):

OTOH removing -std=gnu89 only works with gcc pre v5.0 unless we work around #1093 some other way.

<!-- gh-comment-id:101592491 --> @magnumripper commented on GitHub (May 13, 2015): OTOH removing `-std=gnu89` only works with gcc pre v5.0 unless we work around #1093 some other way.
Author
Owner

@magnumripper commented on GitHub (May 13, 2015):

unless we work around #1093 some other way.

Did so in e2e868d but kept the -std=gnu89 for now.

<!-- gh-comment-id:101607327 --> @magnumripper commented on GitHub (May 13, 2015): > unless we work around #1093 some other way. Did so in e2e868d but kept the `-std=gnu89` for now.
Author
Owner

@richrumble commented on GitHub (May 13, 2015):

Is there a way to "git clone sha-1" ... to "get" the repo up to a certain
commit? I've tried revert --hard and a few other options but no success.
In SVN it was always pretty simple to do, I can't seem to do the same thing
in GIT.

On Wed, May 13, 2015 at 5:31 AM, magnum notifications@github.com wrote:

OTOH removing -std=gnu89 only works with gcc pre v5.0 unless we work
around #1093 https://github.com/magnumripper/JohnTheRipper/issues/1093
some other way.

—
Reply to this email directly or view it on GitHub
https://github.com/magnumripper/JohnTheRipper/issues/1250#issuecomment-101592491
.

<!-- gh-comment-id:101608094 --> @richrumble commented on GitHub (May 13, 2015): Is there a way to "git clone _sha-1_" ... to "get" the repo up to a certain commit? I've tried revert --hard and a few other options but no success. In SVN it was always pretty simple to do, I can't seem to do the same thing in GIT. On Wed, May 13, 2015 at 5:31 AM, magnum notifications@github.com wrote: > OTOH removing -std=gnu89 only works with gcc pre v5.0 unless we work > around #1093 https://github.com/magnumripper/JohnTheRipper/issues/1093 > some other way. > > — > Reply to this email directly or view it on GitHub > https://github.com/magnumripper/JohnTheRipper/issues/1250#issuecomment-101592491 > .
Author
Owner

@magnumripper commented on GitHub (May 13, 2015):

That's OT but from an existing clone you can either

git reset --hard deadcafe (go back to normal with eg. git pull)
or
git checkout deadcafe (go back to normal with eg. git checkout bleeding-jumbo)

<!-- gh-comment-id:101609436 --> @magnumripper commented on GitHub (May 13, 2015): That's OT but from an existing clone you can either `git reset --hard deadcafe` (go back to normal with eg. `git pull`) or `git checkout deadcafe` (go back to normal with eg. `git checkout bleeding-jumbo`)
Author
Owner

@richrumble commented on GitHub (May 13, 2015):

On Wed, May 13, 2015 at 6:12 AM, magnum notifications@github.com wrote:

That's OT but from an existing clone you can either

git reset --hard deadcafe (go back to normal with eg. git pull)
or
git checkout deadcafe (go back to normal with eg. git checkout
bleeding-jumbo) these

Not so off topic :) I've narrowed it down to between these so far...
Compiles:
d647cc43cd 11-19-2014

Does not compile:
f3e0cdf06c 11-19-2014
configure: cygwin with latest compiler release requires _GNU_SOURCE also

I've compiled JtR like 60 times today :) It should be between those two as
far as I can tell. I went month by month, then week by week, day by day,
and now commit by commit.

I've been as vanilla as I can (no mpi)

git checkout
./configure && make clean && make -j8

f3e0cdf06c seems to be the culprit.

<!-- gh-comment-id:101809863 --> @richrumble commented on GitHub (May 13, 2015): On Wed, May 13, 2015 at 6:12 AM, magnum notifications@github.com wrote: > That's OT but from an existing clone you can either > > git reset --hard deadcafe (go back to normal with eg. git pull) > or > git checkout deadcafe (go back to normal with eg. git checkout > bleeding-jumbo) these > > Not so off topic :) I've narrowed it down to between these so far... > Compiles: > d647cc43cd012d4e898ca74142cd533b31a72482 11-19-2014 Does not compile: f3e0cdf06cb7e6e51520ab2a18ebb277fd630ed1 11-19-2014 configure: cygwin with latest compiler release requires _GNU_SOURCE also I've compiled JtR like 60 times today :) It should be between those two as far as I can tell. I went month by month, then week by week, day by day, and now commit by commit. I've been as vanilla as I can (no mpi) git checkout ./configure && make clean && make -j8 f3e0cdf06cb7e6e51520ab2a18ebb277fd630ed1 seems to be the culprit.
Author
Owner

@magnumripper commented on GitHub (May 13, 2015):

Wow, good job! You should learn git bisect though, it automates half of the process you did and usually finds the commit in 7-8 builds.

And WAT?! I was sure _GNU_SOURCE was part of the solution and not the problem! So what if you go back to latest code, run configure, then edit Makefile and remove all -D_GNU_SOURCE everywhere, then build. That should work then, right?

I wonder what was the exact reason @jfoug added it (he obviously WAS using Cygwin when he did). I'll search through the history and see if I can find a clue.

<!-- gh-comment-id:101813182 --> @magnumripper commented on GitHub (May 13, 2015): Wow, good job! You should learn `git bisect` though, it automates half of the process you did and usually finds the commit in 7-8 builds. And WAT?! I was sure `_GNU_SOURCE` was part of the solution and not the problem! So what if you go back to latest code, run configure, then edit Makefile and remove all `-D_GNU_SOURCE` everywhere, then build. That should work then, right? I wonder what was the exact reason @jfoug added it (he obviously WAS using Cygwin when he did). I'll search through the history and see if I can find a clue.
Author
Owner

@magnumripper commented on GitHub (May 13, 2015):

That was easy - he commented the commit:

NOTE, without this, cygwin64 will silently exit in ssh-ng, so it was something MORE than just warning about undefined memmem function.
The memmem calls are being done inside the OMP threads, and without this being properly defined, cygwin64 was NOT happy, and exited. This change also quiets the warning about implicit defined memmem function returning to a pointer.

<!-- gh-comment-id:101813820 --> @magnumripper commented on GitHub (May 13, 2015): That was easy - he commented the commit: _NOTE, without this, cygwin64 will silently exit in ssh-ng, so it was something MORE than just warning about undefined memmem function. The memmem calls are being done inside the OMP threads, and without this being properly defined, cygwin64 was NOT happy, and exited. This change also quiets the warning about implicit defined memmem function returning to a pointer._
Author
Owner

@magnumripper commented on GitHub (May 13, 2015):

So if his Cygwin64 needed that define, how come yours break because of it!?

<!-- gh-comment-id:101814827 --> @magnumripper commented on GitHub (May 13, 2015): So if his Cygwin64 **needed** that define, how come yours **break** because of it!?
Author
Owner

@richrumble commented on GitHub (May 13, 2015):

That worked! I ran configure (vanilla), removed the two -D_GNU_SOURCE from the Makefile and it compiled! This is Cygwin-64 btw...
$ uname -a
CYGWIN_NT-6.1 EXAMPLE 2.0.1(0.287/5/3) 2015-04-30 18:15 x86_64 Cygwin

$ ./john.exe --test
Will run 8 OpenMP threads
Benchmarking: descrypt, traditional crypt(3) [DES 128/128 SSE2-16]... (8xOMP) DONE
Many salts: 5383K c/s real, 759759 c/s virtual
Only one salt: 5058K c/s real, 680609 c/s virtual

Benchmarking: bsdicrypt, BSDI crypt(3) ("_J9..", 725 iterations) [DES 128/128 SSE2-16]... (8xOMP) DONE
Many salts: 170666 c/s real, 27065 c/s virtual
Only one salt: 164930 c/s real, 24811 c/s virtual

<!-- gh-comment-id:101819495 --> @richrumble commented on GitHub (May 13, 2015): That worked! I ran configure (vanilla), removed the two -D_GNU_SOURCE from the Makefile and it compiled! This is Cygwin-64 btw... $ uname -a CYGWIN_NT-6.1 EXAMPLE 2.0.1(0.287/5/3) 2015-04-30 18:15 x86_64 Cygwin $ ./john.exe --test Will run 8 OpenMP threads Benchmarking: descrypt, traditional crypt(3) [DES 128/128 SSE2-16]... (8xOMP) DONE Many salts: 5383K c/s real, 759759 c/s virtual Only one salt: 5058K c/s real, 680609 c/s virtual Benchmarking: bsdicrypt, BSDI crypt(3) ("_J9..", 725 iterations) [DES 128/128 SSE2-16]... (8xOMP) DONE Many salts: 170666 c/s real, 27065 c/s virtual Only one salt: 164930 c/s real, 24811 c/s virtual </snip>
Author
Owner

@magnumripper commented on GitHub (May 13, 2015):

Very odd. I'm not sure whether I should revert that commit or not. It's likely the -D_GNU_SOURCE macro is needed in certain cases - but which? I take it @jfoug used a fresh version of Cygwin at the time.

At least we now know a workaround!

<!-- gh-comment-id:101841133 --> @magnumripper commented on GitHub (May 13, 2015): Very odd. I'm not sure whether I should revert that commit or not. It's likely the `-D_GNU_SOURCE` macro is needed in certain cases - but which? I take it @jfoug used a fresh version of Cygwin at the time. At least we now know a workaround!
Author
Owner

@magnumripper commented on GitHub (May 13, 2015):

@richrumble what if you, instead of deleting -D_GNU_SOURCE add -D__GNU_VISIBLE at both places, right after the former? If that works I think I can commit it without risk.

BTW I found #856 telling about the history and it too mentions __GNU_VISIBLE. It says _GNU_SOURCE will imply __GNU_VISIBLE but it should not hurt trying. Something is amiss for sure - the _GNU_SOURCE really is supposed to fix issues like this, not cause them.

<!-- gh-comment-id:101845784 --> @magnumripper commented on GitHub (May 13, 2015): @richrumble what if you, instead of deleting `-D_GNU_SOURCE` **add** `-D__GNU_VISIBLE` at both places, right after the former? If that works I think I can commit it without risk. BTW I found #856 telling about the history and it too mentions `__GNU_VISIBLE`. It says `_GNU_SOURCE` will imply `__GNU_VISIBLE` but it should not hurt trying. Something is amiss for sure - the `_GNU_SOURCE` really is supposed to fix issues like this, not cause them.
Author
Owner

@richrumble commented on GitHub (May 14, 2015):

Nope... fails if leave -D_GNU_SOURCE, but replace it with Visible and it works
These are the lines from my Makefile that fails
CFLAGSX = -c -g -O2 -DARCH_LITTLE_ENDIAN=1 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param allow-store-data-races=0 -Wno-deprecated-declarations -Wno-format-extra-args -std=gnu89 -D_POSIX_SOURCE -D_GNU_SOURCE -D__GNU_VISIBLE -D__CYGWIN64__ -D__CYGWIN32__ -fopenmp $(RELEASE_BLD) $(CPPFLAGS)

$(CC) -DAC_BUILT -Wall -O3 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param allow-store-data-races=0 -Wno-deprecated-declarations -Wno-format-extra-args -std=gnu89 -D_POSIX_SOURCE -D_GNU_SOURCE -D__GNU_VISIBLE -D__CYGWIN64__ -D__CYGWIN32__ -DNOT_JOHN -D_JOHN_MISC_NO_LOG cprepair.c unicode.c \

Again swap "source" for "visible" and it compiles, BTW --enable-mpi also works when swapping source for visible. Perhaps my system isn't configuring the way @jfoug was/is? Here is my current configure output: (mpi-enabled)
Configured for building John the Ripper jumbo:
Target CPU .................................. x86_64 SSE4.1, 64-bit LE
AES-NI support .............................. depends on OpenSSL
Target OS ................................... cygwin
Cross compiling ............................. no
Legacy arch header .......................... x86-64.h
Optional libraries/features found:
Experimental code ........................... no
OpenMPI support (default disabled) .......... yes
Fork support ................................ yes
OpenMP support .............................. yes
OpenCL support .............................. no
CUDA support ................................ no
Generic crypt(3) format ..................... no
Rexgen (extra cracking mode) ................ no
GMP (PRINCE mode and faster SRP formats) .... yes
PCAP (vncpcap2john and SIPdump) ............. no
Z (pkzip format, gpg2john) .................. yes
BZ2 (gpg2john extra decompression logic) .... yes
128-bit integer (faster PRINCE mode) ........ yes
Memory map (share/page large files) ......... yes
Development options (these may hurt performance when enabled):
Memdbg memory debugging settings ............ disabled
AddressSanitizer ("ASan") ................... disabled

<!-- gh-comment-id:101863450 --> @richrumble commented on GitHub (May 14, 2015): Nope... fails if leave -D_GNU_SOURCE, but replace it with Visible and it works These are the lines from my Makefile that fails CFLAGSX = -c -g -O2 -DARCH_LITTLE_ENDIAN=1 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param allow-store-data-races=0 -Wno-deprecated-declarations -Wno-format-extra-args -std=gnu89 -D_POSIX_SOURCE -D_GNU_SOURCE -D__GNU_VISIBLE -D__CYGWIN64__ -D__CYGWIN32__ -fopenmp $(RELEASE_BLD) $(CPPFLAGS) $(CC) -DAC_BUILT -Wall -O3 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param allow-store-data-races=0 -Wno-deprecated-declarations -Wno-format-extra-args -std=gnu89 -D_POSIX_SOURCE -D_GNU_SOURCE -D__GNU_VISIBLE -D__CYGWIN64__ -D__CYGWIN32__ -DNOT_JOHN -D_JOHN_MISC_NO_LOG cprepair.c unicode.c \ Again swap "source" for "visible" and it compiles, BTW --enable-mpi also works when swapping source for visible. Perhaps my system isn't configuring the way @jfoug was/is? Here is my current configure output: (mpi-enabled) Configured for building John the Ripper jumbo: Target CPU .................................. x86_64 SSE4.1, 64-bit LE AES-NI support .............................. depends on OpenSSL Target OS ................................... cygwin Cross compiling ............................. no Legacy arch header .......................... x86-64.h Optional libraries/features found: Experimental code ........................... no OpenMPI support (default disabled) .......... yes Fork support ................................ yes OpenMP support .............................. yes OpenCL support .............................. no CUDA support ................................ no Generic crypt(3) format ..................... no Rexgen (extra cracking mode) ................ no GMP (PRINCE mode and faster SRP formats) .... yes PCAP (vncpcap2john and SIPdump) ............. no Z (pkzip format, gpg2john) .................. yes BZ2 (gpg2john extra decompression logic) .... yes 128-bit integer (faster PRINCE mode) ........ yes Memory map (share/page large files) ......... yes Development options (these may hurt performance when enabled): Memdbg memory debugging settings ............ disabled AddressSanitizer ("ASan") ................... disabled
Author
Owner

@magnumripper commented on GitHub (May 14, 2015):

So we might get away with defining __GNU_VISIBLE instead of _GNU_SOURCE. I'm pretty sure we are not supposed to do that though. This is a weird issue.

<!-- gh-comment-id:101865486 --> @magnumripper commented on GitHub (May 14, 2015): So we might get away with defining __GNU_VISIBLE instead of _GNU_SOURCE. I'm pretty sure we are not supposed to do that though. This is a weird issue.
Author
Owner

@magnumripper commented on GitHub (May 14, 2015):

BTW @richrumble I'm pretty sure you can use --fork with Cygwin nowadays (we fixed file locking issues). Much nicer, keypresses for status works and so on. You can actually resume an MPI job using fork (just leave out mpirun and it will fork like magic).

<!-- gh-comment-id:101867033 --> @magnumripper commented on GitHub (May 14, 2015): BTW @richrumble I'm pretty sure you can use --fork with Cygwin nowadays (we fixed file locking issues). Much nicer, keypresses for status works and so on. You can actually resume an MPI job using fork (just leave out mpirun and it will fork like magic).
Author
Owner

@richrumble commented on GitHub (May 14, 2015):

Right, I need to update my blog post about AD+JtR and submit it as a contrib to JtR for the wiki perhaps. I love fork :)

<!-- gh-comment-id:101881071 --> @richrumble commented on GitHub (May 14, 2015): Right, I need to update my blog post about [AD+JtR](http://xinn.org/blog/JtR-AD-Password-Auditing.html) and submit it as a contrib to JtR for the wiki perhaps. I love fork :)
Author
Owner

@shinnok commented on GitHub (May 14, 2015):

I used the 32bit Cygwin. @richrumble You're using 64bit Cygwin right?

After doing some reading, I think this is as much about __GNU_SOURCE vs __GNU_VISIBLE as it is about __GNU_SOURCE vs __POSIX_SOURCE.

http://stackoverflow.com/questions/5582211/what-does-define-gnu-source-imply

What I found out is that if I use only one of __GNU_SOURCE or __POSIX_SOURCE the source files in question compile fine. The combination of them two produces the errors. Also what __GNU_SOUCE is really doing, seems quite scary, so maybe jumbo shouldn't use it at all unless really needed?

Out of curiosity, __GNU_VISIBLE, do we really know what it does?

<!-- gh-comment-id:102017907 --> @shinnok commented on GitHub (May 14, 2015): I used the 32bit Cygwin. @richrumble You're using 64bit Cygwin right? After doing some reading, I think this is as much about __GNU_SOURCE vs __GNU_VISIBLE as it is about __GNU_SOURCE vs __POSIX_SOURCE. http://stackoverflow.com/questions/5582211/what-does-define-gnu-source-imply What I found out is that if I use only one of __GNU_SOURCE or __POSIX_SOURCE the source files in question compile fine. The combination of them two produces the errors. Also what __GNU_SOUCE is really doing, seems quite scary, so maybe jumbo shouldn't use it at all unless really needed? Out of curiosity, __GNU_VISIBLE, do we really know what it does?
Author
Owner

@shinnok commented on GitHub (May 14, 2015):

Answer __GNU_VISIBLE question:

grep -r GNU_VISIBLE /usr/include
/usr/include/stdio.h:#if __GNU_VISIBLE
/usr/include/stdio.h:#if __GNU_VISIBLE
/usr/include/stdlib.h:#elif __GNU_VISIBLE
/usr/include/string.h:#if __GNU_VISIBLE
/usr/include/string.h:#if __GNU_VISIBLE
/usr/include/string.h:#if __GNU_VISIBLE
/usr/include/string.h:#if __GNU_VISIBLE
/usr/include/string.h:#if __GNU_VISIBLE
/usr/include/string.h:#if __GNU_VISIBLE && !defined(basename)
/usr/include/sys/cdefs.h:#define __GNU_VISIBLE 1
/usr/include/sys/cdefs.h:#else /* Default: everything except __GNU_VISIBLE. */
/usr/include/wchar.h:#if __GNU_VISIBLE
/usr/include/wchar.h:#if __GNU_VISIBLE

It's revealing to do the same for _GNU_SOURCE too.

<!-- gh-comment-id:102018329 --> @shinnok commented on GitHub (May 14, 2015): Answer __GNU_VISIBLE question: grep -r GNU_VISIBLE /usr/include /usr/include/stdio.h:#if __GNU_VISIBLE /usr/include/stdio.h:#if __GNU_VISIBLE /usr/include/stdlib.h:#elif __GNU_VISIBLE /usr/include/string.h:#if __GNU_VISIBLE /usr/include/string.h:#if __GNU_VISIBLE /usr/include/string.h:#if __GNU_VISIBLE /usr/include/string.h:#if __GNU_VISIBLE /usr/include/string.h:#if __GNU_VISIBLE /usr/include/string.h:#if __GNU_VISIBLE && !defined(basename) /usr/include/sys/cdefs.h:#define __GNU_VISIBLE 1 /usr/include/sys/cdefs.h:#else /\* Default: everything except __GNU_VISIBLE. */ /usr/include/wchar.h:#if __GNU_VISIBLE /usr/include/wchar.h:#if __GNU_VISIBLE It's revealing to do the same for _GNU_SOURCE too.
Author
Owner

@magnumripper commented on GitHub (May 14, 2015):

Yes I think __GNU_VISIBLE is an internal thing (infered from _GNU_SOURCE) and we should rather not use it. I bet we'll get fewer problems with only _GNU_SOURCE than with only _POSIX_SOURCE.

<!-- gh-comment-id:102150808 --> @magnumripper commented on GitHub (May 14, 2015): Yes I think __GNU_VISIBLE is an internal thing (infered from _GNU_SOURCE) and we should rather not use it. I bet we'll get fewer problems with only _GNU_SOURCE than with only _POSIX_SOURCE.
Author
Owner

@magnumripper commented on GitHub (May 14, 2015):

I think this is as much about __GNU_SOURCE vs __GNU_VISIBLE as it is about __GNU_SOURCE vs __POSIX_SOURCE.

When this issue was first seen, we didn't have _POSIX_SOURCE (it was added in c09d11ce). We only had _GNU_SOURCE. This was needed according to #856 and apparently worked well for @jfoug for months.

But if _POSIX_SOURCE without _GNU_SOURCE works fine, why don't we try that for a while and see if someone hits other problems.

<!-- gh-comment-id:102153251 --> @magnumripper commented on GitHub (May 14, 2015): > I think this is as much about __GNU_SOURCE vs __GNU_VISIBLE as it is about __GNU_SOURCE vs __POSIX_SOURCE. When this issue was first seen, we didn't have _POSIX_SOURCE (it was added in c09d11ce). We only had _GNU_SOURCE. This was needed according to #856 and apparently worked well for @jfoug for months. But if _POSIX_SOURCE without _GNU_SOURCE works fine, why don't we try that for a while and see if someone hits other problems.
Author
Owner

@shinnok commented on GitHub (May 15, 2015):

Here's the interesting bit. I removed both GNU_SOURCE and POSIX_SOURCE from the build process and bleeding-jumbo branch latest built just fine and john runs.

After reading your latest comment, POSIX_SOURCE shouldn't have been added in c09d11ce29 for Cyg too, the problem seemed specific to Fedora/GCC.

I also looked around some more in my Cyg's /usr/include and memmem seems to be a real issue apparently. It is wrapped in GNU_VISIBLE which is defined only if GNU_SOURCE.

I'm not sure exactly why it does build without any of those defs. Maybe the -std=gnu89 ?

"checking for memmem... yes"

...

dmg_fmt_plug.c: In function ‘hash_plugin_check_hash’:
dmg_fmt_plug.c:583:3: warning: implicit declaration of function ‘memmem’ [-Wimplicit-function-declaration]
if (memmem(outbuf, cur_salt->data_size, (void*)nulls, 8)) {

So maybe removing just POSIX_SOURCE define for Cyg case is the solution at hand.

<!-- gh-comment-id:102454107 --> @shinnok commented on GitHub (May 15, 2015): Here's the interesting bit. I removed both GNU_SOURCE and POSIX_SOURCE from the build process and bleeding-jumbo branch latest built just fine and john runs. After reading your latest comment, POSIX_SOURCE shouldn't have been added in c09d11ce29af41fcd44522b4160495a6c6ff2a78 for Cyg too, the problem seemed specific to Fedora/GCC. I also looked around some more in my Cyg's /usr/include and memmem seems to be a real issue apparently. It is wrapped in GNU_VISIBLE which is defined only if GNU_SOURCE. I'm not sure exactly why it does build without any of those defs. Maybe the -std=gnu89 ? "checking for memmem... yes" ... dmg_fmt_plug.c: In function ‘hash_plugin_check_hash’: dmg_fmt_plug.c:583:3: warning: implicit declaration of function ‘memmem’ [-Wimplicit-function-declaration] if (memmem(outbuf, cur_salt->data_size, (void*)nulls, 8)) { So maybe removing just POSIX_SOURCE define for Cyg case is the solution at hand.
Author
Owner

@magnumripper commented on GitHub (May 15, 2015):

If you get that build warning, we're not set.

<!-- gh-comment-id:102456470 --> @magnumripper commented on GitHub (May 15, 2015): If you get that build warning, we're not set.
Author
Owner

@magnumripper commented on GitHub (May 15, 2015):

BTW did you try running the ssh-ng format?

<!-- gh-comment-id:102456802 --> @magnumripper commented on GitHub (May 15, 2015): BTW did you try running the ssh-ng format?
Author
Owner

@shinnok commented on GitHub (May 18, 2015):

Apologies for not being clear enough.

The warning was for the build without both GNU_VISIBLE and POSIX_SOURCE. Thus the build proceeds fine, only that kind of warning and this one pop up:
ssh_ng_fmt_plug.c:315:6: warning: assignment makes pointer from integer without a cast
res = memmem(output, 128, "SEQUENCE", 8);

It also runs fine:

Benchmarking: SSH (one 2048-bit RSA and one 1024-bit DSA key) [RSA/DSA 32/32]... (2xOMP) DONE
Raw: 128000 c/s real, 128000 c/s virtual
Benchmarking: SSH-ng [RSA/DSA 32/32]... (2xOMP) DONE
Raw: 709723 c/s real, 409200 c/s virtual

Building with only GNU_VISIBLE gets us rid of those warns and everything is good once again.

To sum up, I think the best we can do for now is get rid of POSIX_SOURCE for the Cygwin case(afaik it was added for Fedora GCC issues to the linux target and implicitly cygwin which falls under the same switch case in the configure) and see if any issues pop up for others from there on(hopefully not and I have no reason to suspect otherwise). I'll make a PR.

NB: I had to revert to pre ebbbfc1a8d since it breaks the build. Left a comment on the commit.

<!-- gh-comment-id:103233391 --> @shinnok commented on GitHub (May 18, 2015): Apologies for not being clear enough. The warning was for the build **without both** GNU_VISIBLE and POSIX_SOURCE. Thus the build proceeds fine, only that kind of warning and this one pop up: ssh_ng_fmt_plug.c:315:6: warning: assignment makes pointer from integer without a cast res = memmem(output, 128, "SEQUENCE", 8); It also runs fine: Benchmarking: SSH (one 2048-bit RSA and one 1024-bit DSA key) [RSA/DSA 32/32]... (2xOMP) DONE Raw: 128000 c/s real, 128000 c/s virtual Benchmarking: SSH-ng [RSA/DSA 32/32]... (2xOMP) DONE Raw: 709723 c/s real, 409200 c/s virtual Building with **only** GNU_VISIBLE gets us rid of those warns and everything is good once again. To sum up, I think the best we can do for now is get rid of POSIX_SOURCE for the Cygwin case(afaik it was added for Fedora GCC issues to the linux target and implicitly cygwin which falls under the same switch case in the configure) and see if any issues pop up for others from there on(hopefully not and I have no reason to suspect otherwise). I'll make a PR. NB: I had to revert to pre ebbbfc1a8dbcddca16540622a17e21705890c619 since it breaks the build. Left a comment on the commit.
Author
Owner

@magnumripper commented on GitHub (May 18, 2015):

I had to revert to pre ebbbfc1 since it breaks the build

I made an issue for this. FWIW, instead of reverting the commit you can just rm gost3411*_plug.c stribog_fmt_plug.c and re-run configure.

<!-- gh-comment-id:103237347 --> @magnumripper commented on GitHub (May 18, 2015): > I had to revert to pre ebbbfc1 since it breaks the build I made an issue for this. FWIW, instead of reverting the commit you can just `rm gost3411*_plug.c stribog_fmt_plug.c` and re-run configure.
Author
Owner

@magnumripper commented on GitHub (May 18, 2015):

Building with only GNU_VISIBLE gets us rid of those warns and everything is good once again.

@richrumble originally had this issue using _GNU_SOURCE only (which should be the same thing). I will merge your patch but I can't see how it would help Rich.

The question is: What is the difference between his Cygwin, yours, and @jfoug's?!

<!-- gh-comment-id:103240068 --> @magnumripper commented on GitHub (May 18, 2015): > Building with only GNU_VISIBLE gets us rid of those warns and everything is good once again. @richrumble originally had this issue using _GNU_SOURCE only (which should be the same thing). I will merge your patch but I can't see how it would help Rich. The question is: What is the difference between his Cygwin, yours, and @jfoug's?!
Author
Owner

@shinnok commented on GitHub (May 18, 2015):

I made the build a couple of times now and it proceeds fine. I am confused about Rich's reporting too. The only difference being mpi, but later he replied that it's the same without it. Maybe Rich is kind enough to try again with this fix?

<!-- gh-comment-id:103241078 --> @shinnok commented on GitHub (May 18, 2015): I made the build a couple of times now and it proceeds fine. I am confused about Rich's reporting too. The only difference being mpi, but later he replied that it's the same without it. Maybe Rich is kind enough to try again with this fix?
Author
Owner

@richrumble commented on GitHub (May 19, 2015):

I just pulled bleeding-jumbo, the last commit I see is 496b57ea64 and it fails still. My Makefile still has -D_GNU_SOURCE in it. I'm assuming I didn't pull the right branch or something. If I use Visible, it works though. 64-bit works when I replace gnu_source with GNU_VISIBLE manually.
These are the two lines from my makefile(s), and gnu_source doesn't work for me, [./configure --enable-mpi && make clean && make]
CFLAGSX = -c -g -O2 -DARCH_LITTLE_ENDIAN=1 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param allow-store-data-races=0 -Wno-deprecated-declarations -Wno-format-extra-args -std=gnu89 -D_POSIX_SOURCE -D_GNU_SOURCE -D__CYGWIN64
-D__CYGWIN32
_ -fopenmp -DHAVE_MPI $(RELEASE_BLD) $(CPPFLAGS)

$(CC) -DAC_BUILT -Wall -O3 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param allow-store-data-races=0 -Wno-deprecated-declarations -Wno-format-extra-args -std=gnu89 -D_POSIX_SOURCE -D_GNU_SOURCE -D__CYGWIN64__ -D__CYGWIN32__ -DNOT_JOHN -D_JOHN_MISC_NO_LOG cprepair.c unicode.c \

.........
$ uname -an
CYGWIN_NT-6.1 EXAMPLE 2.0.1(0.287/5/3) 2015-04-30 18:15 x86_64 Cygwin

........ All 305 formats passed self-tests!

my 32-bit did fail on make:
c3_fmt.c:227:5: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration]
tests[i].ciphertext = strdup(c);
^
c3_fmt.c:227:27: warning: incompatible implicit declaration of built-in function ‘strdup’
tests[i].ciphertext = strdup(c);
^
pp.c: In function ‘get_progress’:
pp.c:885:17: error: invalid operands to binary == (have ‘double’ and ‘struct __mpf_struct ’)
if ((double)0 == count)
^
pp.c:886:10: error: assignment to expression with array type
perc = 0;
^
pp.c: In function ‘do_prince_crack’:
pp.c:1469:22: warning: implicit declaration of function ‘fileno’ [-Wimplicit-function-declaration]
fileno(read_fp), 0);
^
Makefile:1057: recipe for target 'pp.o' failed
make[1]: *
* [pp.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/cygdrive/c/cygwin/JohnTheRipper/src'
Makefile:182: recipe for target 'default' failed
make: *** [default] Error 2
$ uname -an
CYGWIN_NT-5.1 ▒ 2.0.1(0.287/5/3) 2015-04-30 18:13 i686 Cygwin

<!-- gh-comment-id:103280189 --> @richrumble commented on GitHub (May 19, 2015): I just pulled bleeding-jumbo, the last commit I see is 496b57ea64653a9e90dece12ed1e55a7abf54140 and it fails still. My Makefile still has -D_GNU_SOURCE in it. I'm assuming I didn't pull the right branch or something. If I use Visible, it works though. 64-bit works when I replace _gnu_source with __GNU_VISIBLE manually. These are the two lines from my makefile(s), and gnu_source doesn't work for me, [./configure --enable-mpi && make clean && make] CFLAGSX = -c -g -O2 -DARCH_LITTLE_ENDIAN=1 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param allow-store-data-races=0 -Wno-deprecated-declarations -Wno-format-extra-args -std=gnu89 -D_POSIX_SOURCE -D_GNU_SOURCE -D__CYGWIN64__ -D__CYGWIN32__ -fopenmp -DHAVE_MPI $(RELEASE_BLD) $(CPPFLAGS) $(CC) -DAC_BUILT -Wall -O3 -Wall -Wdeclaration-after-statement -fomit-frame-pointer --param allow-store-data-races=0 -Wno-deprecated-declarations -Wno-format-extra-args -std=gnu89 -D_POSIX_SOURCE -D_GNU_SOURCE -D__CYGWIN64__ -D__CYGWIN32__ -DNOT_JOHN -D_JOHN_MISC_NO_LOG cprepair.c unicode.c \ ......... $ uname -an CYGWIN_NT-6.1 EXAMPLE 2.0.1(0.287/5/3) 2015-04-30 18:15 x86_64 Cygwin ........ All 305 formats passed self-tests! my 32-bit did fail on make: c3_fmt.c:227:5: warning: implicit declaration of function ‘strdup’ [-Wimplicit-function-declaration] tests[i].ciphertext = strdup(c); ^ c3_fmt.c:227:27: warning: incompatible implicit declaration of built-in function ‘strdup’ tests[i].ciphertext = strdup(c); ^ pp.c: In function ‘get_progress’: pp.c:885:17: error: invalid operands to binary == (have ‘double’ and ‘struct __mpf_struct _’) if ((double)0 == count) ^ pp.c:886:10: error: assignment to expression with array type perc = 0; ^ pp.c: In function ‘do_prince_crack’: pp.c:1469:22: warning: implicit declaration of function ‘fileno’ [-Wimplicit-function-declaration] fileno(read_fp), 0); ^ Makefile:1057: recipe for target 'pp.o' failed make[1]: *_\* [pp.o] Error 1 make[1]: **\* Waiting for unfinished jobs.... make[1]: Leaving directory '/cygdrive/c/cygwin/JohnTheRipper/src' Makefile:182: recipe for target 'default' failed make: **\* [default] Error 2 $ uname -an CYGWIN_NT-5.1 ▒ 2.0.1(0.287/5/3) 2015-04-30 18:13 i686 Cygwin
Author
Owner

@magnumripper commented on GitHub (May 19, 2015):

I'm assuming I didn't pull the right branch or something.

@shinnok's patch was not correct so not merged yet. But you should get the same result by just editing out all instances of -D_POSIX_SOURCE from Makefile after running configure.

64-bit works when I replace gnu_source with __GNU_VISIBLE manually.

That's odd. If I could stand Windows I'd grep for _GNU_SOURCE and __GNU_VISIBLE and try to establish exactly what happens.

<!-- gh-comment-id:103286473 --> @magnumripper commented on GitHub (May 19, 2015): > I'm assuming I didn't pull the right branch or something. @shinnok's patch was not correct so not merged yet. But you should get the same result by just editing out all instances of `-D_POSIX_SOURCE` from Makefile after running configure. > 64-bit works when I replace gnu_source with __GNU_VISIBLE manually. That's odd. If I could stand Windows I'd grep for _GNU_SOURCE and __GNU_VISIBLE and try to establish exactly what happens.
Author
Owner

@richrumble commented on GitHub (May 19, 2015):

That works, removing -D_POSIX_SOURCE from the Makefile, and leaving gnu_source as is. That is for my 64-bit build. 32-bit still fails in the PRINCE area with the error I listed above, after removing POSIX and or using VISIBLE (in place of gnu_source at that time). I may have to get you access to an AWS instance of windows+cygwin :)

<!-- gh-comment-id:103295755 --> @richrumble commented on GitHub (May 19, 2015): That works, removing -D_POSIX_SOURCE from the Makefile, and leaving gnu_source as is. That is for my 64-bit build. 32-bit still fails in the PRINCE area with the error I listed above, after removing POSIX and or using VISIBLE (in place of gnu_source at that time). I may have to get you access to an AWS instance of windows+cygwin :)
Author
Owner

@magnumripper commented on GitHub (May 19, 2015):

@shinnok I think the difference between you and Rich is you don't have libgmp installed in Cygwin32, right? If you install that I bet you'll get the pp.c problem from lack of _POSIX_SOURCE...

<!-- gh-comment-id:103398995 --> @magnumripper commented on GitHub (May 19, 2015): @shinnok I think the difference between you and Rich is you don't have libgmp installed in Cygwin32, right? If you install that I bet you'll get the pp.c problem from lack of _POSIX_SOURCE...
Author
Owner

@jfoug commented on GitHub (May 19, 2015):

I have GMP, on both 64 and 32 bit. Removing -D_POSIX_SOURCE builds just fine (and -test=0 runs). I did get one warning that causes no problems.

$ make -sj8
pp.c: In function ‘do_prince_crack’:
pp.c:1467:22: warning: implicit declaration of function ‘fileno’ [-Wimplicit-function-declaration]
                      fileno(read_fp), 0);
                      ^
/usr/bin/ar: creating aes.a

Make process completed.

This was on both 32 and 64 bit with open-cl enabled. I am having problems on the 32 bit build, but nothing here. The problems are the gost3211-2012-sse41 code using intrinsics not available for the 32 bit cygwin.

Sorry for my absence. Took a couple months off. Have not touched a computer since April 4th. I am not back at this 'full time', but I will work to get the cygwin stuff back in order.

<!-- gh-comment-id:103568750 --> @jfoug commented on GitHub (May 19, 2015): I have GMP, on both 64 and 32 bit. Removing -D_POSIX_SOURCE builds just fine (and -test=0 runs). I did get one warning that causes no problems. ``` $ make -sj8 pp.c: In function ‘do_prince_crack’: pp.c:1467:22: warning: implicit declaration of function ‘fileno’ [-Wimplicit-function-declaration] fileno(read_fp), 0); ^ /usr/bin/ar: creating aes.a Make process completed. ``` This was on both 32 and 64 bit with open-cl enabled. I am having problems on the 32 bit build, but nothing here. The problems are the gost3211-2012-sse41 code using intrinsics not available for the 32 bit cygwin. Sorry for my absence. Took a couple months off. Have not touched a computer since April 4th. I am not back at this 'full time', but I will work to get the cygwin stuff back in order.
Author
Owner

@jfoug commented on GitHub (May 19, 2015):

This issue should be fixed. I have left this open until others test this change.

<!-- gh-comment-id:103599783 --> @jfoug commented on GitHub (May 19, 2015): This issue should be fixed. I have left this open until others test this change.
Author
Owner

@magnumripper commented on GitHub (May 19, 2015):

Excellent, welcome back Jim!

<!-- gh-comment-id:103648309 --> @magnumripper commented on GitHub (May 19, 2015): Excellent, welcome back Jim!
Author
Owner

@richrumble commented on GitHub (May 19, 2015):

64-bit builds with the normal configure&&make lines now! My 32bit fails, should i make a new issue? GOST3411 seems to be the culprit or area of failure for my 32bit system.

<!-- gh-comment-id:103683847 --> @richrumble commented on GitHub (May 19, 2015): 64-bit builds with the normal configure&&make lines now! My 32bit fails, should i make a new issue? GOST3411 seems to be the culprit or area of failure for my 32bit system.
Author
Owner

@magnumripper commented on GitHub (May 19, 2015):

I just committed fixes for GOST3411 (Stribog formats) for 32-bit (95df0edfa).

<!-- gh-comment-id:103684976 --> @magnumripper commented on GitHub (May 19, 2015): I just committed fixes for GOST3411 (Stribog formats) for 32-bit (95df0edfa).
Author
Owner

@magnumripper commented on GitHub (May 19, 2015):

I closed this accidentally. Please reopen if you still have any 32-bit problems relevant to this issue.

BTW I also fixed that silly fileno() warning in bc0e4b461, in a way that should not cause problems.

<!-- gh-comment-id:103687536 --> @magnumripper commented on GitHub (May 19, 2015): I closed this accidentally. Please reopen if you still have any 32-bit problems relevant to this issue. BTW I also fixed that silly fileno() warning in bc0e4b461, in a way that should not cause problems.
Author
Owner

@richrumble commented on GitHub (May 19, 2015):

That works too! Thanks everyone!

<!-- gh-comment-id:103689044 --> @richrumble commented on GitHub (May 19, 2015): That works too! Thanks everyone!
Author
Owner

@magnumripper commented on GitHub (May 20, 2015):

I got a report off-list. Apparently it still doesn't work for all users because of bc0e4b4.

Cygwin64:

In file included from /usr/include/sys/_default_fcntl.h:196:0,
                  from /usr/include/sys/fcntl.h:3,
                  from /usr/include/fcntl.h:15,
                  from pp.c:67:
/usr/include/sys/time.h:105:34: Fehler: unbekannter Typname: »u_int«
  bintime_mul(struct bintime *_bt, u_int _x)
                                   ^
pp.c: In Funktion »do_prince_crack«:
pp.c:1471:22: Warnung: Implizite Deklaration der Funktion »fileno« [-Wimplicit-f
unction-declaration]
                       fileno(read_fp), 0);
                       ^
gcc: Fehler: pp.o: No such file or directory

Make process completed.
In file included from /usr/include/sys/_default_fcntl.h:196:0,
                  from /usr/include/sys/fcntl.h:3,
                  from /usr/include/fcntl.h:15,
                  from pp.c:67:
/usr/include/sys/time.h:105:34: Fehler: unbekannter Typname: »u_int«
  bintime_mul(struct bintime *_bt, u_int _x)
                                   ^
pp.c: In Funktion »do_prince_crack«:
pp.c:1471:22: Warnung: Implizite Deklaration der Funktion »fileno« [-Wimplicit-f
unction-declaration]
                       fileno(read_fp), 0);
                       ^
Makefile:1085: die Regel für Ziel "pp.o" scheiterte
make[1]: *** [pp.o] Fehler 1
Makefile:182: die Regel für Ziel "default" scheiterte
make: *** [default] Fehler 2

I thought threre wouldn't be any BSD conflicts when using POSIX_SOURCE in that file alone (I believe we do the same in wordlist.c). But apparently we get to decide between a fugly warning and an error. I'll revert bc0e4b4 but I'd really want a better fix.

<!-- gh-comment-id:103820057 --> @magnumripper commented on GitHub (May 20, 2015): I got a report off-list. Apparently it still doesn't work for all users because of bc0e4b4. Cygwin64: ``` In file included from /usr/include/sys/_default_fcntl.h:196:0, from /usr/include/sys/fcntl.h:3, from /usr/include/fcntl.h:15, from pp.c:67: /usr/include/sys/time.h:105:34: Fehler: unbekannter Typname: »u_int« bintime_mul(struct bintime *_bt, u_int _x) ^ pp.c: In Funktion »do_prince_crack«: pp.c:1471:22: Warnung: Implizite Deklaration der Funktion »fileno« [-Wimplicit-f unction-declaration] fileno(read_fp), 0); ^ gcc: Fehler: pp.o: No such file or directory Make process completed. In file included from /usr/include/sys/_default_fcntl.h:196:0, from /usr/include/sys/fcntl.h:3, from /usr/include/fcntl.h:15, from pp.c:67: /usr/include/sys/time.h:105:34: Fehler: unbekannter Typname: »u_int« bintime_mul(struct bintime *_bt, u_int _x) ^ pp.c: In Funktion »do_prince_crack«: pp.c:1471:22: Warnung: Implizite Deklaration der Funktion »fileno« [-Wimplicit-f unction-declaration] fileno(read_fp), 0); ^ Makefile:1085: die Regel für Ziel "pp.o" scheiterte make[1]: *** [pp.o] Fehler 1 Makefile:182: die Regel für Ziel "default" scheiterte make: *** [default] Fehler 2 ``` I thought threre wouldn't be any BSD conflicts when using POSIX_SOURCE in that file alone (I believe we do the same in wordlist.c). But apparently we get to decide between a fugly warning and an error. I'll revert bc0e4b4 but I'd really want a better fix.
Author
Owner

@magnumripper commented on GitHub (May 20, 2015):

Hmm, no, in wordlist.c it's like this

#if AC_BUILT
#include "autoconfig.h"
#else
#ifndef sparc
#define _POSIX_SOURCE /* for fileno(3) */
#endif
#endif

So why do we not get Cygwin warnings for fileno() in that case?!

<!-- gh-comment-id:103820647 --> @magnumripper commented on GitHub (May 20, 2015): Hmm, no, in wordlist.c it's like this ``` C #if AC_BUILT #include "autoconfig.h" #else #ifndef sparc #define _POSIX_SOURCE /* for fileno(3) */ #endif #endif ``` So why do we not get Cygwin warnings for fileno() in that case?!
Author
Owner

@magnumripper commented on GitHub (May 20, 2015):

There's a lot of info in man feature_test_macros but I only have them for Linux while the variant (if there is one) for Cygwin would be an interesting read.

From Linux

       _POSIX_C_SOURCE
              Defining this macro causes header files to expose definitions as follows:

              ·  The value 1 exposes definitions conforming to POSIX.1-1990 and ISO C (1990).

              ·  The value 2 or greater additionally exposes definitions for POSIX.2-1992.

              ·  The value 199309L or greater additionally exposes definitions for POSIX.1b (real-time extensions).

              ·  The value 199506L or greater additionally exposes definitions for POSIX.1c (threads).

              ·  (Since  glibc 2.3.3) The value 200112L or greater exposes definitions corresponding to the POSIX.1-2001 base specifi‐
                 cation (excluding the XSI extension).

              ·  (Since glibc 2.10) The value 200809L or greater exposes definitions corresponding to the POSIX.1-2008 base specifica‐
                 tion (excluding the XSI extension).

       _POSIX_SOURCE
              Defining this obsolete macro with any value is equivalent to defining _POSIX_C_SOURCE with the value 1.

      _XOPEN_SOURCE
              Defining this macro causes header files to expose definitions as follows:

              ·  Defining with any value exposes definitions conforming to POSIX.1, POSIX.2, and XPG4.

              ·  The value 500 or greater additionally exposes definitions for SUSv2 (UNIX 98).

              ·  (Since  glibc  2.2)  The  value  600  or  greater  additionally  exposes  definitions  for  SUSv3 (UNIX 03; i.e., the
                 POSIX.1-2001 base specification plus the XSI extension) and C99 definitions.

              ·  (Since glibc 2.10) The value 700 or greater additionally exposes definitions for SUSv4 (i.e., the  POSIX.1-2008  base
                 specification plus the XSI extension).

       _BSD_SOURCE
              Defining  this  macro  with  any  value causes header files to expose BSD-derived definitions.  Defining this macro also
              causes BSD definitions to be preferred in some situations where standards conflict, unless one or more of  _SVID_SOURCE,
              _POSIX_SOURCE, _POSIX_C_SOURCE, _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, or _GNU_SOURCE is defined, in which case BSD def‐
              initions are disfavored.

      _GNU_SOURCE
              Defining  this  macro  (with  any  value)  is  equivalent to defining _BSD_SOURCE, _SVID_SOURCE, _ATFILE_SOURCE, _LARGE‐
              FILE64_SOURCE, _ISOC99_SOURCE, _XOPEN_SOURCE_EXTENDED, _POSIX_SOURCE, _POSIX_C_SOURCE with the value 200809L (200112L in
              glibc  versions  before  2.10;  199506L  in  glibc  versions  before  2.5;  199309L  in  glibc  versions before 2.1) and
              _XOPEN_SOURCE with the value 700 (600 in glibc versions before 2.10; 500 in glibc versions before  2.2).   In  addition,
              various GNU-specific extensions are also exposed.  Where standards conflict, BSD definitions are disfavored.

(...)

       According to which of the above feature test macros are defined, <features.h> internally defines various other macros that  are
       checked  by other glibc header files.  These macros have names prefixed by two underscores (e.g., __USE_MISC).  Programs should
       never define these macros directly: instead, the appropriate feature test macro(s) from the list above should be employed.

This confirms my idea that it would be a Bad Idea[tm] to define __GNU_VISIBLE.

<!-- gh-comment-id:103821944 --> @magnumripper commented on GitHub (May 20, 2015): There's a lot of info in `man feature_test_macros` but I only have them for Linux while the variant (if there is one) for Cygwin would be an interesting read. From Linux ``` _POSIX_C_SOURCE Defining this macro causes header files to expose definitions as follows: · The value 1 exposes definitions conforming to POSIX.1-1990 and ISO C (1990). · The value 2 or greater additionally exposes definitions for POSIX.2-1992. · The value 199309L or greater additionally exposes definitions for POSIX.1b (real-time extensions). · The value 199506L or greater additionally exposes definitions for POSIX.1c (threads). · (Since glibc 2.3.3) The value 200112L or greater exposes definitions corresponding to the POSIX.1-2001 base specifi‐ cation (excluding the XSI extension). · (Since glibc 2.10) The value 200809L or greater exposes definitions corresponding to the POSIX.1-2008 base specifica‐ tion (excluding the XSI extension). _POSIX_SOURCE Defining this obsolete macro with any value is equivalent to defining _POSIX_C_SOURCE with the value 1. _XOPEN_SOURCE Defining this macro causes header files to expose definitions as follows: · Defining with any value exposes definitions conforming to POSIX.1, POSIX.2, and XPG4. · The value 500 or greater additionally exposes definitions for SUSv2 (UNIX 98). · (Since glibc 2.2) The value 600 or greater additionally exposes definitions for SUSv3 (UNIX 03; i.e., the POSIX.1-2001 base specification plus the XSI extension) and C99 definitions. · (Since glibc 2.10) The value 700 or greater additionally exposes definitions for SUSv4 (i.e., the POSIX.1-2008 base specification plus the XSI extension). _BSD_SOURCE Defining this macro with any value causes header files to expose BSD-derived definitions. Defining this macro also causes BSD definitions to be preferred in some situations where standards conflict, unless one or more of _SVID_SOURCE, _POSIX_SOURCE, _POSIX_C_SOURCE, _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, or _GNU_SOURCE is defined, in which case BSD def‐ initions are disfavored. _GNU_SOURCE Defining this macro (with any value) is equivalent to defining _BSD_SOURCE, _SVID_SOURCE, _ATFILE_SOURCE, _LARGE‐ FILE64_SOURCE, _ISOC99_SOURCE, _XOPEN_SOURCE_EXTENDED, _POSIX_SOURCE, _POSIX_C_SOURCE with the value 200809L (200112L in glibc versions before 2.10; 199506L in glibc versions before 2.5; 199309L in glibc versions before 2.1) and _XOPEN_SOURCE with the value 700 (600 in glibc versions before 2.10; 500 in glibc versions before 2.2). In addition, various GNU-specific extensions are also exposed. Where standards conflict, BSD definitions are disfavored. (...) According to which of the above feature test macros are defined, <features.h> internally defines various other macros that are checked by other glibc header files. These macros have names prefixed by two underscores (e.g., __USE_MISC). Programs should never define these macros directly: instead, the appropriate feature test macro(s) from the list above should be employed. ``` This confirms my idea that it would be a Bad Idea[tm] to define __GNU_VISIBLE.
Author
Owner

@shinnok commented on GitHub (May 21, 2015):

Latest fixes are confirmed on my setup too. To answer @magnumripper question for cygwin fileno case(from /usr/include/stdio.h):

/*
 * Routines in POSIX 1003.1:2001.
 */

#ifndef __STRICT_ANSI__
#ifndef _REENT_ONLY
FILE *  _EXFUN(fdopen, (int, const char *));
#endif
int     _EXFUN(fileno, (FILE *));
int     _EXFUN(getw, (FILE *));
int     _EXFUN(pclose, (FILE *));
FILE *  _EXFUN(popen, (const char *, const char *));
int     _EXFUN(putw, (int, FILE *));
...
int     _EXFUN(putchar_unlocked, (int));
#endif /* ! __STRICT_ANSI__ */

<!-- gh-comment-id:104358538 --> @shinnok commented on GitHub (May 21, 2015): Latest fixes are confirmed on my setup too. To answer @magnumripper question for cygwin fileno case(from /usr/include/stdio.h): ``` /* * Routines in POSIX 1003.1:2001. */ #ifndef __STRICT_ANSI__ #ifndef _REENT_ONLY FILE * _EXFUN(fdopen, (int, const char *)); #endif int _EXFUN(fileno, (FILE *)); int _EXFUN(getw, (FILE *)); int _EXFUN(pclose, (FILE *)); FILE * _EXFUN(popen, (const char *, const char *)); int _EXFUN(putw, (int, FILE *)); ... int _EXFUN(putchar_unlocked, (int)); #endif /* ! __STRICT_ANSI__ */ ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#788
No description provided.