Skip to content

Commit

Permalink
chore(deps): upgrade pkg-config on CentOS-7 to avoid bug (#6846)
Browse files Browse the repository at this point in the history
There's a [bug] w/ CentOS-7's version of `pkg-config` that can cause
invocations to take a reeeeeaaaaly long time to complete. We discovered
this when upgrading to grpc-1.38.1 and had to [rollback] the upgrade.

The fix to `pkg-config` was rolled out about 8 years ago in `pkg-config`
0.28. This PR upgrades the pkg-config we use on CentOS-7 to the latest
as of this writing. After this, I think we should be able to upgrade
grpc again.

[bug]: https://bugs.freedesktop.org/show_bug.cgi?id=54716
[rollback]: #6840
  • Loading branch information
devjgm committed Jun 23, 2021
1 parent f6e4b11 commit 82c72de
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
21 changes: 18 additions & 3 deletions ci/cloudbuild/dockerfiles/demo-centos-7.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ RUN yum install -y centos-release-scl yum-utils
RUN yum-config-manager --enable rhel-server-rhscl-7-rpms
RUN yum makecache && \
yum install -y automake ccache cmake3 curl-devel devtoolset-7 gcc gcc-c++ \
git libtool make openssl-devel patch pkgconfig re2-devel tar wget \
which zlib-devel
git libtool make openssl-devel patch re2-devel tar wget which zlib-devel
RUN ln -sf /usr/bin/cmake3 /usr/bin/cmake && ln -sf /usr/bin/ctest3 /usr/bin/ctest
# ```

Expand All @@ -53,6 +52,22 @@ ENV LD_LIBRARY_PATH /opt/rh/devtoolset-7/root/usr/lib64:/opt/rh/devtoolset-7/roo
# scl enable devtoolset-7 bash
# ```

# CentOS-7 ships with `pkg-config` 0.27.1, which has a
# [bug](https://bugs.freedesktop.org/show_bug.cgi?id=54716) that can make
# invocations take extremely long to complete. If you plan to use `pkg-config`
# with any of the installed artifacts, you'll want to upgrade it to something
# newer. If not, `yum install pkgconfig` should work instead.

# ```bash
WORKDIR /var/tmp/build/pkg-config-cpp
RUN curl -sSL https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz | \
tar -xzf - --strip-components=1 && \
./configure --with-internal-glib && \
make -j ${NCPU:-4} && \
make install && \
ldconfig
# ```

# The following steps will install libraries and tools in `/usr/local`. By
# default CentOS-7 does not search for shared libraries in these directories,
# there are multiple ways to solve this problem, the following steps are one
Expand All @@ -61,7 +76,7 @@ ENV LD_LIBRARY_PATH /opt/rh/devtoolset-7/root/usr/lib64:/opt/rh/devtoolset-7/roo
# ```bash
RUN (echo "/usr/local/lib" ; echo "/usr/local/lib64") | \
tee /etc/ld.so.conf.d/usrlocal.conf
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig
ENV PATH=/usr/local/bin:${PATH}
# ```

Expand Down
21 changes: 18 additions & 3 deletions doc/packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -1378,8 +1378,7 @@ sudo yum install -y centos-release-scl yum-utils
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
sudo yum makecache && \
sudo yum install -y automake ccache cmake3 curl-devel devtoolset-7 gcc gcc-c++ \
git libtool make openssl-devel patch pkgconfig re2-devel tar wget \
which zlib-devel
git libtool make openssl-devel patch re2-devel tar wget which zlib-devel
sudo ln -sf /usr/bin/cmake3 /usr/bin/cmake && sudo ln -sf /usr/bin/ctest3 /usr/bin/ctest
```

Expand All @@ -1390,6 +1389,22 @@ by `devtoolset-7`.
scl enable devtoolset-7 bash
```

CentOS-7 ships with `pkg-config` 0.27.1, which has a
[bug](https://bugs.freedesktop.org/show_bug.cgi?id=54716) that can make
invocations take extremely long to complete. If you plan to use `pkg-config`
with any of the installed artifacts, you'll want to upgrade it to something
newer. If not, `sudo yum install pkgconfig` should work instead.

```bash
mkdir -p $HOME/Downloads/pkg-config-cpp && cd $HOME/Downloads/pkg-config-cpp
curl -sSL https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz | \
tar -xzf - --strip-components=1 && \
./configure --with-internal-glib && \
make -j ${NCPU:-4} && \
sudo make install && \
sudo ldconfig
```

The following steps will install libraries and tools in `/usr/local`. By
default CentOS-7 does not search for shared libraries in these directories,
there are multiple ways to solve this problem, the following steps are one
Expand All @@ -1398,7 +1413,7 @@ solution:
```bash
(echo "/usr/local/lib" ; echo "/usr/local/lib64") | \
sudo tee /etc/ld.so.conf.d/usrlocal.conf
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig
export PATH=/usr/local/bin:${PATH}
```

Expand Down

0 comments on commit 82c72de

Please sign in to comment.