basil00 / reqrypt

A censorship circumvention tool
http://reqrypt.org
489 stars 83 forks source link

macOS build error #2

Closed DenimTornado closed 7 years ago

DenimTornado commented 7 years ago

I am not profi, so i can't give you wide description. So there is the listing of the last command:

`MacBookPro81:reqrypt-master DenimTornado$ make client_install_macosx (cd src; \ make clean; \ make -j 4 client) rm -f base64.o client.o checksum.o cktp_client.o cktp_common.o cktp_encoding.o cktp_url.o config.o encodings/aes.o encodings/aes_hardware.o encodings/crypt.o encodings/pad.o encodings/natural.o http_server.o install.o log.o options.o packet.o packet_dispatch.o packet_filter.o packet_protocol.o packet_track.o random.o tunnel.o macosx/capture.o macosx/misc.o base64.o checksum.o cktp_common.o cktp_encoding.o cktp_server.o cktp_url.o encodings/aes.o encodings/aes_hardware.o encodings/crypt.o encodings/pad.o linux/misc.o quota.o random.o server.o server_table.o http_data.c install_data.c tools/file2c

gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Volumes/data/Dev/ReQrypt/reqrypt-master/src/ -c -o base64.o base64.c

gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Volumes/data/Dev/ReQrypt/reqrypt-master/src/ -c -o client.o client.c

gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Volumes/data/Dev/ReQrypt/reqrypt-master/src/ -c -o checksum.o checksum.c

gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Volumes/data/Dev/ReQrypt/reqrypt-master/src/ -c -o cktp_client.o cktp_client.c

cktp_client.c:811:31: warning: taking address of packed member 'checksum' of class or structure 'cktp_msg_hdr_rep_s' may result in an unaligned pointer value [-Waddress-of-packed-member] uint16_t reply_checksum = cktp_checksum(reply1, reply_size); ^~~~~~~~~

/Volumes/data/Dev/ReQrypt/reqrypt-master/src/cktp_common.h:31:43: note: expanded from macro 'cktp_checksum' cktp_calculate_checksum((uint8_t *)(&((message)->checksum) + 1), \ ^~~~~~~

cktp_client.c:811:31: warning: taking address of packed member 'checksum' of class or structure 'cktp_msg_hdr_rep_s' may result in an unaligned pointer value [-Waddress-of-packed-member] uint16_t reply_checksum = cktp_checksum(reply1, reply_size); ^~~~~~~~~

/Volumes/data/Dev/ReQrypt/reqrypt-master/src/cktp_common.h:32:35: note: expanded from macro 'cktp_checksum' (length) - ((uint8_t *)(&((message)->checksum) + 1) - \ ^~~~~~~

client.c:224:24: warning: incompatible pointer types passing 'struct iphdr ' to parameter of type 'const uint8_t ' (aka 'const unsigned char *') [-Wincompatible-pointer-types] cktp_client.c:934:9: warning: implicit declaration of function 'log_packet' is invalid in C99 [-Wimplicit-function-declaration] log_packet(packet); ^ log_packet(ip_header); ^~~~~

client.c:51:32: note: passing argument to parameter 'packet' here void log_packet(const uint8_t packet); ^ cktp_client.c:949:6: error: conflicting types for 'log_packet' void log_packet(const uint8_t packet) ^ cktp_client.c:934:9: note: previous implicit declaration is here log_packet(packet); ^ 3 warnings and 1 error generated. make[1]: [cktp_client.o] Error 1 make[1]: Waiting for unfinished jobs.... 1 warning generated. make: *** [client] Error 2 `

basil00 commented 7 years ago

This should hopefully be fixed now. Unfortunately I cannot test as I currently do not have access to a Mac.

monster1025 commented 7 years ago

Here is latest fail log:

reqrypt-master$ make client_install_macosx
(cd src; \
     make clean; \
     make -j 4 client)
