onioncat icon indicating copy to clipboard operation
onioncat copied to clipboard

onioncat 0.4.7 build issue

Open chenrui333 opened this issue 3 years ago • 6 comments

👋 trying to build the latest release, but run into some build issue. The error log is as below:

build error
  In file included from ./ocat.h:136:
  ./ocatresolv.h:76:13: error: use of undeclared identifier 'PACKETSZ'
     char msg[PACKETSZ];
              ^
  1 error generated.
  make[1]: *** [ocatlog.o] Error 1
  make[1]: *** Waiting for unfinished jobs....
  In file included from ocattun.c:27:
  In file included from ./ocat.h:136:
  ./ocatresolv.h:76:13: error: use of undeclared identifier 'PACKETSZ'
     char msg[PACKETSZ];
              ^
  In file included from ocatv6conv.c:28:
  In file included from ./ocat.h:136:
  ./ocatresolv.h:76:13: error: use of undeclared identifier 'PACKETSZ'
     char msg[PACKETSZ];
              ^
  In file included from ocatroute.c:27:
  In file included from ./ocat.h:136:
  ./ocatresolv.h:76:13: error: use of undeclared identifier 'PACKETSZ'
     char msg[PACKETSZ];
              ^
  1 error generated.

full build log, https://github.com/Homebrew/homebrew-core/actions/runs/2985775159/jobs/4787102904 relates to Homebrew/homebrew-core#109579

chenrui333 avatar Oct 03 '22 22:10 chenrui333

Seems that PACKETSZ is not defined on your OS. What OS is it? Can you please add the line #define PACKETSZ 512 somewhere in the beginning of ocatresolv.c and retry to compile?

rahra avatar Oct 04 '22 05:10 rahra

Did it work?

rahra avatar Oct 08 '22 06:10 rahra

let me give a shot.

chenrui333 avatar Oct 08 '22 21:10 chenrui333

Seems that PACKETSZ is not defined on your OS. What OS is it?

it is macOS

chenrui333 avatar Oct 08 '22 21:10 chenrui333

Now the errors become like this

ocatresolv.c:143:4: error: use of undeclared identifier 'HEADER'
   HEADER *dh;
   ^
ocatresolv.c:143:12: error: use of undeclared identifier 'dh'
   HEADER *dh;
           ^
ocatresolv.c:146:62: error: use of undeclared identifier 'dh'
   if (buf == NULL || in6addr == NULL || len < (int) sizeof(*dh) + 78)
                                                             ^
ocatresolv.c:149:4: error: use of undeclared identifier 'dh'
   dh = (HEADER*) buf;
   ^
ocatresolv.c:149:17: error: expected expression
   dh = (HEADER*) buf;
                ^
ocatresolv.c:149:10: error: use of undeclared identifier 'HEADER'
   dh = (HEADER*) buf;
         ^
ocatresolv.c:150:26: error: use of undeclared identifier 'dh'
   memset(dh, 0, sizeof(*dh));
                         ^
ocatresolv.c:150:11: error: use of undeclared identifier 'dh'
   memset(dh, 0, sizeof(*dh));
          ^
ocatresolv.c:150:11: error: use of undeclared identifier 'dh'
ocatresolv.c:151:4: error: use of undeclared identifier 'dh'
   dh->id = id;
   ^
ocatresolv.c:152:4: error: use of undeclared identifier 'dh'
   dh->qdcount = htons(1);
   ^
ocatresolv.c:154:33: error: use of undeclared identifier 'dh'
   oc_ip6_ptr(in6addr, (char*) (dh + 1));
                                ^
ocatresolv.c:155:33: error: use of undeclared identifier 'dh'
   *((uint16_t*) (buf + sizeof(*dh) + IP6REVLEN)) = htons(T_PTR);
                                ^
ocatresolv.c:155:59: error: use of undeclared identifier 'T_PTR'
   *((uint16_t*) (buf + sizeof(*dh) + IP6REVLEN)) = htons(T_PTR);
                                                          ^
