mirror of https://github.com/c-ares/c-ares.git
Use `_GNU_SOURCE` macro on Android (#914)
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)v1.28
parent
1f85d725ec
commit
c2b268fd9d
1 changed files with 1 additions and 1 deletions
Loading…
Reference in new issue