fix: Fix crash in static-linked linux builds

The official, static-linked linux builds were crashing in their use of
getaddrinfo, which libcurl was configured to use.  Both getaddrinfo
and all of its alternatives available in glibc fail with static
linking.

We can fix this by configuring libcurl to use libc-ares on Linux
instead.  This allows us to keep the benefits of a statically-linked
Linux binary.

Closes #996

Change-Id: Ib4a9eb939813fd165727788726459ef4adf3fc4d
This commit is contained in:
Joey Parrish 2021-10-12 14:55:13 -07:00
parent 9fc3ee1186
commit e2d66b33fa
10 changed files with 27 additions and 5 deletions

View File

@ -43,6 +43,15 @@ runs:
echo "::endgroup::"
fi
- name: Install c-ares (Linux only)
shell: bash
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
echo "::group::Install c-ares"
sudo apt install -y libc-ares-dev
echo "::endgroup::"
fi
- name: Install depot tools
shell: bash
run: |

View File

@ -12,6 +12,7 @@ for [other distros below](#notes-for-other-linux-distros).
sudo apt-get update
sudo apt-get install -y \
curl \
libc-ares-dev \
build-essential git python python3
```
@ -243,7 +244,7 @@ Use `apk` command to install dependencies:
```shell
apk add --no-cache \
bash curl \
bsd-compat-headers linux-headers \
bsd-compat-headers c-ares-dev linux-headers \
build-base git ninja python2 python3
```
@ -270,6 +271,7 @@ Instead of running `sudo apt-get install` to install build dependencies, run:
```shell
sudo pacman -Sy --needed \
core/which \
c-ares \
gcc git python2 python3
```
@ -284,7 +286,7 @@ Instead of running `sudo apt-get install` to install build dependencies, run:
```shell
su -c 'yum install -y \
which \
libatomic \
c-ares-devel libatomic \
gcc-c++ git python2'
```
@ -299,6 +301,7 @@ Use `zypper` command to install dependencies:
```shell
sudo zypper in -y \
curl which \
c-ares-devel \
gcc-c++ git python python3
```

View File

@ -3,7 +3,7 @@ FROM alpine:3.11
# Install utilities, libraries, and dev tools.
RUN apk add --no-cache \
bash curl \
bsd-compat-headers linux-headers \
bsd-compat-headers c-ares-dev linux-headers \
build-base git ninja python2 python3
# Install depot_tools.

View File

@ -3,6 +3,7 @@ FROM archlinux:latest
# Install utilities, libraries, and dev tools.
RUN pacman -Sy --needed --noconfirm \
core/which \
c-ares \
gcc git python2 python3
# Install depot_tools.

View File

@ -3,7 +3,7 @@ FROM centos:8
# Install utilities, libraries, and dev tools.
RUN yum install -y \
which \
libatomic \
c-ares-devel libatomic \
gcc-c++ git python2 python3
# Default to python3.

View File

@ -4,6 +4,7 @@ FROM debian:9
RUN apt-get update && apt-get install -y apt-utils
RUN apt-get install -y \
curl \
libc-ares-dev \
build-essential git python python3
# Install depot_tools.

View File

@ -3,7 +3,7 @@ FROM fedora:34
# Install utilities, libraries, and dev tools.
RUN yum install -y \
which \
libatomic \
c-ares-devel libatomic \
gcc-c++ git python2
# Default to python3.

View File

@ -3,6 +3,7 @@ FROM opensuse/leap:15
# Install utilities, libraries, and dev tools.
RUN zypper in -y \
curl which \
c-ares-devel \
gcc-c++ git python python3
# Install depot_tools.

View File

@ -4,6 +4,7 @@ FROM ubuntu:18.04
RUN apt-get update && apt-get install -y apt-utils
RUN apt-get install -y \
curl \
libc-ares-dev \
build-essential git python python3
# Install depot_tools.

View File

@ -37,10 +37,16 @@
'HAVE_CONFIG_H',
'CURL_CA_BUNDLE="<!(config/linux/find_curl_ca_bundle.sh)"',
'USE_OPENSSL',
'USE_ARES',
],
'include_dirs': [
'config/linux',
],
'link_settings': {
'libraries': [
'-lcares',
],
},
},
}],
['OS == "mac"', {