Undefined Structure - unix/util.c:49:18: error: storage size of 'tv' isn't known
systmkor opened this issue · 9 comments
Environment
- Alpine Linux 3.1.0
- MUSL LibC
Make Output
gcc -g -Wall -Wextra -Wno-unused-parameter -DDEBUG -o bin/idgen util/idgen.c unix/platform.c src/e3x/cs2a_disabled.c src/e3x/cs3a_disabled.c src/lib/util.c src/lib/lob.c src/lib/hashname.c src/lib/xht.c src/lib/js0n.c src/lib/base32.c src/lib/chunks.c src/e3x/e3x.c src/e3x/channel3.c src/e3x/self3.c src/e3x/exchange3.c src/e3x/event3.c src/e3x/cipher3.c src/e3x/cs1a/aes.c src/e3x/cs1a/hmac.c src/e3x/cs1a/aes128.c src/e3x/cs1a/cs1a.c src/e3x/cs1a/uECC.c src/e3x/cs1a/sha256.c -Iunix -Isrc -Isrc/lib -Isrc/ext -Isrc/e3x -Isrc/net
gcc -g -Wall -Wextra -Wno-unused-parameter -DDEBUG -o bin/router util/router.c src/*.c unix/util.c src/net/udp4.c src/net/tcp4.c unix/platform.c src/e3x/cs2a_disabled.c src/e3x/cs3a_disabled.c src/lib/util.c src/lib/lob.c src/lib/hashname.c src/lib/xht.c src/lib/js0n.c src/lib/base32.c src/lib/chunks.c src/e3x/e3x.c src/e3x/channel3.c src/e3x/self3.c src/e3x/exchange3.c src/e3x/event3.c src/e3x/cipher3.c src/e3x/cs1a/aes.c src/e3x/cs1a/hmac.c src/e3x/cs1a/aes128.c src/e3x/cs1a/cs1a.c src/e3x/cs1a/uECC.c src/e3x/cs1a/sha256.c -Iunix -Isrc -Isrc/lib -Isrc/ext -Isrc/e3x -Isrc/net
unix/util.c: In function 'util_sock_timeout':
unix/util.c:49:18: error: stgcc -g -Wall -Wextra -Wno-unused-parameter -DDEBUG -o bin/idgen util/idgen.c unix/platform.c src/e3x/cs2a_disabled.c src/e3x/cs3a_disabled.c src/lib/util.c src/lib/lob.c src/lib/hashname.c src/lib/xht.c src/lib/js0n.c src/lib/base32.c src/lib/chunks.c src/e3x/e3x.c src/e3x/channel3.c src/e3x/self3.c src/e3x/exchange3.c src/e3x/event3.c src/e3x/cipher3.c src/e3x/cs1a/aes.c src/e3x/cs1a/hmac.c src/e3x/cs1a/aes128.c src/e3x/cs1a/cs1a.c src/e3x/cs1a/uECC.c src/e3x/cs1a/sha256.c -Iunix -Isrc -Isrc/lib -Isrc/ext -Isrc/e3x -Isrc/net
gcc -g -Wall -Wextra -Wno-unused-parameter -DDEBUG -o bin/router util/router.c src/*.c unix/util.c src/net/udp4.c src/net/tcp4.c unix/platform.c src/e3x/cs2a_disabled.c src/e3x/cs3a_disabled.c src/lib/util.c src/lib/lob.c src/lib/hashname.c src/lib/xht.c src/lib/js0n.c src/lib/base32.c src/lib/chunks.c src/e3x/e3x.c src/e3x/channel3.c src/e3x/self3.c src/e3x/exchange3.c src/e3x/event3.c src/e3x/cipher3.c src/e3x/cs1a/aes.c src/e3x/cs1a/hmac.c src/e3x/cs1a/aes128.c src/e3x/cs1a/cs1a.c src/e3x/cs1a/uECC.c src/e3x/cs1a/sha256.c -Iunix -Isrc -Isrc/lib -Isrc/ext -Isrc/e3x -Isrc/net
unix/util.c: In function 'util_sock_timeout':
unix/util.c:49:18: error: storage size of 'tv' isn't known
struct timeval tv;
^
unix/util.c:49:18: warning: unused variable 'tv' [-Wunused-variable]
Makefile:138: recipe for target 'router' failed
make: *** [router] Error 1
orage size of 'tv' isn't known
struct timeval tv;
^
unix/util.c:49:18: warning: unused variable 'tv' [-Wunused-variable]
Makefile:138: recipe for target 'router' failed
make: *** [router] Error 1
Hmm, it seems like timeval should be supported even in MUSL LibC, do you think this is related?
Try again and let me know if that fixes it, I think it was just a missing include.
Ran
- git pull
- make clean
- make
Make Output
gcc -g -Wall -Wextra -Wno-unused-parameter -DDEBUG -o bin/idgen util/idgen.c unix/platform.c src/e3x/cs2a_disabled.c src/e3x/cs3a_disabled.c src/lib/util.c src/lib/lob.c src/lib/hashname.c src/lib/xht.c src/lib/js0n.c src/lib/base32.c src/lib/chunks.c src/e3x/e3x.c src/e3x/channel3.c src/e3x/self3.c src/e3x/exchange3.c src/e3x/event3.c src/e3x/cipher3.c src/e3x/cs1a/aes.c src/e3x/cs1a/hmac.c src/e3x/cs1a/aes128.c src/e3x/cs1a/cs1a.c src/e3x/cs1a/uECC.c src/e3x/cs1a/sha256.c -Iunix -Isrc -Isrc/lib -Isrc/ext -Isrc/e3x -Isrc/net
gcc -g -Wall -Wextra -Wno-unused-parameter -DDEBUG -o bin/router util/router.c src/*.c unix/util.c src/net/udp4.c src/net/tcp4.c unix/platform.c src/e3x/cs2a_disabled.c src/e3x/cs3a_disabled.c src/lib/util.c src/lib/lob.c src/lib/hashname.c src/lib/xht.c src/lib/js0n.c src/lib/base32.c src/lib/chunks.c src/e3x/e3x.c src/e3x/channel3.c src/e3x/self3.c src/e3x/exchange3.c src/e3x/event3.c src/e3x/cipher3.c src/e3x/cs1a/aes.c src/e3x/cs1a/hmac.c src/e3x/cs1a/aes128.c src/e3x/cs1a/cs1a.c src/e3x/cs1a/uECC.c src/e3x/cs1a/sha256.c -Iunix -Isrc -Isrc/lib -Isrc/ext -Isrc/e3x -Isrc/net
unix/util.c: In function 'util_sock_timeout':
unix/util.c:50:18: error: storage size of 'tv' isn't known
struct timeval tv;
^
unix/util.c:50:18: warning: unused variable 'tv' [-Wunused-variable]
Makefile:141: recipe for target 'router' failed
make: *** [router] Error 1
I'm just guessing now, if this doesn't work I'll try to get musl-gcc working myself to reproduce :)
Okay so after a little searching and asking. The definition is located in bits/alltypes.h
line number 256.
I can clearly see the struct timeval being used in the official included sys/time.h, is it not in your local build system somehow?
It is in my local build system. bits/alltypes.h
I tried compiling while including that header in unix/util.c
however I keep getting the same error. I think I need to look through what the pre-processor generates.
Just tried again from a clean start and it appears to compile correctly. Thanks 👍
Awesome!!