rm -f base64.o client.o checksum.o cktp_client.o cktp_common.o cktp_encoding.o cktp_url.o config.o encodings/aes.o encodings/aes_hardware.o encodings/crypt.o encodings/pad.o encodings/natural.o http_server.o install.o log.o options.o packet.o packet_dispatch.o packet_filter.o packet_protocol.o packet_track.o random.o tunnel.o macosx/capture.o macosx/misc.o base64.o checksum.o cktp_common.o cktp_encoding.o cktp_server.o cktp_url.o encodings/aes.o encodings/aes_hardware.o encodings/crypt.o encodings/pad.o linux/misc.o quota.o random.o server.o server_table.o http_data.c install_data.c tools/file2c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/   -c -o base64.o base64.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/   -c -o client.o client.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/   -c -o checksum.o checksum.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/   -c -o cktp_client.o cktp_client.c
client.c:223:24: warning: incompatible pointer types passing 'struct iphdr *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') [-Wincompatible-pointer-types]
            log_packet(ip_header);
                       ^~~~~~~~~
/Users/monster/Downloads/reqrypt-master/src/log.h:49:32: note: passing argument to parameter 'packet' here
void log_packet(const uint8_t *packet);
                               ^
cktp_client.c:811:31: warning: taking address of packed member 'checksum' of class or structure 'cktp_msg_hdr_rep_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
    uint16_t reply_checksum = cktp_checksum(reply1, reply_size);
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/monster/Downloads/reqrypt-master/src/cktp_common.h:31:43: note: expanded from macro 'cktp_checksum'
    cktp_calculate_checksum((uint8_t *)(&((message)->checksum) + 1),          \
                                          ^~~~~~~~~~~~~~~~~~~
cktp_client.c:811:31: warning: taking address of packed member 'checksum' of class or structure 'cktp_msg_hdr_rep_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
    uint16_t reply_checksum = cktp_checksum(reply1, reply_size);
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/monster/Downloads/reqrypt-master/src/cktp_common.h:32:35: note: expanded from macro 'cktp_checksum'
        (length) - ((uint8_t *)(&((message)->checksum) + 1) -                 \
                                  ^~~~~~~~~~~~~~~~~~~
1 warning generated.
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/   -c -o cktp_common.o cktp_common.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/   -c -o cktp_encoding.o cktp_encoding.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/   -c -o cktp_url.o cktp_url.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/   -c -o config.o config.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/   -c -o encodings/aes.o encodings/aes.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/ -maes -mssse3 -flax-vector-conversions   -c -o encodings/aes_hardware.o encodings/aes_hardware.c
2 warnings generated.
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/   -c -o encodings/crypt.o encodings/crypt.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/monster/Downloads/reqrypt-master/src/   -c -o encodings/pad.o encodings/pad.c
encodings/aes_hardware.c:66:9: error: use of unknown builtin '__builtin_ia32_pshufd' [-Wimplicit-function-declaration]
    b = bshuffle(b, 0xFF);
        ^
encodings/aes_hardware.c:38:37: note: expanded from macro 'bshuffle'
#define bshuffle                    __builtin_ia32_pshufd
                                    ^
encodings/aes_hardware.c:66:7: error: assigning to 'int128_t' (vector of 2 'long long' values) from incompatible type 'int'
    b = bshuffle(b, 0xFF);
      ^ ~~~~~~~~~~~~~~~~~
encodings/aes_hardware.c:67:18: error: use of unknown builtin '__builtin_ia32_pslldqi128' [-Wimplicit-function-declaration]
    int128_t c = lshift4(a, 4);
                 ^
encodings/aes_hardware.c:40:5: note: expanded from macro 'lshift4'
    __builtin_ia32_pslldqi128((a), (b) * 8)
    ^
encodings/aes_hardware.c:67:14: error: initializing 'int128_t' (vector of 2 'long long' values) with an expression of incompatible type 'int'
    int128_t c = lshift4(a, 4);
             ^   ~~~~~~~~~~~~~
4 errors generated.
make[1]: *** [encodings/aes_hardware.o] Error 1
make[1]: *** Waiting for unfinished jobs....
encodings/crypt.c:957:25: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                uint8_t iv[state->iv_size];
                        ^
encodings/crypt.c:958:25: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                uint8_t id[state->id_size];
                        ^
encodings/crypt.c:980:25: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                uint8_t iv[state->iv_size];
                        ^
encodings/crypt.c:981:25: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                uint8_t id[state->id_size];
                        ^
encodings/crypt.c:1004:25: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                uint8_t iv[state->iv_size];
                        ^
encodings/crypt.c:1005:25: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                uint8_t id[state->id_size];
                        ^
encodings/crypt.c:1056:25: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                uint8_t iv[state->iv_size];
                        ^
encodings/crypt.c:1087:25: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                uint8_t iv[state->iv_size];
                        ^
encodings/crypt.c:1126:25: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
                uint8_t iv[state->iv_size];
                        ^
encodings/crypt.c:1257:17: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
        uint8_t iv[state->iv_size];
                ^
encodings/crypt.c:1259:17: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
        uint8_t mac[state->mac_size];
                ^
encodings/crypt.c:1300:17: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
        uint8_t iv[state->iv_size];
                ^
encodings/crypt.c:1301:17: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
        uint8_t id[state->id_size];
                ^
encodings/crypt.c:1303:17: error: fields must have a constant size: 'variable length array in structure' extension will never be supported
        uint8_t mac[state->mac_size];
                ^
14 errors generated.
make[1]: *** [encodings/crypt.o] Error 1
make: *** [client] Error 2
basil00 commented 7 years ago

These errors suggest the compiler is really clang and not gcc. Perhaps type gcc --version to check.

Unfortunately ReQrypt requires gcc proper to compile because it uses the variable length array in structure extension. One day I'd like to fix this but requires non-trivial effort.

stek29 commented 7 years ago

@basil00 GCC is clang alias on macOS :)

@monster1025 you can install GCC from homebrew

monster1025 commented 7 years ago

Oh, sorry didn't check the compiler =)) Using gcc 7.1.0 I got following error: macosx/misc.c:175:14: error: expected declaration specifiers or '...' before '__builtin_object_size'

HomeMacBook:reqrypt-master monster$ gcc --version
gcc-7 (Homebrew GCC 7.1.0) 7.1.0

Full build log: https://pastebin.com/CMjubK77

basil00 commented 7 years ago

OK I just committed a fix.

monster1025 commented 7 years ago

@basil00 Thanks a lot. Not it is working great! =)

