lib: include necessary headers for inet_ntop/inet_pton
Include `netinet/in.h` for FreeBSD/OpenBSD. Also include `sys/socket.h`
just in case, based on earlier code in `tests/libtest/lib1960.c`.
Also:
- document these in `CMakeLists.txt`.
- add a CI job testing FreeBSD with no unity and no test bundles.
(without running tests to keep it fast)
FreeBSD (autotools):
```
../../../tests/libtest/lib1960.c:66:22: error: variable has incomplete type 'struct sockaddr_in'
66 | struct sockaddr_in serv_addr;
| ^
../../../tests/libtest/lib1960.c:66:10: note: forward declaration of 'struct sockaddr_in'
66 | struct sockaddr_in serv_addr;
| ^
```
Ref: https://github.com/curl/curl/actions/runs/13159721509/job/36725114118?pr=16188#step:3:5289
OpenBSD (cmake):
```
/home/runner/work/curl/curl/tests/libtest/lib1960.c:66:22: error: variable has incomplete type 'struct sockaddr_in'
struct sockaddr_in serv_addr;
^
/home/runner/work/curl/curl/tests/libtest/lib1960.c:66:10: note: forward declaration of 'struct sockaddr_in'
struct sockaddr_in serv_addr;
^
1 error generated.
```
Ref: https://github.com/curl/curl/actions/runs/13159721509/job/36725102004?pr=16188#step:3:2166
Reported-by: CueXXIII on Github
Fixes #16184
Follow-up to a3585c9576 #15543
Closes #16188
This commit is contained in:
parent
14f26f5ee7
commit
6fc703904b
19
.github/workflows/non-native.yml
vendored
19
.github/workflows/non-native.yml
vendored
@ -117,13 +117,14 @@ jobs:
|
|||||||
echo '::endgroup::'
|
echo '::endgroup::'
|
||||||
|
|
||||||
freebsd:
|
freebsd:
|
||||||
name: "FreeBSD, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.compiler }} openssl ${{ matrix.arch }}"
|
name: "FreeBSD, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.compiler }} openssl${{ matrix.desc }} ${{ matrix.arch }}"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- { build: 'autotools', arch: 'x86_64', compiler: 'clang' }
|
- { build: 'autotools', arch: 'x86_64', compiler: 'clang' }
|
||||||
|
- { build: 'cmake' , arch: 'x86_64', compiler: 'clang', options: '-DCMAKE_UNITY_BUILD=OFF -DCURL_TEST_BUNDLES=OFF', tflags: 'skiprun', desc: ' !unity !bundle !testrun' }
|
||||||
- { build: 'autotools', arch: 'arm64', compiler: 'clang' }
|
- { build: 'autotools', arch: 'arm64', compiler: 'clang' }
|
||||||
- { build: 'cmake' , arch: 'arm64', compiler: 'clang' }
|
- { build: 'cmake' , arch: 'arm64', compiler: 'clang' }
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@ -148,14 +149,18 @@ jobs:
|
|||||||
--prefix="${HOME}"/install \
|
--prefix="${HOME}"/install \
|
||||||
--with-openssl \
|
--with-openssl \
|
||||||
--with-brotli --enable-ldap --enable-ldaps --with-libidn2 --with-libssh2 --with-nghttp2 --with-gssapi \
|
--with-brotli --enable-ldap --enable-ldaps --with-libidn2 --with-libssh2 --with-nghttp2 --with-gssapi \
|
||||||
--disable-dependency-tracking || { tail -n 1000 config.log; false; }
|
--disable-dependency-tracking \
|
||||||
|
${{ matrix.options }} \
|
||||||
|
|| { tail -n 1000 config.log; false; }
|
||||||
echo '::group::curl_config.h (raw)'; cat lib/curl_config.h || true; echo '::endgroup::'
|
echo '::group::curl_config.h (raw)'; cat lib/curl_config.h || true; echo '::endgroup::'
|
||||||
echo '::group::curl_config.h'; grep -F '#define' lib/curl_config.h | sort || true; echo '::endgroup::'
|
echo '::group::curl_config.h'; grep -F '#define' lib/curl_config.h | sort || true; echo '::endgroup::'
|
||||||
time make -j3 install
|
time make -j3 install
|
||||||
src/curl --disable --version
|
src/curl --disable --version
|
||||||
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
|
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
|
||||||
time make -j3 -C tests
|
time make -j3 -C tests
|
||||||
time make test-ci V=1 TFLAGS='-j4'
|
if [ '${{ matrix.tflags }}' != 'skiprun' ]; then
|
||||||
|
time make test-ci V=1 TFLAGS='-j4'
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
echo '::group::build examples'
|
echo '::group::build examples'
|
||||||
time make -j3 examples
|
time make -j3 examples
|
||||||
@ -179,6 +184,7 @@ jobs:
|
|||||||
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
|
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
|
||||||
-DCURL_USE_OPENSSL=ON \
|
-DCURL_USE_OPENSSL=ON \
|
||||||
-DCURL_USE_GSSAPI=ON \
|
-DCURL_USE_GSSAPI=ON \
|
||||||
|
${{ matrix.options }} \
|
||||||
|| { cat bld/CMakeFiles/CMake*.yaml; false; }
|
|| { cat bld/CMakeFiles/CMake*.yaml; false; }
|
||||||
echo '::group::curl_config.h (raw)'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
|
echo '::group::curl_config.h (raw)'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
|
||||||
echo '::group::curl_config.h'; grep -F '#define' bld/lib/curl_config.h | sort || true; echo '::endgroup::'
|
echo '::group::curl_config.h'; grep -F '#define' bld/lib/curl_config.h | sort || true; echo '::endgroup::'
|
||||||
@ -186,7 +192,9 @@ jobs:
|
|||||||
bld/src/curl --disable --version
|
bld/src/curl --disable --version
|
||||||
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
|
if [ '${{ matrix.arch }}' = 'x86_64' ]; then # Slow on emulated CPU
|
||||||
time cmake --build bld --config Debug --target testdeps
|
time cmake --build bld --config Debug --target testdeps
|
||||||
time cmake --build bld --config Debug --target test-ci
|
if [ '${{ matrix.tflags }}' != 'skiprun' ]; then
|
||||||
|
time cmake --build bld --config Debug --target test-ci
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
echo '::group::build examples'
|
echo '::group::build examples'
|
||||||
time cmake --build bld --config Debug --target curl-examples
|
time cmake --build bld --config Debug --target curl-examples
|
||||||
@ -213,7 +221,8 @@ jobs:
|
|||||||
mkdir bld && cd bld && time ../configure --enable-unity --enable-test-bundles --enable-debug --enable-warnings --enable-werror \
|
mkdir bld && cd bld && time ../configure --enable-unity --enable-test-bundles --enable-debug --enable-warnings --enable-werror \
|
||||||
--prefix="${HOME}"/install \
|
--prefix="${HOME}"/install \
|
||||||
--with-openssl \
|
--with-openssl \
|
||||||
--disable-dependency-tracking || { tail -n 1000 config.log; false; }
|
--disable-dependency-tracking \
|
||||||
|
|| { tail -n 1000 config.log; false; }
|
||||||
echo '::group::curl_config.h (raw)'; cat lib/curl_config.h || true; echo '::endgroup::'
|
echo '::group::curl_config.h (raw)'; cat lib/curl_config.h || true; echo '::endgroup::'
|
||||||
echo '::group::curl_config.h'; grep -F '#define' lib/curl_config.h | sort || true; echo '::endgroup::'
|
echo '::group::curl_config.h'; grep -F '#define' lib/curl_config.h | sort || true; echo '::endgroup::'
|
||||||
time gmake -j3 install
|
time gmake -j3 install
|
||||||
|
|||||||
@ -1767,8 +1767,8 @@ endif()
|
|||||||
if(APPLE)
|
if(APPLE)
|
||||||
check_function_exists("mach_absolute_time" HAVE_MACH_ABSOLUTE_TIME)
|
check_function_exists("mach_absolute_time" HAVE_MACH_ABSOLUTE_TIME)
|
||||||
endif()
|
endif()
|
||||||
check_symbol_exists("inet_ntop" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_NTOP) # arpa/inet.h
|
check_symbol_exists("inet_ntop" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_NTOP) # arpa/inet.h netinet/in.h sys/socket.h
|
||||||
check_symbol_exists("inet_pton" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_PTON) # arpa/inet.h
|
check_symbol_exists("inet_pton" "${CURL_INCLUDES};stdlib.h;string.h" HAVE_INET_PTON) # arpa/inet.h netinet/in.h sys/socket.h
|
||||||
|
|
||||||
check_symbol_exists("fsetxattr" "sys/xattr.h" HAVE_FSETXATTR)
|
check_symbol_exists("fsetxattr" "sys/xattr.h" HAVE_FSETXATTR)
|
||||||
if(HAVE_FSETXATTR)
|
if(HAVE_FSETXATTR)
|
||||||
|
|||||||
@ -29,6 +29,12 @@
|
|||||||
char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size);
|
char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size);
|
||||||
|
|
||||||
#ifdef HAVE_INET_NTOP
|
#ifdef HAVE_INET_NTOP
|
||||||
|
#ifdef HAVE_NETINET_IN_H
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_ARPA_INET_H
|
#ifdef HAVE_ARPA_INET_H
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -29,6 +29,12 @@
|
|||||||
int Curl_inet_pton(int, const char *, void *);
|
int Curl_inet_pton(int, const char *, void *);
|
||||||
|
|
||||||
#ifdef HAVE_INET_PTON
|
#ifdef HAVE_INET_PTON
|
||||||
|
#ifdef HAVE_NETINET_IN_H
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_ARPA_INET_H
|
#ifdef HAVE_ARPA_INET_H
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user