[strace/strace] Bundled linux/socket.h breaks compiling for Android (#174)

Chih-Hsuan Yen notifications at github.com
Thu Feb 18 05:48:02 UTC 2021


Version 5.11 includes bundled linux/socket.h (4aeaf0c86d3a7cbc8b7608edeea8e4b1a676a391), and then building strace for Android is broken.
```
x86_64-linux-android21-clang -DHAVE_CONFIG_H   -I./linux/x86_64 -I./linux/x86_64 -I./linux/generic -I./linux/generic -I. -I. -I../bundled/linux/arch/x86/include/uapi -I../bundled/linux/include/uapi -DIN_STRACE=1     -I./bundled/linux/arch/x86/include/uapi -I./bundled/linux/include/uapi -Wall -Wempty-body -Wformat-security -Wignored-qualifiers -Winit-self -Winitializer-overrides -Wnested-externs -Wold-style-definition -Woverride-init -Wsign-compare -Wtype-limits -Wwrite-strings   -g -O2 -MT libstrace_a-msghdr.o -MD -MP -MF .deps/libstrace_a-msghdr.Tpo -c -o libstrace_a-msghdr.o `test -f 'msghdr.c' || echo './'`msghdr.c
In file included from msghdr.c:16:
In file included from /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/arpa/inet.h:32:
In file included from /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/netinet/in.h:36:
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:157:27: error: field has incomplete type 'struct sockaddr_storage'
  struct sockaddr_storage gr_group;
                          ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:157:10: note: forward declaration of 'struct sockaddr_storage'
  struct sockaddr_storage gr_group;
         ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:161:27: error: field has incomplete type 'struct sockaddr_storage'
  struct sockaddr_storage gsr_group;
                          ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:157:10: note: forward declaration of 'struct sockaddr_storage'
  struct sockaddr_storage gr_group;
         ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:162:27: error: field has incomplete type 'struct sockaddr_storage'
  struct sockaddr_storage gsr_source;
                          ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:157:10: note: forward declaration of 'struct sockaddr_storage'
  struct sockaddr_storage gr_group;
         ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:166:27: error: field has incomplete type 'struct sockaddr_storage'
  struct sockaddr_storage gf_group;
                          ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:157:10: note: forward declaration of 'struct sockaddr_storage'
  struct sockaddr_storage gr_group;
         ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:169:35: error: array has incomplete element type 'struct sockaddr_storage'
  struct sockaddr_storage gf_slist[1];
                                  ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:157:10: note: forward declaration of 'struct sockaddr_storage'
  struct sockaddr_storage gr_group;
         ^
msghdr.c:240:14: error: invalid application of 'sizeof' to an incomplete type 'struct sockaddr_storage'
                data_len > sizeof(struct sockaddr_storage)
                           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:157:10: note: forward declaration of 'struct sockaddr_storage'
  struct sockaddr_storage gr_group;
         ^
msghdr.c:241:5: error: invalid application of 'sizeof' to an incomplete type 'struct sockaddr_storage'
                ? sizeof(struct sockaddr_storage) : data_len;
                  ^     ~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/in.h:157:10: note: forward declaration of 'struct sockaddr_storage'
  struct sockaddr_storage gr_group;
         ^
7 errors generated.
```
Steps to reproduce:
1. Instald Android NDK r22
2. `export PATH="/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH"`
3. `./bootstrap`
4. `CC=x86_64-linux-android21-clang ./configure --host=x86_64-linux-android --without-libunwind --enable-mpers=no --disable-gcc-Werror`
5. `make`

Similar errors occur with aarch64-linux-android21 as well. If I remove bundled `linux/socket.h`, building is fine for both x86_64 and aarch64.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/strace/strace/issues/174
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20210217/790949f1/attachment.htm>


More information about the Strace-devel mailing list