Skip to content

Use _GNU_SOURCE macro on Android#914

Merged
bradh352 merged 2 commits intoc-ares:mainfrom
jimmy-park:fix-android-build
Nov 9, 2024
Merged

Use _GNU_SOURCE macro on Android#914
bradh352 merged 2 commits intoc-ares:mainfrom
jimmy-park:fix-android-build

Conversation

@jimmy-park
Copy link
Copy Markdown
Contributor

I've got the following error while building c-ares on Android.

FAILED: _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o 
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi33 --sysroot=/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DCARES_BUILDING_LIBRARY -DHAVE_CONFIG_H=1 -DCMAKE_INTDIR=\"Debug\" -I/Users/jimmy.park/test-c-ares/build/android-arm/_deps/c-ares-source-build -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6 -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/include -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Qunused-arguments -Wno-long-long -fdiagnostics-color=always -fcolor-diagnostics -fno-limit-debug-info  -fno-omit-frame-pointer -O0 -std=c99 -fPIC -fcolor-diagnostics -w -MD -MT _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -MF _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o.d -o _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -c /Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   68 |   if (pipe2(p->filedes, O_NONBLOCK | O_CLOEXEC) != 0) {
      |       ^
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: note: did you mean 'pipe'?
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/unistd.h:275:5: note: 'pipe' declared here
  275 | int pipe(int __fds[_Nonnull 2]);
      |     ^
1 error generated.

It seems like the _GNU_SOURCE macro should be defined because of the pipe2 function.

@bradh352
Copy link
Copy Markdown
Member

bradh352 commented Nov 9, 2024

Probably be better to just add an OR to the CMAKE_SYSTEM_NAME STREQUAL "Linux" so both Linux and Android use the same flags as it looks like features.h in android talks about those other flags being relevant too. Its possible we've excluded some functionality on Android due to not having those set when building with CMake.

@bradh352 bradh352 merged commit cd6602b into c-ares:main Nov 9, 2024
@jimmy-park jimmy-park deleted the fix-android-build branch November 9, 2024 12:10
bradh352 pushed a commit that referenced this pull request Nov 9, 2024
I've got the following error while building c-ares on Android.

```
FAILED: _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o 
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi33 --sysroot=/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DCARES_BUILDING_LIBRARY -DHAVE_CONFIG_H=1 -DCMAKE_INTDIR=\"Debug\" -I/Users/jimmy.park/test-c-ares/build/android-arm/_deps/c-ares-source-build -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6 -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/include -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Qunused-arguments -Wno-long-long -fdiagnostics-color=always -fcolor-diagnostics -fno-limit-debug-info  -fno-omit-frame-pointer -O0 -std=c99 -fPIC -fcolor-diagnostics -w -MD -MT _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -MF _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o.d -o _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -c /Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   68 |   if (pipe2(p->filedes, O_NONBLOCK | O_CLOEXEC) != 0) {
      |       ^
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: note: did you mean 'pipe'?
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/unistd.h:275:5: note: 'pipe' declared here
  275 | int pipe(int __fds[_Nonnull 2]);
      |     ^
1 error generated.
```

