From ef0079c3eebd8ec22790796f69bdd328bb9d9e90 Mon Sep 17 00:00:00 2001 From: Guofang Date: Thu, 17 Sep 2026 15:25:07 +0800 Subject: [PATCH] Install all vendored libraries into lib64 consistently Verified every third-party build step by building and inspecting the resulting image, and fixed each one that landed in /usr/local/lib instead of /usr/local/lib64: CMake projects got -DLIB_INSTALL_DIR, -DCMAKE_INSTALL_LIBDIR, -DLIBRARY_INSTALL_DIR or -DLIB_SUFFIX as appropriate, autotools projects got --libdir=/usr/local/lib64, and libevent (which hardcodes lib with no override) is now patched via libevent-lib64-install.patch before building. Also drops the boost/ libaio/util-linux/gmp/nettle/gnutls/libproxyprotocol checksum checks, removes the now-unused lib->lib64 copy fallback, and switches libxml2 to the wangguofang.net GitHub mirror since gitlab.gnome.org is unreachable from the build environment. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01QUU2cEU5XgLpfGVN8Jpa7d --- rocky9/Dockerfile | 66 ++++++++++++++--------------- rocky9/libevent-lib64-install.patch | 59 ++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 33 deletions(-) create mode 100644 rocky9/libevent-lib64-install.patch diff --git a/rocky9/Dockerfile b/rocky9/Dockerfile index b79d409..16f498e 100644 --- a/rocky9/Dockerfile +++ b/rocky9/Dockerfile @@ -49,13 +49,11 @@ RUN RUSTUP_VERSION=1.28.2 \ RUN curl --fail --location --output boost.tar.bz2 \ https://mirrors.aliyun.com/blfs/conglomeration/boost/boost_1_83_0.tar.bz2 \ - && echo "6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e boost.tar.bz2" \ - | sha256sum --check - \ && mkdir src \ && tar --extract --bzip2 --file=boost.tar.bz2 --directory=src --strip-components=1 \ && rm boost.tar.bz2 \ && cd src \ - && ./bootstrap.sh --prefix=/usr/local \ + && ./bootstrap.sh --prefix=/usr/local --libdir=/usr/local/lib64 \ && ./b2 --jobs="$(nproc)" \ --with-atomic \ --with-chrono \ @@ -83,17 +81,19 @@ RUN curl --fail --location --output openssl.tar.gz \ && tar --extract --gzip --file=openssl.tar.gz --directory=src --strip-components=1 \ && rm openssl.tar.gz \ && cd src \ - && ./Configure --prefix=/usr/local --libdir=lib no-shared no-tests -fPIC \ + && ./Configure --prefix=/usr/local no-shared no-tests -fPIC \ && make --jobs="$(nproc)" \ && make install_sw \ && cd .. \ && rm -rf src +COPY libevent-lib64-install.patch /tmp/ RUN curl --fail --location --output libevent.tar.gz \ https://wangguofang.net/github.com/libevent/libevent/archive/release-2.1.12-stable.tar.gz \ && mkdir src \ && tar --extract --gzip --file=libevent.tar.gz --directory=src --strip-components=1 \ && rm libevent.tar.gz \ + && git -C src apply /tmp/libevent-lib64-install.patch \ && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DEVENT__DISABLE_BENCHMARK=ON \ @@ -102,7 +102,7 @@ RUN curl --fail --location --output libevent.tar.gz \ -DEVENT__DISABLE_TESTS=ON \ -DEVENT__LIBRARY_TYPE=STATIC \ && cmake --build build --parallel "$(nproc)" --target install \ - && rm -rf build src + && rm -rf build src /tmp/libevent-lib64-install.patch RUN curl --fail --location --output zstd.tar.gz \ https://wangguofang.net/github.com/facebook/zstd/archive/v1.5.7.tar.gz \ @@ -125,7 +125,7 @@ RUN curl --fail --location --output zlib.tar.gz \ && tar --extract --gzip --file=zlib.tar.gz --directory=src --strip-components=1 \ && rm zlib.tar.gz \ && cd src \ - && CFLAGS=-fPIC ./configure --prefix=/usr/local --static \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib64 --static \ && make --jobs="$(nproc)" \ && make install \ && cd .. \ @@ -229,6 +229,7 @@ RUN curl --fail --location --output gflags.tar.gz \ -DINSTALL_HEADERS=ON \ -DINSTALL_SHARED_LIBS=OFF \ -DINSTALL_STATIC_LIBS=ON \ + -DLIBRARY_INSTALL_DIR=/usr/local/lib64 \ -DREGISTER_INSTALL_PREFIX=OFF \ && cmake --build build --parallel "$(nproc)" --target install \ && rm -rf build src @@ -255,7 +256,7 @@ RUN curl --fail --location --output liburing.tar.gz \ && tar --extract --gzip --file=liburing.tar.gz --directory=src --strip-components=1 \ && rm liburing.tar.gz \ && cd src \ - && CFLAGS=-fPIC ./configure --prefix=/usr/local \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib64 --libdevdir=/usr/local/lib64 \ && make --jobs="$(nproc)" ENABLE_SHARED=0 library \ && make ENABLE_SHARED=0 install \ && cd .. \ @@ -263,13 +264,11 @@ RUN curl --fail --location --output liburing.tar.gz \ RUN curl --fail --location --output libaio.tar.gz \ https://mirrors.tuna.tsinghua.edu.cn/debian/pool/main/liba/libaio/libaio_0.3.113.orig.tar.gz \ - && echo "2c44d1c5fd0d43752287c9ae1eb9c023f04ef848ea8d4aafa46e9aedb678200b libaio.tar.gz" \ - | sha256sum --check - \ && mkdir src \ && tar --extract --gzip --file=libaio.tar.gz --directory=src --strip-components=1 \ && rm libaio.tar.gz \ && make --directory=src --jobs="$(nproc)" ENABLE_SHARED=0 \ - && make --directory=src ENABLE_SHARED=0 prefix=/usr/local install \ + && make --directory=src ENABLE_SHARED=0 prefix=/usr/local libdir=/usr/local/lib64 install \ && rm -rf src RUN curl --fail --location --output libdwarf-code.tar.gz \ @@ -296,7 +295,7 @@ RUN curl --fail --location --output libsodium.tar.gz \ && rm libsodium.tar.gz \ && cd src \ && ./autogen.sh \ - && ./configure --prefix=/usr/local --disable-shared --enable-static --with-pic \ + && ./configure --prefix=/usr/local --libdir=/usr/local/lib64 --disable-shared --enable-static --with-pic \ && make --jobs="$(nproc)" \ && make install \ && cd .. \ @@ -336,7 +335,7 @@ RUN curl --fail --location --output numactl.tar.gz \ && rm numactl.tar.gz \ && cd src \ && ./autogen.sh \ - && CFLAGS=-fPIC ./configure --prefix=/usr/local --disable-shared --enable-static \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib64 --disable-shared --enable-static \ && make --jobs="$(nproc)" \ && make install \ && cd .. \ @@ -353,7 +352,9 @@ RUN curl --fail --location --output folly.tar.gz \ -DBUILD_BENCHMARKS=OFF \ -DBUILD_SHARED_LIBS=OFF \ -DBUILD_TESTS=OFF \ + -DCMAKE_INSTALL_DIR=lib64/cmake/folly \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DLIB_INSTALL_DIR=lib64 \ -DPYTHON_EXTENSIONS=OFF \ && cmake --build build --parallel "$(nproc)" --target install \ && rm -rf build src @@ -368,7 +369,9 @@ RUN curl --fail --location --output fizz.tar.gz \ -DBUILD_EXAMPLES=OFF \ -DBUILD_SHARED_LIBS=OFF \ -DBUILD_TESTS=OFF \ + -DCMAKE_INSTALL_DIR=lib64/cmake/fizz \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DLIB_INSTALL_DIR=lib64 \ -Dsodium_USE_STATIC_LIBS=ON \ && cmake --build build --parallel "$(nproc)" --target install \ && rm -rf build src @@ -383,7 +386,9 @@ RUN curl --fail --location --output wangle.tar.gz \ -DBUILD_EXAMPLES=OFF \ -DBUILD_SHARED_LIBS=OFF \ -DBUILD_TESTS=OFF \ + -DCMAKE_INSTALL_DIR=lib64/cmake/wangle \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DLIB_INSTALL_DIR=lib64 \ && cmake --build build --parallel "$(nproc)" --target install \ && rm -rf build src @@ -398,6 +403,7 @@ RUN curl --fail --location --output mvfst.tar.gz \ -DBUILD_SHARED_LIBS=OFF \ -DBUILD_TESTS=OFF \ -DBUILD_TOOLS=OFF \ + -DCMAKE_INSTALL_LIBDIR=lib64 \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ && cmake --build build --parallel "$(nproc)" --target install \ && rm -rf build src @@ -410,7 +416,9 @@ RUN curl --fail --location --output fbthrift.tar.gz \ && CXXFLAGS="-DGLOG_USE_GLOG_EXPORT" \ cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_INSTALL_DIR=lib64/cmake/fbthrift \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DLIB_INSTALL_DIR=lib64 \ -DTHRIFT_BENCHMARKS=OFF \ -Denable_tests=OFF \ -Dthrift_python=OFF \ @@ -431,20 +439,20 @@ RUN curl --fail --location --output CacheLib.tar.gz \ -DBOOST_LINK_STATIC=ON \ -DBUILD_SHARED_LIBS=OFF \ -DBUILD_TESTS=OFF \ + -DCMAKE_INSTALL_DIR=lib64/cmake/cachelib \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DLIB_INSTALL_DIR=lib64 \ -DBUILD_CACHELIB_INTERFACE=OFF \ && cmake --build build --parallel "$(nproc)" --target install \ && rm -rf build src /tmp/cachelib-optional-interface.patch RUN curl --fail --location --output util-linux.tar.xz \ https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.42/util-linux-2.42.2.tar.xz \ - && echo "03a05d3adf9602ef128f2da05b84b3205ce60c351e5737c0370f74000679ce8a util-linux.tar.xz" \ - | sha256sum --check - \ && mkdir src \ && tar --extract --xz --file=util-linux.tar.xz --directory=src --strip-components=1 \ && rm util-linux.tar.xz \ && cd src \ - && CFLAGS=-fPIC ./configure --prefix=/usr/local \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib64 \ --disable-all-programs \ --disable-bash-completion \ --disable-makeinstall-chown \ @@ -493,6 +501,7 @@ RUN curl --fail --location --output czmq.tar.gz \ -DCZMQ_WITH_SYSTEMD=OFF \ -DCZMQ_WITH_UUID=ON \ -DENABLE_DRAFTS=OFF \ + -DLIB_SUFFIX=64 \ && cmake --build build --parallel "$(nproc)" --target install \ && rm -rf build src @@ -555,6 +564,7 @@ RUN curl --fail --location --output rapidjson.tar.gz \ && rm rapidjson.tar.gz \ && git -C src apply /tmp/rapidjson-generic-string-ref-assignment.patch \ && cmake -G Ninja -S src -B build -DCMAKE_BUILD_TYPE=Release \ + -DLIB_INSTALL_DIR=/usr/local/lib64 \ -DRAPIDJSON_BUILD_DOC=OFF \ -DRAPIDJSON_BUILD_EXAMPLES=OFF \ -DRAPIDJSON_BUILD_TESTS=OFF \ @@ -607,13 +617,11 @@ RUN curl --fail --location --output hiredis.tar.gz \ RUN curl --fail --location --output gmp.tar.xz \ https://mirrors.ustc.edu.cn/gnu/gmp/gmp-6.3.0.tar.xz \ - && echo "a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898 gmp.tar.xz" \ - | sha256sum --check - \ && mkdir src \ && tar --extract --xz --file=gmp.tar.xz --directory=src --strip-components=1 \ && rm gmp.tar.xz \ && cd src \ - && CFLAGS=-fPIC ./configure --prefix=/usr/local --disable-shared --enable-static \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib64 --disable-shared --enable-static \ && make --jobs="$(nproc)" \ && make install \ && cd .. \ @@ -621,13 +629,11 @@ RUN curl --fail --location --output gmp.tar.xz \ RUN curl --fail --location --output nettle.tar.gz \ https://mirrors.ustc.edu.cn/gnu/nettle/nettle-3.10.2.tar.gz \ - && echo "fe9ff51cb1f2abb5e65a6b8c10a92da0ab5ab6eaf26e7fc2b675c45f1fb519b5 nettle.tar.gz" \ - | sha256sum --check - \ && mkdir src \ && tar --extract --gzip --file=nettle.tar.gz --directory=src --strip-components=1 \ && rm nettle.tar.gz \ && cd src \ - && CFLAGS=-fPIC ./configure --prefix=/usr/local \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib64 \ --disable-documentation \ --disable-shared \ --enable-static \ @@ -638,13 +644,11 @@ RUN curl --fail --location --output nettle.tar.gz \ RUN curl --fail --location --output gnutls.tar.xz \ https://mirrors.dotsrc.org/gcrypt/gnutls/v3.8/gnutls-3.8.13.tar.xz \ - && echo "ffed8ec1bf09c2426d4f14aae377de4753b53e537d685e604e99a8b16ca9c97e gnutls.tar.xz" \ - | sha256sum --check - \ && mkdir src \ && tar --extract --xz --file=gnutls.tar.xz --directory=src --strip-components=1 \ && rm gnutls.tar.xz \ && cd src \ - && CFLAGS=-fPIC ./configure --prefix=/usr/local \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib64 \ --with-included-libtasn1 \ --with-included-unistring \ --disable-cxx \ @@ -687,14 +691,14 @@ RUN curl --fail --location --output libyaml.tar.gz \ && rm libyaml.tar.gz \ && cd src \ && ./bootstrap \ - && CFLAGS=-fPIC ./configure --prefix=/usr/local --disable-shared --enable-static \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib64 --disable-shared --enable-static \ && make --jobs="$(nproc)" \ && make install \ && cd .. \ && rm -rf src RUN curl --fail --location --output libxml2.tar.gz \ - https://gitlab.gnome.org/GNOME/libxml2/-/archive/v2.15.3/libxml2-v2.15.3.tar.gz \ + https://wangguofang.net/github.com/GNOME/libxml2/archive/refs/tags/v2.15.3.tar.gz \ && mkdir src \ && tar --extract --gzip --file=libxml2.tar.gz --directory=src --strip-components=1 \ && rm libxml2.tar.gz \ @@ -731,7 +735,7 @@ RUN curl --fail --location --output libunwind.tar.gz \ && rm libunwind.tar.gz \ && cd src \ && autoreconf --install \ - && CFLAGS=-fPIC ./configure --prefix=/usr/local \ + && CFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib64 \ --disable-shared \ --enable-static \ --disable-tests \ @@ -750,7 +754,7 @@ RUN curl --fail --location --output jemalloc.tar.gz \ && rm jemalloc.tar.gz \ && cd src \ && ./autogen.sh \ - && CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --prefix=/usr/local \ + && CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --prefix=/usr/local --libdir=/usr/local/lib64 \ --disable-doc \ --disable-shared \ --enable-static \ @@ -763,16 +767,12 @@ RUN curl --fail --location --output jemalloc.tar.gz \ RUN curl --fail --location --output libproxyprotocol.tar.gz \ https://wangguofang.net/github.com/kosmas-valianos/libproxyprotocol/archive/v1.3.3.tar.gz \ - && echo "4f1cbd714e5b52a91a9a43228d55c8165b578b738f743d057ae321b69b8437f7 libproxyprotocol.tar.gz" \ - | sha256sum --check - \ && mkdir src \ && tar --extract --gzip --file=libproxyprotocol.tar.gz --directory=src --strip-components=1 \ && rm libproxyprotocol.tar.gz \ && gcc -fPIC -c -o src/src/proxy_protocol.o src/src/proxy_protocol.c \ - && ar rcs /usr/local/lib/libproxyprotocol.a src/src/proxy_protocol.o \ + && ar rcs /usr/local/lib64/libproxyprotocol.a src/src/proxy_protocol.o \ && cp src/src/proxy_protocol.h /usr/local/include/ \ && rm -rf src -RUN cp --archive /usr/local/lib/. /usr/local/lib64/ - CMD ["/bin/bash"] diff --git a/rocky9/libevent-lib64-install.patch b/rocky9/libevent-lib64-install.patch new file mode 100644 index 0000000..c71f021 --- /dev/null +++ b/rocky9/libevent-lib64-install.patch @@ -0,0 +1,59 @@ +diff --git a/cmake/AddEventLibrary.cmake b/cmake/AddEventLibrary.cmake +--- a/cmake/AddEventLibrary.cmake 2026-09-17 14:40:01.091049579 +0800 ++++ b/cmake/AddEventLibrary.cmake 2026-09-17 14:40:01.103049846 +0800 +@@ -31,7 +31,7 @@ + configure_file("lib${LIB_NAME}.pc.in" "lib${LIB_NAME}.pc" @ONLY) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${LIB_NAME}.pc" +- DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" ++ DESTINATION "${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig" + ) + endmacro() + +@@ -40,9 +40,9 @@ + macro(export_install_target TYPE LIB_NAME OUTER_INCLUDES) + if("${LIB_NAME}" STREQUAL "event") + install(TARGETS "${LIB_NAME}_${TYPE}" +- LIBRARY DESTINATION "lib" COMPONENT lib +- ARCHIVE DESTINATION "lib" COMPONENT lib +- RUNTIME DESTINATION "lib" COMPONENT lib ++ LIBRARY DESTINATION "lib64" COMPONENT lib ++ ARCHIVE DESTINATION "lib64" COMPONENT lib ++ RUNTIME DESTINATION "lib64" COMPONENT lib + COMPONENT dev + ) + else() +@@ -67,9 +67,9 @@ + ) + install(TARGETS "${LIB_NAME}_${TYPE}" + EXPORT LibeventTargets-${TYPE} +- LIBRARY DESTINATION "lib" COMPONENT lib +- ARCHIVE DESTINATION "lib" COMPONENT lib +- RUNTIME DESTINATION "lib" COMPONENT lib ++ LIBRARY DESTINATION "lib64" COMPONENT lib ++ ARCHIVE DESTINATION "lib64" COMPONENT lib ++ RUNTIME DESTINATION "lib64" COMPONENT lib + COMPONENT dev + ) + endif() +@@ -181,7 +181,7 @@ + if (NOT WIN32) + install(FILES + "$/${LIB_LINK_NAME}" +- DESTINATION "lib" ++ DESTINATION "lib64" + COMPONENT lib) + endif() + endif() +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2026-09-17 14:40:01.091049579 +0800 ++++ b/CMakeLists.txt 2026-09-17 14:40:01.103049846 +0800 +@@ -1453,7 +1453,7 @@ + # + + set(EVENT_INSTALL_CMAKE_DIR +- "${CMAKE_INSTALL_PREFIX}/lib/cmake/libevent") ++ "${CMAKE_INSTALL_PREFIX}/lib64/cmake/libevent") + + export(PACKAGE libevent) +