From a249c26a9cb7aebb7e472e5f931aeab095fc34fa Mon Sep 17 00:00:00 2001 From: Greg Miller <9447643+devjgm@users.noreply.github.com> Date: Tue, 22 Jun 2021 18:12:46 -0400 Subject: [PATCH] chore(deps): upgrade pkg-config on CentOS-7 to avoid bug 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]: https://github.com/googleapis/google-cloud-cpp/pull/6840 --- .../dockerfiles/demo-centos-7.Dockerfile | 21 ++++++++++++++++--- doc/packaging.md | 21 ++++++++++++++++--- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/ci/cloudbuild/dockerfiles/demo-centos-7.Dockerfile b/ci/cloudbuild/dockerfiles/demo-centos-7.Dockerfile index 1dc8dc3fd4c21..d9d864252a7bd 100644 --- a/ci/cloudbuild/dockerfiles/demo-centos-7.Dockerfile +++ b/ci/cloudbuild/dockerfiles/demo-centos-7.Dockerfile @@ -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 # ``` @@ -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 @@ -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} # ``` diff --git a/doc/packaging.md b/doc/packaging.md index e914dd67f0493..040782d5a8521 100644 --- a/doc/packaging.md +++ b/doc/packaging.md @@ -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 ``` @@ -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 @@ -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} ```