ocatresolv.c:155:59: error: use of undeclared identifier 'T_PTR'
ocatresolv.c:155:59: error: use of undeclared identifier 'T_PTR'
ocatresolv.c:155:59: error: use of undeclared identifier 'T_PTR'
ocatresolv.c:156:33: error: use of undeclared identifier 'dh'
   *((uint16_t*) (buf + sizeof(*dh) + IP6REVLEN + 2)) = htons(C_IN);
                                ^
ocatresolv.c:156:63: error: use of undeclared identifier 'C_IN'
   *((uint16_t*) (buf + sizeof(*dh) + IP6REVLEN + 2)) = htons(C_IN);
                                                              ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

chenrui333 avatar Oct 08 '22 21:10 chenrui333

Ok, the reason here is that a header file is missing. We have to figure out which one it is. It may be arpa/nameser_compat.h. Try including #include <arpa/nameser_compat.h> somewhere in the beginning of ocatresolv.c If not, go to the directory /usr/include and find the file. You could do grep -r T_PTR * and look at the results.

rahra avatar Oct 10 '22 07:10 rahra

Ok, the reason here is that a header file is missing. We have to figure out which one it is. It may be arpa/nameser_compat.h. Try including #include <arpa/nameser_compat.h> somewhere in the beginning of ocatresolv.c If not, go to the directory /usr/include and find the file. You could do grep -r T_PTR * and look at the results.

cool, give it another try.

chenrui333 avatar Oct 15 '22 17:10 chenrui333

Could you resolve the issue? If yes, I would include it in the source.

rahra avatar Nov 12 '22 07:11 rahra

After adding it to the .c file:

Making install in src
clang -DHAVE_CONFIG_H -I. -I..    -DSYSCONFDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/etc\" -DSTATEDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/var/onioncat\" -Wall -Wextra -g -pthread -c -o ocat.o ocat.c
clang -DHAVE_CONFIG_H -I. -I..    -DSYSCONFDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/etc\" -DSTATEDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/var/onioncat\" -Wall -Wextra -g -pthread -c -o ocatlog.o ocatlog.c
clang -DHAVE_CONFIG_H -I. -I..    -DSYSCONFDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/etc\" -DSTATEDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/var/onioncat\" -Wall -Wextra -g -pthread -c -o ocatroute.o ocatroute.c
clang -DHAVE_CONFIG_H -I. -I..    -DSYSCONFDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/etc\" -DSTATEDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/var/onioncat\" -Wall -Wextra -g -pthread -c -o ocatthread.o ocatthread.c
clang -DHAVE_CONFIG_H -I. -I..    -DSYSCONFDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/etc\" -DSTATEDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/var/onioncat\" -Wall -Wextra -g -pthread -c -o ocattun.o ocattun.c
clang -DHAVE_CONFIG_H -I. -I..    -DSYSCONFDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/etc\" -DSTATEDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/var/onioncat\" -Wall -Wextra -g -pthread -c -o ocatv6conv.o ocatv6conv.c
clang -DHAVE_CONFIG_H -I. -I..    -DSYSCONFDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/etc\" -DSTATEDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/var/onioncat\" -Wall -Wextra -g -pthread -c -o ocatpeer.o ocatpeer.c
clang -DHAVE_CONFIG_H -I. -I..    -DSYSCONFDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/etc\" -DSTATEDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/var/onioncat\" -Wall -Wextra -g -pthread -c -o ocatsetup.o ocatsetup.c
clang -DHAVE_CONFIG_H -I. -I..    -DSYSCONFDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/etc\" -DSTATEDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/var/onioncat\" -Wall -Wextra -g -pthread -c -o ocatipv4route.o ocatipv4route.c
clang -DHAVE_CONFIG_H -I. -I..    -DSYSCONFDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/etc\" -DSTATEDIR=\"/opt/homebrew/Cellar/onioncat/0.4.7/var/onioncat\" -Wall -Wextra -g -pthread -c -o ocateth.o ocateth.c
In file included from In file included from ocatthread.cocatpeer.c::2727:
:
In file included from In file included from ./ocat.h./ocat.h::136136:
:
./ocatresolv.h./ocatresolv.h::7676::1313::  error: error: use of undeclared identifier 'PACKETSZ'use of undeclared identifier 'PACKETSZ'

