reqrypt icon indicating copy to clipboard operation
reqrypt copied to clipboard

Build issue (bad C)

Open akzhan opened this issue 8 years ago • 1 comments

Just log (MacOS, but errors related just to C):

➜  separated git clone https://github.com/akzhan/reqrypt.git
Cloning into 'reqrypt'...
remote: Counting objects: 687, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 687 (delta 2), reused 5 (delta 2), pack-reused 677
Receiving objects: 100% (687/687), 296.92 KiB | 0 bytes/s, done.
Resolving deltas: 100% (460/460), done.
➜  separated cd reqrypt
➜  reqrypt git:(master) autoconf -o configure configure-freebsd.ac
➜  reqrypt git:(master) ✗ ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
configure: creating ./config.status
config.status: creating cfg.mk
config.status: creating src/cfg.h
➜  reqrypt git:(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/akzhanabdulin/Projects/separated/reqrypt/src/   -c -o base64.o base64.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/akzhanabdulin/Projects/separated/reqrypt/src/   -c -o client.o client.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/akzhanabdulin/Projects/separated/reqrypt/src/   -c -o checksum.o checksum.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/akzhanabdulin/Projects/separated/reqrypt/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/akzhanabdulin/Projects/separated/reqrypt/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/akzhanabdulin/Projects/separated/reqrypt/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/akzhanabdulin/Projects/separated/reqrypt/src/cktp_common.h:32:35: note:
      expanded from macro 'cktp_checksum'
        (length) - ((uint8_t *)(&((message)->checksum) + 1) -                 \
                                  ^~~~~~~~~~~~~~~~~~~
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/akzhanabdulin/Projects/separated/reqrypt/src/   -c -o cktp_common.o cktp_common.c
1 warning generated.
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/akzhanabdulin/Projects/separated/reqrypt/src/   -c -o cktp_encoding.o cktp_encoding.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/akzhanabdulin/Projects/separated/reqrypt/src/   -c -o cktp_url.o cktp_url.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/akzhanabdulin/Projects/separated/reqrypt/src/   -c -o config.o config.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/akzhanabdulin/Projects/separated/reqrypt/src/   -c -o encodings/aes.o encodings/aes.c
2 warnings generated.
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/akzhanabdulin/Projects/separated/reqrypt/src/ -maes -mssse3 -flax-vector-conversions   -c -o encodings/aes_hardware.o encodings/aes_hardware.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/akzhanabdulin/Projects/separated/reqrypt/src/   -c -o encodings/crypt.o encodings/crypt.c
gcc -DCLIENT -DMACOSX -maes -Wall -O2 -I /Users/akzhanabdulin/Projects/separated/reqrypt/src/   -c -o encodings/pad.o encodings/pad.c
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[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
                                    ^
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/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/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 encodings/aes_hardware.c:67:14: error: initializing 'int128_t' (vector of 2
      'long long' values)have with an expression of incompatible type 'int'
    int128_t c = lshift4(a, 4);
             ^   ~~~~~~~~~~~~~
 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: fields4 errors generated.
 must have a constant size: 'variable
      length arraymake[1]: *** [encodings/aes_hardware.o] Error 1
make[1]: *** Waiting for unfinished jobs....
 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
➜  reqrypt git:(master) ✗ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

akzhan avatar Aug 12 '17 10:08 akzhan

This was also reported in #2. The problem is that ReQrypt uses some gcc extensions that are not supported by clang (and in MacOSX gcc is just a symlink to clang by default). To compile ReQrypt you will need gcc proper.

The intention is to eventually fix this problem and allow ReQrypt to compile with both gcc or clang.

basil00 avatar Aug 12 '17 13:08 basil00