Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[c-ares] Build error (1.33.0) #40387

Closed
cd606 opened this issue Aug 10, 2024 · 10 comments
Closed

[c-ares] Build error (1.33.0) #40387

cd606 opened this issue Aug 10, 2024 · 10 comments
Assignees
Labels
category:question This issue is a question

Comments

@cd606
Copy link

cd606 commented Aug 10, 2024

Hello, my c-ares (1.33.0) build (x64-linux, Centos 7, gcc 11) failed with the following error message, could somebody help look into this? Thanks!

/opt/rh/devtoolset-11/root/usr/bin/cc -DCARES_BUILDING_LIBRARY -DHAVE_CONFIG_H=1 -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -I$HOME/vcpkg/buildtrees/c-ares/x64-linux-dbg -I$HOME/vcpkg/buildtrees/c-ares/src/v1.33.0-7b5315fac5.clean -I$HOME/vcpkg/buildtrees/c-ares/src/v1.33.0-7b5315fac5.clean/include -I$HOME/vcpkg/buildtrees/c-ares/src/v1.33.0-7b5315fac5.clean/src/lib -fPIC -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wjump-misses-init -Wlogical-op -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wno-coverage-mismatch -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wtrampolines -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Wimplicit-fallthrough=3 -Werror=implicit-int -Werror=implicit-function-declaration -Wno-long-long -fdiagnostics-color=always -g -fno-omit-frame-pointer -O0 -std=gnu90 -MD -MT src/lib/CMakeFiles/c-ares.dir/ares__socket.c.o -MF src/lib/CMakeFiles/c-ares.dir/ares__socket.c.o.d -o src/lib/CMakeFiles/c-ares.dir/ares__socket.c.o -c $HOME/vcpkg/buildtrees/c-ares/src/v1.33.0-7b5315fac5.clean/src/lib/ares__socket.c
$HOME/vcpkg/buildtrees/c-ares/src/v1.33.0-7b5315fac5.clean/src/lib/ares__socket.c: In function ‘configure_socket’:
$HOME/vcpkg/buildtrees/c-ares/src/v1.33.0-7b5315fac5.clean/src/lib/ares__socket.c:64:30: error: ‘TCP_FASTOPEN_CONNECT’ undeclared (first use in this function)
64 | # define TFO_CLIENT_SOCKOPT TCP_FASTOPEN_CONNECT
| ^~~~~~~~~~~~~~~~~~~~
$HOME/vcpkg/buildtrees/c-ares/src/v1.33.0-7b5315fac5.clean/src/lib/ares__socket.c:456:43: note: in expansion of macro ‘TFO_CLIENT_SOCKOPT’
456 | setsockopt(conn->fd, IPPROTO_TCP, TFO_CLIENT_SOCKOPT, (void *)&opt,
| ^~~~~~~~~~~~~~~~~~
$HOME/vcpkg/buildtrees/c-ares/src/v1.33.0-7b5315fac5.clean/src/lib/ares__socket.c:64:30: note: each undeclared identifier is reported only once for each function it appears in
64 | # define TFO_CLIENT_SOCKOPT TCP_FASTOPEN_CONNECT
| ^~~~~~~~~~~~~~~~~~~~
$HOME/vcpkg/buildtrees/c-ares/src/v1.33.0-7b5315fac5.clean/src/lib/ares__socket.c:456:43: note: in expansion of macro ‘TFO_CLIENT_SOCKOPT’
456 | setsockopt(conn->fd, IPPROTO_TCP, TFO_CLIENT_SOCKOPT, (void *)&opt,

@greenozon
Copy link

Looks like your CentOS is too old and does not have support for TCP_FASTOPEN_CONNECT

I"ve tried on Ubuntu 20.04 LTS and it was successfully built:

./vcpkg install c-ares
Computing installation plan...
The following packages will be built and installed:
    c-ares:x64-linux@1.33.0
Detecting compiler hash for triplet x64-linux...
Compiler found: /bin/c++
Restored 0 package(s) from /home/usr/.cache/vcpkg/archives in 190 us. Use --debug to see more details.
Installing 1/1 [c-ares:x64-linux@1.33.0.](mailto:c-ares%3Ax64-linux@1.33.0.)..
Building [c-ares:x64-linux@1.33.0.](mailto:c-ares%3Ax64-linux@1.33.0.)..
-- Downloading [https://github.com/c-ares/c-ares/archive/v1.33.0.tar.gz](https://www.google.com/url?q=https://github.com/c-ares/c-ares/archive/v1.33.0.tar.gz&sa=D&source=calendar&usd=2&usg=AOvVaw0ubiGUrgoNRy0DmP6UcYY_) -> c-ares-c-ares-v1.33.0.tar.gz...
-- Extracting source /home/usr/vcpkg/downloads/c-ares-c-ares-v1.33.0.tar.gz
-- Applying patch avoid-docs.patch
-- Using source at /home/usr/vcpkg/buildtrees/c-ares/src/v1.33.0-7b5315fac5.clean
-- Configuring x64-linux
-- Building x64-linux-dbg
-- Building x64-linux-rel
-- Fixing pkgconfig file: /home/usr/vcpkg/packages/c-ares_x64-linux/lib/pkgconfig/libcares.pc
-- Fixing pkgconfig file: /home/usr/vcpkg/packages/c-ares_x64-linux/debug/lib/pkgconfig/libcares.pc
-- Installing: /home/usr/vcpkg/packages/c-ares_x64-linux/share/c-ares/usage
-- Installing: /home/usr/vcpkg/packages/c-ares_x64-linux/share/c-ares/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 141 ms.
Elapsed time to handle c-ares:x64-linux: 18 s
c-ares:x64-linux package ABI: 9ac860c537a79eb946214c4aaccdb1bc2be534cff43b36c1b0a9a9984f31c642
Total install time: 18 s
c-ares provides CMake targets:

  find_package(c-ares CONFIG REQUIRED)
  target_link_libraries(main PRIVATE c-ares::cares)

as a more advanced option - you could try to add missed fucntionality, eg:

https://git.centos.org/rpms/iproute/c/99be8fbcce3c2415d08028a4716229389aca3e3d.patch

@cd606
Copy link
Author

cd606 commented Aug 10, 2024

Hello, I have updated my CentOS 7 but this build failure persists. This is preventing me from using other packages dependent upon c-ares (such as grpc). Is there a way I can fallback to the c-ares and grpc versions before this upgrade? Thanks.

@greenozon
Copy link

make sure that your updated CentOS7 knows about this feature - TCP_FASTOPEN_CONNECT

what Linux Kernel version do you have?

TCP Fast Open, or TFO for short, is an extension to the TCP protocol that allow a small amount of data to be sent alongside the initial SYN packet, when a TCP connection is being established. This can save round-trips and reduce response time in certain cases.

@cd606
Copy link
Author

cd606 commented Aug 10, 2024

The kernel version is 3.10.0-1160.66.1.el7.x86_64, thanks

@greenozon
Copy link

The TCP_FASTOPEN_CONNECT socket option was added in Linux kernel version 4.11, which was released in 2017

Regarding its inclusion in CentOS, TCP_FASTOPEN_CONNECT would be available in CentOS versions that include or are based on kernel 4.11 or later.
CentOS 7, as you just shown, typically uses an older kernel by default,
but you can install a newer kernel from the CentOS Plus repository or use a custom kernel to get this feature.
CentOS 8 and later versions are more likely to include this feature by default, as they are based on newer kernels.

PS
CentOS 8 includes support for TCP_FASTOPEN_CONNECT by default.

@cd606
Copy link
Author

cd606 commented Aug 10, 2024

Thanks, I understand CentOS 7 is an old system, but before I go ahead and upgrade to CentOS 8, is there a way to fallback to older versions of c-ares and grpc? Thanks.

@dg0yt
Copy link
Contributor

dg0yt commented Aug 11, 2024

@cd606 You can pin port version in manifest mode. In classic mode, you might copy the port directory from an earlier revision, and use that as an overlay port.

And you might check with upstream if it is a known issue, or an issue they would be interested in fixing.

@FrankXie05 FrankXie05 added the category:question This issue is a question label Aug 12, 2024
@guenterberner
Copy link

@cd606
I encountered the same problem (c-ares 1.33.0 fails to build on an old SLES12 due to missing support for TCP_FASTOPEN_CONNECT). It seems that the people at c-ares added a fix for exactly this problem in version 1.33.1. It would be nice if this version could be included in vcpkg as soon as possible.
(see https://c-ares.org/changelog.html)

@dg0yt
Copy link
Contributor

dg0yt commented Aug 26, 2024

Cf. #40646

@dg0yt
Copy link
Contributor

dg0yt commented Jan 27, 2025

Obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

5 participants