It seems like the `_GNU_SOURCE` macro should be defined because of the
[`pipe2` function](https://linux.die.net/man/2/pipe).

Authored-By: Jiwoo Park (@jimmy-park)
bradh352 pushed a commit that referenced this pull request Nov 9, 2024
I've got the following error while building c-ares on Android.

```
FAILED: _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o 
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi33 --sysroot=/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DCARES_BUILDING_LIBRARY -DHAVE_CONFIG_H=1 -DCMAKE_INTDIR=\"Debug\" -I/Users/jimmy.park/test-c-ares/build/android-arm/_deps/c-ares-source-build -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6 -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/include -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Qunused-arguments -Wno-long-long -fdiagnostics-color=always -fcolor-diagnostics -fno-limit-debug-info  -fno-omit-frame-pointer -O0 -std=c99 -fPIC -fcolor-diagnostics -w -MD -MT _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -MF _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o.d -o _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -c /Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   68 |   if (pipe2(p->filedes, O_NONBLOCK | O_CLOEXEC) != 0) {
      |       ^
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: note: did you mean 'pipe'?
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/unistd.h:275:5: note: 'pipe' declared here
  275 | int pipe(int __fds[_Nonnull 2]);
      |     ^
1 error generated.
```

It seems like the `_GNU_SOURCE` macro should be defined because of the
[`pipe2` function](https://linux.die.net/man/2/pipe).

Authored-By: Jiwoo Park (@jimmy-park)
bradh352 pushed a commit that referenced this pull request Nov 9, 2024
I've got the following error while building c-ares on Android.

```
FAILED: _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o 
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi33 --sysroot=/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DCARES_BUILDING_LIBRARY -DHAVE_CONFIG_H=1 -DCMAKE_INTDIR=\"Debug\" -I/Users/jimmy.park/test-c-ares/build/android-arm/_deps/c-ares-source-build -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6 -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/include -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Qunused-arguments -Wno-long-long -fdiagnostics-color=always -fcolor-diagnostics -fno-limit-debug-info  -fno-omit-frame-pointer -O0 -std=c99 -fPIC -fcolor-diagnostics -w -MD -MT _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -MF _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o.d -o _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -c /Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   68 |   if (pipe2(p->filedes, O_NONBLOCK | O_CLOEXEC) != 0) {
      |       ^
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: note: did you mean 'pipe'?
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/unistd.h:275:5: note: 'pipe' declared here
  275 | int pipe(int __fds[_Nonnull 2]);
      |     ^
1 error generated.
```

It seems like the `_GNU_SOURCE` macro should be defined because of the
[`pipe2` function](https://linux.die.net/man/2/pipe).

Authored-By: Jiwoo Park (@jimmy-park)
bradh352 pushed a commit that referenced this pull request Nov 9, 2024
I've got the following error while building c-ares on Android.

```
FAILED: _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o 
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi33 --sysroot=/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DCARES_BUILDING_LIBRARY -DHAVE_CONFIG_H=1 -DCMAKE_INTDIR=\"Debug\" -I/Users/jimmy.park/test-c-ares/build/android-arm/_deps/c-ares-source-build -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6 -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/include -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Qunused-arguments -Wno-long-long -fdiagnostics-color=always -fcolor-diagnostics -fno-limit-debug-info  -fno-omit-frame-pointer -O0 -std=c99 -fPIC -fcolor-diagnostics -w -MD -MT _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -MF _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o.d -o _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -c /Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   68 |   if (pipe2(p->filedes, O_NONBLOCK | O_CLOEXEC) != 0) {
      |       ^
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: note: did you mean 'pipe'?
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/unistd.h:275:5: note: 'pipe' declared here
  275 | int pipe(int __fds[_Nonnull 2]);
      |     ^
1 error generated.
```

It seems like the `_GNU_SOURCE` macro should be defined because of the
[`pipe2` function](https://linux.die.net/man/2/pipe).

Authored-By: Jiwoo Park (@jimmy-park)
bradh352 pushed a commit that referenced this pull request Nov 9, 2024
I've got the following error while building c-ares on Android.

```
FAILED: _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o 
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi33 --sysroot=/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DCARES_BUILDING_LIBRARY -DHAVE_CONFIG_H=1 -DCMAKE_INTDIR=\"Debug\" -I/Users/jimmy.park/test-c-ares/build/android-arm/_deps/c-ares-source-build -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6 -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/include -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Qunused-arguments -Wno-long-long -fdiagnostics-color=always -fcolor-diagnostics -fno-limit-debug-info  -fno-omit-frame-pointer -O0 -std=c99 -fPIC -fcolor-diagnostics -w -MD -MT _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -MF _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o.d -o _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -c /Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   68 |   if (pipe2(p->filedes, O_NONBLOCK | O_CLOEXEC) != 0) {
      |       ^
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: note: did you mean 'pipe'?
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/unistd.h:275:5: note: 'pipe' declared here
  275 | int pipe(int __fds[_Nonnull 2]);
      |     ^
1 error generated.
```

It seems like the `_GNU_SOURCE` macro should be defined because of the
[`pipe2` function](https://linux.die.net/man/2/pipe).

Authored-By: Jiwoo Park (@jimmy-park)
bradh352 pushed a commit that referenced this pull request Nov 9, 2024
I've got the following error while building c-ares on Android.

```
FAILED: _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o 
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi33 --sysroot=/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DCARES_BUILDING_LIBRARY -DHAVE_CONFIG_H=1 -DCMAKE_INTDIR=\"Debug\" -I/Users/jimmy.park/test-c-ares/build/android-arm/_deps/c-ares-source-build -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6 -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/include -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Qunused-arguments -Wno-long-long -fdiagnostics-color=always -fcolor-diagnostics -fno-limit-debug-info  -fno-omit-frame-pointer -O0 -std=c99 -fPIC -fcolor-diagnostics -w -MD -MT _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -MF _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o.d -o _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -c /Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   68 |   if (pipe2(p->filedes, O_NONBLOCK | O_CLOEXEC) != 0) {
      |       ^
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: note: did you mean 'pipe'?
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/unistd.h:275:5: note: 'pipe' declared here
  275 | int pipe(int __fds[_Nonnull 2]);
      |     ^
1 error generated.
```

It seems like the `_GNU_SOURCE` macro should be defined because of the
[`pipe2` function](https://linux.die.net/man/2/pipe).

Authored-By: Jiwoo Park (@jimmy-park)
bradh352 pushed a commit that referenced this pull request Nov 9, 2024
I've got the following error while building c-ares on Android.

```
FAILED: _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o 
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi33 --sysroot=/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DCARES_BUILDING_LIBRARY -DHAVE_CONFIG_H=1 -DCMAKE_INTDIR=\"Debug\" -I/Users/jimmy.park/test-c-ares/build/android-arm/_deps/c-ares-source-build -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6 -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/include -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Qunused-arguments -Wno-long-long -fdiagnostics-color=always -fcolor-diagnostics -fno-limit-debug-info  -fno-omit-frame-pointer -O0 -std=c99 -fPIC -fcolor-diagnostics -w -MD -MT _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -MF _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o.d -o _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -c /Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   68 |   if (pipe2(p->filedes, O_NONBLOCK | O_CLOEXEC) != 0) {
      |       ^
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: note: did you mean 'pipe'?
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/unistd.h:275:5: note: 'pipe' declared here
  275 | int pipe(int __fds[_Nonnull 2]);
      |     ^
1 error generated.
```

It seems like the `_GNU_SOURCE` macro should be defined because of the
[`pipe2` function](https://linux.die.net/man/2/pipe).

Authored-By: Jiwoo Park (@jimmy-park)
bradh352 pushed a commit that referenced this pull request Nov 9, 2024
I've got the following error while building c-ares on Android.

```
FAILED: _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o 
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi33 --sysroot=/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DCARES_BUILDING_LIBRARY -DHAVE_CONFIG_H=1 -DCMAKE_INTDIR=\"Debug\" -I/Users/jimmy.park/test-c-ares/build/android-arm/_deps/c-ares-source-build -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6 -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/include -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Qunused-arguments -Wno-long-long -fdiagnostics-color=always -fcolor-diagnostics -fno-limit-debug-info  -fno-omit-frame-pointer -O0 -std=c99 -fPIC -fcolor-diagnostics -w -MD -MT _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -MF _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o.d -o _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -c /Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   68 |   if (pipe2(p->filedes, O_NONBLOCK | O_CLOEXEC) != 0) {
      |       ^
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: note: did you mean 'pipe'?
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/unistd.h:275:5: note: 'pipe' declared here
  275 | int pipe(int __fds[_Nonnull 2]);
      |     ^
1 error generated.
```

It seems like the `_GNU_SOURCE` macro should be defined because of the
[`pipe2` function](https://linux.die.net/man/2/pipe).

Authored-By: Jiwoo Park (@jimmy-park)
bradh352 pushed a commit that referenced this pull request Nov 9, 2024
I've got the following error while building c-ares on Android.

```
FAILED: _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o 
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang --target=armv7-none-linux-androideabi33 --sysroot=/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -DCARES_BUILDING_LIBRARY -DHAVE_CONFIG_H=1 -DCMAKE_INTDIR=\"Debug\" -I/Users/jimmy.park/test-c-ares/build/android-arm/_deps/c-ares-source-build -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6 -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/include -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib -I/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Qunused-arguments -Wno-long-long -fdiagnostics-color=always -fcolor-diagnostics -fno-limit-debug-info  -fno-omit-frame-pointer -O0 -std=c99 -fPIC -fcolor-diagnostics -w -MD -MT _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -MF _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o.d -o _deps/c-ares-source-build/src/lib/CMakeFiles/c-ares.dir/Debug/event/ares_event_wake_pipe.c.o -c /Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: error: call to undeclared function 'pipe2'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   68 |   if (pipe2(p->filedes, O_NONBLOCK | O_CLOEXEC) != 0) {
      |       ^
/Users/jimmy.park/test-c-ares/build/.cache/c-ares-source/b6ff14176cd38f824ca7aa8b1acab422ed5556a6/src/lib/event/ares_event_wake_pipe.c:68:7: note: did you mean 'pipe'?
/Users/jimmy.park/Library/Android/sdk/ndk/27.2.12479018/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/unistd.h:275:5: note: 'pipe' declared here
  275 | int pipe(int __fds[_Nonnull 2]);
      |     ^
1 error generated.
```

It seems like the `_GNU_SOURCE` macro should be defined because of the
[`pipe2` function](https://linux.die.net/man/2/pipe).

Authored-By: Jiwoo Park (@jimmy-park)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants