mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1250] Cygwin build problem #788
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#788
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
@magnumripper commented on GitHub (May 1, 2015):
We seem to need a feature macro
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.
@richrumble commented on GitHub (May 1, 2015):
This was cygwin-x86 btw, not cygwin-x86_64. Just in case that makes a difference.
@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.
@magnumripper commented on GitHub (May 1, 2015):
c09d11cshould fix the pp.c warning.@magnumripper commented on GitHub (May 1, 2015):
I'm afraid we'll have to wait for @jfoug to come back for the rest.
@frank-dittrich commented on GitHub (May 1, 2015):
Some googling suggests that u_int might be undefined due to
see https://stackoverflow.com/questions/15393905/c-pcap-library-unknown-types-error
Since we need
_POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCEfor fileno, my only idea is trying to moveabove the
and see if that helps.
@frank-dittrich commented on GitHub (May 1, 2015):
Alternatively, try adding
before the
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
@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.
@magnumripper commented on GitHub (May 2, 2015):
I suppose this is a core problem since the
#define _POSIX_SOURCE 1is in core.@magnumripper commented on GitHub (May 5, 2015):
Try using
./configure --enable-mpi CFLAGS="-g -O2 -D_BSD_SOURCE". Does that help?@magnumripper commented on GitHub (May 5, 2015):
BTW just to rule it out: Does omitting
--enable-mpihelp?@magnumripper commented on GitHub (May 5, 2015):
Oh, and another thing to try: Can you build core 1.8.0 without problems?
@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.
@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?
@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 bisectcould 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?
@richrumble commented on GitHub (May 6, 2015):
On Wed, May 6, 2015 at 3:46 AM, frank-dittrich notifications@github.com
wrote:
@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
6c19fd94c8and94b501da3d, before proceeding to the time consuming bisect.@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.
6c19fd9and94b501dare 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.
@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
@magnumripper commented on GitHub (May 13, 2015):
OK, then I'm suspecting the
-std=gnu89option we added to Makefile (because gcc 5.x needs it). What happens if you remove that?It should work fine with
-std=gnu89though, but not-std=c89if I got it right.@magnumripper commented on GitHub (May 13, 2015):
OTOH removing
-std=gnu89only works with gcc pre v5.0 unless we work around #1093 some other way.@magnumripper commented on GitHub (May 13, 2015):
Did so in
e2e868dbut kept the-std=gnu89for now.@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:
@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)@richrumble commented on GitHub (May 13, 2015):
On Wed, May 13, 2015 at 6:12 AM, magnum notifications@github.com wrote:
Does not compile:
f3e0cdf06c11-19-2014configure: 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
f3e0cdf06cseems to be the culprit.@magnumripper commented on GitHub (May 13, 2015):
Wow, good job! You should learn
git bisectthough, it automates half of the process you did and usually finds the commit in 7-8 builds.And WAT?! I was sure
_GNU_SOURCEwas 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_SOURCEeverywhere, 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.
@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.
@magnumripper commented on GitHub (May 13, 2015):
So if his Cygwin64 needed that define, how come yours break because of it!?
@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
@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_SOURCEmacro 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!
@magnumripper commented on GitHub (May 13, 2015):
@richrumble what if you, instead of deleting
-D_GNU_SOURCEadd-D__GNU_VISIBLEat 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_SOURCEwill imply__GNU_VISIBLEbut it should not hurt trying. Something is amiss for sure - the_GNU_SOURCEreally is supposed to fix issues like this, not cause them.@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
@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.
@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).
@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 :)
@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?
@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.
@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.
@magnumripper commented on GitHub (May 14, 2015):
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.
@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
c09d11ce29for 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.
@magnumripper commented on GitHub (May 15, 2015):
If you get that build warning, we're not set.
@magnumripper commented on GitHub (May 15, 2015):
BTW did you try running the ssh-ng format?
@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
ebbbfc1a8dsince it breaks the build. Left a comment on the commit.@magnumripper commented on GitHub (May 18, 2015):
I made an issue for this. FWIW, instead of reverting the commit you can just
rm gost3411*_plug.c stribog_fmt_plug.cand re-run configure.@magnumripper commented on GitHub (May 18, 2015):
@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?!
@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?
@richrumble commented on GitHub (May 19, 2015):
I just pulled bleeding-jumbo, the last commit I see is
496b57ea64and 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
@magnumripper commented on GitHub (May 19, 2015):
@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_SOURCEfrom Makefile after running configure.That's odd. If I could stand Windows I'd grep for _GNU_SOURCE and __GNU_VISIBLE and try to establish exactly what happens.
@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 :)
@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...
@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.
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.
@jfoug commented on GitHub (May 19, 2015):
This issue should be fixed. I have left this open until others test this change.
@magnumripper commented on GitHub (May 19, 2015):
Excellent, welcome back Jim!
@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.
@magnumripper commented on GitHub (May 19, 2015):
I just committed fixes for GOST3411 (Stribog formats) for 32-bit (
95df0edfa).@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.@richrumble commented on GitHub (May 19, 2015):
That works too! Thanks everyone!
@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:
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
bc0e4b4but I'd really want a better fix.@magnumripper commented on GitHub (May 20, 2015):
Hmm, no, in wordlist.c it's like this
So why do we not get Cygwin warnings for fileno() in that case?!
@magnumripper commented on GitHub (May 20, 2015):
There's a lot of info in
man feature_test_macrosbut I only have them for Linux while the variant (if there is one) for Cygwin would be an interesting read.From Linux
This confirms my idea that it would be a Bad Idea[tm] to define __GNU_VISIBLE.
@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):