In file included from    char msg[PACKETSZ];   char msg[PACKETSZ];ocatroute.c

:            ^            ^27

:
In file included from In file included from In file included from ./ocat.hocat.cocatv6conv.c:::1362825:
:
:
In file included from In file included from ./ocatresolv.h./ocat.h./ocat.h1::: error136761361 generated:
:
: error.
13 generated./ocatresolv.h:./ocatresolv.h.
: :7676::1313error: ::  use of undeclared identifier 'PACKETSZ'error: error:
   char msg[PACKETSZ];
use of undeclared identifier 'PACKETSZ'use of undeclared identifier 'PACKETSZ'            ^


   char msg[PACKETSZ];   char msg[PACKETSZ];

make[1]: *** [ocatpeer.o] Error 1            ^            ^
In file included from

make[1]: ocattun.c:*** Waiting for unfinished jobs....27
:
make[1]: In file included from In file included from 1*** [ocatthread.o] Error 1ocatlog.c1In file included from 1In file included from In file included from ./ocat.h errorocateth.c
 error error:ocatsetup.cocatipv4route.c: generated: generated generated::24136.
26.
27.
26:
:
:
:
:
In file included from In file included from In file included from In file included from ./ocat.h./ocatresolv.h./ocat.h./ocat.h./ocat.h:::::13676136136136:
::
:
:
13./ocatresolv.h:./ocatresolv.h./ocatresolv.h./ocatresolv.h: :::76767676::::1313error: 1313::::    use of undeclared identifier 'PACKETSZ'error:
error: error: error:    char msg[PACKETSZ];
use of undeclared identifier 'PACKETSZ'make[1]: use of undeclared identifier 'PACKETSZ'use of undeclared identifier 'PACKETSZ'use of undeclared identifier 'PACKETSZ'*** [ocat.o] Error 1            ^





   char msg[PACKETSZ];   char msg[PACKETSZ];
make[1]:
*** [ocatroute.o] Error 1            ^   char msg[PACKETSZ];   char msg[PACKETSZ];1

 error
make[1]:  generated*** [ocatv6conv.o] Error 1            ^            ^            ^.





1 error generated.
1 error generated.
make[1]: *** [ocattun.o] Error 1
1 error generated.
1 error generated.
make[1]: *** [ocatipv4route.o] Error 1
make[1]: *** [ocatlog.o] Error 1
make[1]: *** [ocatsetup.o] Error 1
make[1]: *** [ocateth.o] Error 1
make: *** [install-recursive] Error 1

But if I add it to the header for ocatresolv too, it'll build.

SMillerDev avatar Jan 13 '23 09:01 SMillerDev

Ok, this is probably an issue of headerfile dependencies. arpa/nameserv_compat.h must probably be included after arpa/nameserv.h which is the case if you put it into ocatresolv.h (what btw is ok).

Could you please checkout the latest revision from the development branch. It should compile fine.

rahra avatar Jan 13 '23 21:01 rahra

Yes!

~ $ brew install --head onioncat
==> Fetching onioncat
==> Cloning https://github.com/rahra/onioncat.git
Updating /Users/sean/Library/Caches/Homebrew/onioncat--git
From https://github.com/rahra/onioncat
 * branch            master     -> FETCH_HEAD
==> Checking out branch development
Switched to a new branch 'development'
branch 'development' set up to track 'origin/development'.
HEAD is now at cec38f3 fix in dns name constructor
==> autoreconf -ifv
==> ./configure --prefix=/opt/homebrew/Cellar/onioncat/HEAD-cec38f3 --libdir=/opt/homebrew/Cellar/onioncat/HEAD-cec38f3/lib
==> make install
🍺  /opt/homebrew/Cellar/onioncat/HEAD-cec38f3: 12 files, 252.8KB, built in 9 seconds

SMillerDev avatar Jan 14 '23 10:01 SMillerDev