DenimTornado commented 7 years ago

Hm, not in my situation..

https://pastebin.com/c9ceNW3F

monster1025 commented 7 years ago

@DenimTornado - you are using clang compiler instead gcc too. Check it.

stek29 commented 7 years ago

@DenimTornado please install GCC from Homebrew as I suggested

DenimTornado commented 7 years ago

@stek29 Ok, it's compiled, now hot to run it?)

basil00 commented 7 years ago

There should be a file reqrypt-1.3-macosx.sh. Try running it.

DenimTornado commented 7 years ago

ReQrypt 1.3 [macosx] Copyright (C) 2017 basil License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

log: [macosx] executing ipfw command "/sbin/ipfw 40404 add divert 40403 out proto tcp dst-port 443" log: starting reqrypt user interface http://localhost:40404/ error: unable to execute ipfw command: No such file or directory shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied /bin/sh: reqrypt.browser.sh: Permission denied error: ipfw command returned non-zero exit status 256

basil00 commented 7 years ago

I think you need to enable ipfw before ReQrypt will work. I forget how to do this, but it is usually somewhere in the system preferences under "Firewall" or something like that. It is probably best to google for instructions. As mentioned above, I no longer have a Mac so cannot test it myself.

DenimTornado commented 7 years ago

There is no ipfw in macOS Yosemite and newer..There is PF - https://discussions.apple.com/thread/6645172?start=0&tstart=0

Here more about PF on Mac if it helps - https://pleiades.ucsc.edu/hyades/PF_on_Mac_OS_X

basil00 commented 7 years ago

I was not aware of that. It may mean that ReQrypt Mac support needs to be updated, if possible. I am surprised there is no ipfw legacy support even if the interface it is deprecated.

Didn't @monster1025 get it working?

monster1025 commented 7 years ago

@basil00 No, I didn't - still searching backport of ipfw for macos sierra, but no luck for now %)

basil00 commented 7 years ago

OK, I guess MacOSX is officially "not supported" for the time being :(

To fix src/macosx/capture.c needs to be modified, specifically to replace ipfw with the new equivalent tool. The command syntax may have also changed. Hopefully divert sockets are still supported.