[GH-ISSUE #2449] Error compiling gpg2john.c on Debian Stretch #1625

Closed
opened 2026-10-15 04:21:29 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @BenderIsTheGreatest on GitHub (Mar 11, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2449

Hello,

I got the following error when I tried to compile

Configure finished. Now 'make clean && make -s' to compile.
gpg2john.c: In function ‘Compressed_Data_Packet’:
gpg2john.c:2953:12: error: ‘Z_OK’ undeclared (first use in this function)
int err = Z_OK;
^~~~
gpg2john.c:2953:12: note: each undeclared identifier is reported only once for each function it appears in
Makefile:1514: recipe for target 'gpg2john.o' failed
make[1]: *** [gpg2john.o] Error 1
make[1]: *** Waiting for unfinished jobs....
Makefile:171: recipe for target 'default' failed
make: *** [default] Error 2

I got all the right libs installed(I checked it here) and am using Debian Stretch and I am not sure what to do to fix this.

Originally created by @BenderIsTheGreatest on GitHub (Mar 11, 2017). Original GitHub issue: https://github.com/openwall/john/issues/2449 Hello, I got the following error when I tried to compile > Configure finished. Now 'make clean && make -s' to compile. gpg2john.c: In function ‘Compressed_Data_Packet’: gpg2john.c:2953:12: error: ‘Z_OK’ undeclared (first use in this function) int err = Z_OK; ^~~~ gpg2john.c:2953:12: note: each undeclared identifier is reported only once for each function it appears in Makefile:1514: recipe for target 'gpg2john.o' failed make[1]: *** [gpg2john.o] Error 1 make[1]: *** Waiting for unfinished jobs.... Makefile:171: recipe for target 'default' failed make: *** [default] Error 2 I got all the right libs installed(I checked [it here](http://openwall.info/wiki/john/tutorials/Ubuntu-build-howto)) and am using Debian Stretch and I am not sure what to do to fix this.
Author
Owner

@kholia commented on GitHub (Mar 11, 2017):

Try the following steps,

$ sudo apt-get install zlib1g-dev

$ ./configure  # yes, re-run this

$ make -j8
<!-- gh-comment-id:285884966 --> @kholia commented on GitHub (Mar 11, 2017): Try the following steps, ``` $ sudo apt-get install zlib1g-dev $ ./configure # yes, re-run this $ make -j8 ```
Author
Owner

@kholia commented on GitHub (Mar 11, 2017):

Here is a patch which fixes this problem,

index a881305b6..e04d72923 100644
--- a/src/gpg2john.c
+++ b/src/gpg2john.c
@@ -2948,7 +2948,7 @@ set_binary(void)
 public void
 Compressed_Data_Packet(int len)
 {
-#if HAVE_LIBZ || HAVE_LIBBZ2
+#if HAVE_LIBZ // || HAVE_LIBBZ2
        unsigned int alg = Getc();
        int err = Z_OK;
        private int (*func)(byte *, unsigned int);

Z_OK comes from zlib1g-dev. If zlib1g-dev is not installed (like in this case) but libbz2-dev is installed, we run into this compilation error.

<!-- gh-comment-id:285885858 --> @kholia commented on GitHub (Mar 11, 2017): Here is a patch which fixes this problem, ``` index a881305b6..e04d72923 100644 --- a/src/gpg2john.c +++ b/src/gpg2john.c @@ -2948,7 +2948,7 @@ set_binary(void) public void Compressed_Data_Packet(int len) { -#if HAVE_LIBZ || HAVE_LIBBZ2 +#if HAVE_LIBZ // || HAVE_LIBBZ2 unsigned int alg = Getc(); int err = Z_OK; private int (*func)(byte *, unsigned int); ``` `Z_OK` comes from `zlib1g-dev`. If `zlib1g-dev` is not installed (like in this case) but `libbz2-dev` is installed, we run into this compilation error.
Author
Owner

@kholia commented on GitHub (Mar 11, 2017):

Better patch,

diff --git a/src/gpg2john.c b/src/gpg2john.c
index a881305b6..6f974a074 100644
--- a/src/gpg2john.c
+++ b/src/gpg2john.c
@@ -2950,7 +2950,7 @@ Compressed_Data_Packet(int len)
 {
 #if HAVE_LIBZ || HAVE_LIBBZ2
        unsigned int alg = Getc();
-       int err = Z_OK;
+       int err = 0; // both Z_OK and BZ_OK are 0
        private int (*func)(byte *, unsigned int);
 
        comp_algs(alg);
<!-- gh-comment-id:285887092 --> @kholia commented on GitHub (Mar 11, 2017): Better patch, ``` diff --git a/src/gpg2john.c b/src/gpg2john.c index a881305b6..6f974a074 100644 --- a/src/gpg2john.c +++ b/src/gpg2john.c @@ -2950,7 +2950,7 @@ Compressed_Data_Packet(int len) { #if HAVE_LIBZ || HAVE_LIBBZ2 unsigned int alg = Getc(); - int err = Z_OK; + int err = 0; // both Z_OK and BZ_OK are 0 private int (*func)(byte *, unsigned int); comp_algs(alg); ```
Author
Owner

@BenderIsTheGreatest commented on GitHub (Mar 11, 2017):

$ sudo apt-get install zlib1g-dev
$ ./configure # yes, re-run this
$ make -j8

did work, thanks. I didn't know I needed that lib

<!-- gh-comment-id:285891010 --> @BenderIsTheGreatest commented on GitHub (Mar 11, 2017): > $ sudo apt-get install zlib1g-dev $ ./configure # yes, re-run this $ make -j8 did work, thanks. I didn't know I needed that lib
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#1625
No description provided.