From 2c5d6754fdd7581e6d6ab9ddc1d03d2df1209946 Mon Sep 17 00:00:00 2001 From: lsq Date: Mon, 8 Jan 2024 20:39:01 +0800 Subject: [PATCH 1/5] commit on 2024-1-8 for ppc64le --- rpm/build_all.sh | 21 +++ rpm/devdeps-cos-c-sdk.spec | 5 +- rpm/devdeps-icu.spec | 5 +- rpm/devdeps-libcurl-static.spec | 2 + rpm/devdeps-mariadb-connector-c.spec | 1 + rpm/devdeps-openssl-static-build.1.1.1u.sh | 17 +++ rpm/devdeps-openssl-static.1.1.1u.spec | 62 ++++++++ rpm/devdeps-zlib-shared-build.sh | 17 +++ rpm/devdeps-zlib-shared.spec | 62 ++++++++ rpm/obdevtools-bison.spec | 2 + rpm/obdevtools-flex.spec | 2 + rpm/obdevtools-llvm-build-11.1.0.sh | 35 +++++ rpm/obdevtools-llvm.11.1.0.spec | 156 +++++++++++++++++++++ rpm/obdevtools-llvm.spec | 3 + 14 files changed, 387 insertions(+), 3 deletions(-) create mode 100644 rpm/devdeps-openssl-static-build.1.1.1u.sh create mode 100644 rpm/devdeps-openssl-static.1.1.1u.spec create mode 100644 rpm/devdeps-zlib-shared-build.sh create mode 100644 rpm/devdeps-zlib-shared.spec create mode 100644 rpm/obdevtools-llvm-build-11.1.0.sh create mode 100644 rpm/obdevtools-llvm.11.1.0.spec diff --git a/rpm/build_all.sh b/rpm/build_all.sh index 70f1613..c3a3aba 100644 --- a/rpm/build_all.sh +++ b/rpm/build_all.sh @@ -44,3 +44,24 @@ if [ ${NEED_BUILD_COMPILER} = 1 ]; then bash obdevtools-gcc9-build.sh fi +if [ "${OS_ARCH}x" = "ppc64lex" ]; then + ##backup local spec file first + if ! grep 11.1.0 obdevtools-llvm.spec |grep -i version > /dev/null + then + scp obdevtools-llvm.spec obdevtools-llvm.11.0.1.spec + scp obdevtools-llvm.11.1.0.spec obdevtools-llvm.spec + fi + bash obdevtools-llvm-build-11.1.0.sh + + bash devdeps-zlib-shared-build.sh + + ##backup local spec file first + if ! grep 1.1.1u devdeps-openssl-static.spec |grep -i version > /dev/null + then + scp devdeps-openssl-static.spec devdeps-openssl-static.1.0.1e.spec + scp devdeps-openssl-static.1.1.1u.spec devdeps-openssl-static.spec + fi + bash devdeps-openssl-static-build.1.1.1u.sh +fi + + diff --git a/rpm/devdeps-cos-c-sdk.spec b/rpm/devdeps-cos-c-sdk.spec index 01366b1..e785b81 100644 --- a/rpm/devdeps-cos-c-sdk.spec +++ b/rpm/devdeps-cos-c-sdk.spec @@ -62,7 +62,8 @@ make install #step 5: install minixml cd ../mxml-3.3 -./configure --prefix=/usr/local/ +CFLAG="-O2" \ +./configure --prefix=/usr/local make make install @@ -86,4 +87,4 @@ cp -r %{_tmp_product}/usr/local/* $RPM_BUILD_ROOT/%{_prefix} %changelog * Mon Jul 3 2023 oceanbase -- add spec of cos-c-sdk \ No newline at end of file +- add spec of cos-c-sdk diff --git a/rpm/devdeps-icu.spec b/rpm/devdeps-icu.spec index e89eec5..4d78a99 100644 --- a/rpm/devdeps-icu.spec +++ b/rpm/devdeps-icu.spec @@ -48,6 +48,9 @@ make install # install files cp -r ${tmp_install_dir}/lib/*.a $RPM_BUILD_ROOT/%{_prefix}/lib cp -r ${tmp_install_dir}/include/* $RPM_BUILD_ROOT/%{_prefix}/include/%{_product_prefix} +mkdir -p $RPM_BUILD_ROOT/%{_prefix}/include/%{_product_prefix}/i18n/unicode +cp ../icu4c/source/i18n/unicode/*.h $RPM_BUILD_ROOT/%{_prefix}/include/%{_product_prefix}/i18n/unicode/ + # package infomation %files @@ -64,4 +67,4 @@ cp -r ${tmp_install_dir}/include/* $RPM_BUILD_ROOT/%{_prefix}/include/%{_product %changelog * Wed Nov 23 2022 xuhao.yf -- version 69.1 \ No newline at end of file +- version 69.1 diff --git a/rpm/devdeps-libcurl-static.spec b/rpm/devdeps-libcurl-static.spec index b38a4ae..fbf52bc 100644 --- a/rpm/devdeps-libcurl-static.spec +++ b/rpm/devdeps-libcurl-static.spec @@ -40,6 +40,8 @@ if [ "${OS_ARCH}x" = "sw_64x" ]; then BUILD_OPTION='--build=sw_64-unknown-linux-gnu' elif [ "${OS_ARCH}x" = "aarch64x" ]; then BUILD_OPTION='--build=aarch64-unknown-linux-gnu' +elif [ "${OS_ARCH}x" = "ppc64lex" ]; then + BUILD_OPTION='--build=ppc64le' fi ./configure --prefix=%{_tmppath} --without-libssh2 --without-nss --disable-ftp --disable-ldap --disable-ldaps --without-cyassl \ diff --git a/rpm/devdeps-mariadb-connector-c.spec b/rpm/devdeps-mariadb-connector-c.spec index 0ea9d24..eeeb93f 100644 --- a/rpm/devdeps-mariadb-connector-c.spec +++ b/rpm/devdeps-mariadb-connector-c.spec @@ -26,6 +26,7 @@ mkdir -p %{_tmppath} cd $OLDPWD/../ rm -rf %{_src} tar -xf %{_src}.tar.gz +sed -i 's/END()/ENDIF()/g' mariadb-connector-c-3.1.12/cmake/ConnectorName.cmake cd %{_src} mkdir -p build-rpm; cd build-rpm diff --git a/rpm/devdeps-openssl-static-build.1.1.1u.sh b/rpm/devdeps-openssl-static-build.1.1.1u.sh new file mode 100644 index 0000000..cd706fe --- /dev/null +++ b/rpm/devdeps-openssl-static-build.1.1.1u.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +CUR_DIR=$(dirname $(readlink -f "$0")) +ROOT_DIR=$CUR_DIR/../ +PROJECT_DIR=${1:-"$CUR_DIR"} +PROJECT_NAME=${2:-"devdeps-openssl-static"} +VERSION=${3:-"1.1.1u"} +RELEASE=${4:-"1"} + +# check source code +if [[ -z `find $ROOT_DIR -maxdepth 1 -regex ".*/openssl-$VERSION.*[tar|gz|bz2|xz|zip]$"` ]]; then + echo "Download source code" + wget --no-check-certificate https://ftp.openssl.org/source/old/1.1.1/openssl-1.1.1u.tar.gz -P $ROOT_DIR +fi + +cd $CUR_DIR +bash $CUR_DIR/rpmbuild.sh $PROJECT_DIR $PROJECT_NAME $VERSION $RELEASE \ No newline at end of file diff --git a/rpm/devdeps-openssl-static.1.1.1u.spec b/rpm/devdeps-openssl-static.1.1.1u.spec new file mode 100644 index 0000000..adc48f5 --- /dev/null +++ b/rpm/devdeps-openssl-static.1.1.1u.spec @@ -0,0 +1,62 @@ +Name: devdeps-openssl-static +Version: 1.1.1u +Release: %(echo $RELEASE)%{?dist} + +Summary: OpenSSL is a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. +Url: https://www.openssl.org/ +Group: oceanbase-devel/dependencies +License: OpenSSL +AutoReqProv:no + +%undefine _missing_build_ids_terminate_build +%define _build_id_links compat + +# disable check-buildroot +%define __arch_install_post %{nil} + +%define _prefix /usr/local/oceanbase/deps/devel +%define _src openssl-%{version} + +%define debug_package %{nil} +%define __strip /bin/true + +%define _buliddir %{_topdir}/BUILD +%define _tmppath %{_buliddir}/_tmp + +%description +OpenSSL is a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. +It is also a general-purpose cryptography library. For more information about the team and community around the project, or to start making your own contributions, +start with the community page. To get the latest news, download the source, and so on, please see the sidebar or the buttons at the top of every page. + +%build + +# incompat with openssl config. unset it here +unset RELEASE +rm -rf %{_tmppath} +mkdir -p %{_tmppath} +cd $OLDPWD/../ +rm -rf %{_src} +tar -xf %{_src}.tar.gz +cd %{_src} +#make dclean +./config --prefix=%{_prefix} -fPIC no-shared --openssldir=%{_prefix} +make depend +make all +make install_sw + +%install + +mkdir -p $RPM_BUILD_ROOT/%{_prefix} +cp -r %{_prefix}/lib %{_prefix}/include $RPM_BUILD_ROOT/%{_prefix} + +%files + +%defattr(-,root,root) +%{_prefix} + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%changelog +* Fri Mar 26 2021 oceanbase +- add spec of cmake diff --git a/rpm/devdeps-zlib-shared-build.sh b/rpm/devdeps-zlib-shared-build.sh new file mode 100644 index 0000000..4badf77 --- /dev/null +++ b/rpm/devdeps-zlib-shared-build.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +CUR_DIR=$(dirname $(readlink -f "$0")) +ROOT_DIR=$CUR_DIR/../ +PROJECT_DIR=${1:-"$CUR_DIR"} +PROJECT_NAME=${2:-"devdeps-zlib-shared"} +VERSION=${3:-"1.2.7"} +RELEASE=${4:-"1"} + +# check source code +if [[ -z `find $ROOT_DIR -maxdepth 1 -regex ".*/curl-$VERSION.*[tar|gz|bz2|xz|zip]$"` ]]; then + echo "Download source code" + wget --no-check-certificate https://codeload.github.com/madler/zlib/tar.gz/refs/tags/v1.2.7 -O zlib-1.2.7.tar.gz -P $ROOT_DIR +fi + +cd $CUR_DIR +bash $CUR_DIR/rpmbuild.sh $PROJECT_DIR $PROJECT_NAME $VERSION $RELEASE diff --git a/rpm/devdeps-zlib-shared.spec b/rpm/devdeps-zlib-shared.spec new file mode 100644 index 0000000..90f0dac --- /dev/null +++ b/rpm/devdeps-zlib-shared.spec @@ -0,0 +1,62 @@ +Name: devdeps-zlib-shared +Version: 1.2.7 +Release: %(echo $RELEASE)%{?dist} +Url: https://curl.se/ +Summary: zlib is a general purpose data compression library. + +Group: oceanbase-devel/dependencies +License: MIT + +%undefine _missing_build_ids_terminate_build +%define _build_id_links compat + +# disable check-buildroot +%define __arch_install_post %{nil} + +%define _prefix /usr/local/oceanbase/deps/devel +%define _src zlib-%{version} + +%define debug_package %{nil} +%define __strip /bin/true + +%define _buliddir %{_topdir}/BUILD +%define _tmppath %{_buliddir}/_tmp + +%description +zlib is a general purpose data compression library. + +%build + +rm -rf %{_tmppath} +mkdir -p %{_tmppath} +cd $OLDPWD/../ + +cd rpm + +rm -rf %{_src} + +tar -zxvf %{_src}.tar.gz +cd %{_src} + +CFLAGS='-fPIC -O3' SFLAGS='-shared' ./configure --prefix=%{_tmppath} --shared + +CPU_CORES=`grep -c ^processor /proc/cpuinfo` +make -j${CPU_CORES}; +make install + +%install + +mkdir -p $RPM_BUILD_ROOT/%{_prefix} +cp -r %{_tmppath}/lib %{_tmppath}/include $RPM_BUILD_ROOT/%{_prefix} + +%files + +%defattr(-,root,root) +%{_prefix} + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%changelog +* Tue Sep 29 2022 oceanbase +- add spec of zlib diff --git a/rpm/obdevtools-bison.spec b/rpm/obdevtools-bison.spec index 3e7f426..5fa8305 100644 --- a/rpm/obdevtools-bison.spec +++ b/rpm/obdevtools-bison.spec @@ -35,6 +35,8 @@ if [ "${OS_ARCH}x" = "sw_64x" ]; then BUILD_OPTION='--build=sw_64-unknown-linux-gnu' elif [ "${OS_ARCH}x" = "aarch64x" ]; then BUILD_OPTION='--build=aarch64-unknown-linux-gnu' +elif [ "${OS_ARCH}x" = "ppc64lex" ]; then + BUILD_OPTION='--build=ppc64le' fi ./configure --prefix=${RPM_BUILD_ROOT}/%{_prefix} ${BUILD_OPTION} diff --git a/rpm/obdevtools-flex.spec b/rpm/obdevtools-flex.spec index 432c6b7..d5b5f5e 100644 --- a/rpm/obdevtools-flex.spec +++ b/rpm/obdevtools-flex.spec @@ -33,6 +33,8 @@ if [ "${OS_ARCH}x" = "sw_64x" ]; then BUILD_OPTION='--build=sw_64-unknown-linux-gnu' elif [ "${OS_ARCH}x" = "aarch64x" ]; then BUILD_OPTION='--build=aarch64-unknown-linux-gnu' +elif [ "${OS_ARCH}x" = "ppc64lex" ]; then + BUILD_OPTION='--build=ppc64le' fi diff --git a/rpm/obdevtools-llvm-build-11.1.0.sh b/rpm/obdevtools-llvm-build-11.1.0.sh new file mode 100644 index 0000000..7fd78b5 --- /dev/null +++ b/rpm/obdevtools-llvm-build-11.1.0.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -ex +CUR_DIR=$(dirname $(readlink -f "$0")) +ROOT_DIR=$CUR_DIR/../ +PROJECT_DIR=${1:-"$CUR_DIR"} +PROJECT_NAME=${2:-"obdevtools-llvm"} +VERSION=${3:-"11.1.0"} +RELEASE=${4:-"1"} + +# check source code +if [[ -z `find $ROOT_DIR -maxdepth 1 -regex ".*/llvm-$VERSION.*[tar|gz|bz2|xz|zip]$"` ]]; then + echo "Download source code" + wget https://mirror.ghproxy.com/https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/llvm-11.1.0.src.tar.xz -P $ROOT_DIR --no-check-certificate + wget https://mirror.ghproxy.com/https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/lld-11.1.0.src.tar.xz -P $ROOT_DIR --no-check-certificate + wget https://mirror.ghproxy.com/https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/clang-11.1.0.src.tar.xz -P $ROOT_DIR --no-check-certificate + wget https://mirror.ghproxy.com/https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/compiler-rt-11.1.0.src.tar.xz -P $ROOT_DIR --no-check-certificate +fi + +# prepare building environment +OS_RELEASE=$(grep -Po '(?<=release )\d' /etc/redhat-release) +if [ "$(uname -m)" == "ppc64le" ];then + echo "Now install obdevtools-cmake and obdevtools-gcc manually!" +else + wget http://mirrors.aliyun.com/oceanbase/OceanBase.repo -P /etc/yum.repos.d/ + yum install obdevtools-cmake-3.22.1 -y + yum install obdevtools-gcc9-9.3.0 -y +fi + +export PATH=/usr/local/oceanbase/devtools/bin:$PATH + +ln -sf /usr/local/oceanbase/devtools/bin/g++ /usr/bin/c++ +ln -sf /usr/local/oceanbase/devtools/bin/gcc /usr/bin/cc + +cd $CUR_DIR +bash $CUR_DIR/rpmbuild.sh $PROJECT_DIR $PROJECT_NAME $VERSION $RELEASE diff --git a/rpm/obdevtools-llvm.11.1.0.spec b/rpm/obdevtools-llvm.11.1.0.spec new file mode 100644 index 0000000..f3bc2bd --- /dev/null +++ b/rpm/obdevtools-llvm.11.1.0.spec @@ -0,0 +1,156 @@ +Name: obdevtools-llvm +Version: 11.1.0 +Release: %(echo $RELEASE)%{?dist} + +Summary: The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. + +Group: oceanbase-devel/tools +License: Apache License Version 2.0 +Url: https://github.com/llvm/llvm-project +AutoReqProv:no + +%undefine _missing_build_ids_terminate_build +%define _build_id_links compat +%global __os_install_post %{nil} +%define debug_package %{nil} +%define _prefix /usr/local/oceanbase/devtools/ +%define _llvm_src llvm-%{version}.src +%define _lld_src lld-%{version}.src +%define _clang_src clang-%{version}.src +%define _compiler_rt_src compiler-rt-%{version}.src +%define _buliddir %{_topdir}/BUILD +%define _relwithdebinfo_dir %{_buliddir}/product-debuginfo +%define _rel_dir %{_buliddir}/product + +BuildRequires: obdevtools-cmake >= 3.20.2 + +%description +The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. + +%build +# step1: build RelWithDebInfo version +source_dir=%{_topdir}/../../ +rm -rf %{_relwithdebinfo_dir} +mkdir -p %{_relwithdebinfo_dir} +cd $source_dir +rm -rf %{_llvm_src} %{_lld_src} %{_clang_src} %{_compiler_rt_src} +tar xf %{_llvm_src}.tar.xz +tar xf %{_lld_src}.tar.xz +tar xf %{_clang_src}.tar.xz +tar xf %{_compiler_rt_src}.tar.xz + +# LLVM_ENABLE_PROJECTS requires putting module source code directory and llvm source code directory into the same directory. +# llvm_src_dir/ +# ├── clang +# └── llvm +rm -rf $source_dir/llvm_src_dir +mkdir -p $source_dir/llvm_src_dir +mv -f %{_llvm_src} $source_dir/llvm_src_dir/llvm +mv -f %{_clang_src} $source_dir/llvm_src_dir/clang +mv -f %{_compiler_rt_src} $source_dir/llvm_src_dir/compiler-rt +mv -f %{_lld_src} $source_dir/llvm_src_dir/lld +cd $source_dir/llvm_src_dir +mkdir -p build-rpm +cd build-rpm + +arch=`uname -p` +if [[ x"$arch" == x"x86_64" ]]; then + echo "Build arch: x86" + arch=X86 +elif [[ x"$arch" == x"aarch64" ]]; then + echo "Build arch: AArch64" + arch=AArch64 +elif [[ x"$arch" == x"ppc64le" ]]; then + echo "Build arch: ppc64le" + arch=PowerPC +else + echo "Unknown arch" + exit 1 +fi + +cmake ../llvm \ + -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" \ + -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ + -DCMAKE_INSTALL_PREFIX=%{_relwithdebinfo_dir} \ + -DLLVM_TARGETS_TO_BUILD=$arch \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_EH=ON \ + -DLLVM_ENABLE_DUMP=ON \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DLLVM_ENABLE_PROJECTS='clang;compiler-rt;lld' \ + -G 'Unix Makefiles'; + +CPU_CORES=`grep -c ^processor /proc/cpuinfo` +make -j${CPU_CORES}; +make install; + +# step2: build Release version +rm -rf %{_rel_dir} +mkdir -p %{_rel_dir} +cd $source_dir +rm -rf %{_llvm_src} %{_lld_src} %{_clang_src} %{_compiler_rt_src} +tar xf %{_llvm_src}.tar.xz +tar xf %{_lld_src}.tar.xz +tar xf %{_clang_src}.tar.xz +tar xf %{_compiler_rt_src}.tar.xz + +# LLVM_ENABLE_PROJECTS requires putting module source code directory and llvm source code directory into the same directory. +# llvm_src_dir/ +# ├── clang +# └── llvm +rm -rf $source_dir/llvm_src_dir +mkdir -p $source_dir/llvm_src_dir +mv -f %{_llvm_src} $source_dir/llvm_src_dir/llvm +mv -f %{_clang_src} $source_dir/llvm_src_dir/clang +mv -f %{_compiler_rt_src} $source_dir/llvm_src_dir/compiler-rt +mv -f %{_lld_src} $source_dir/llvm_src_dir/lld +cd $source_dir/llvm_src_dir +mkdir -p build-rpm +cd build-rpm + +cmake ../llvm \ + -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" \ + -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ + -DCMAKE_INSTALL_PREFIX=%{_rel_dir} \ + -DLLVM_TARGETS_TO_BUILD=$arch \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_EH=ON \ + -DLLVM_ENABLE_DUMP=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_ENABLE_PROJECTS='clang;compiler-rt;lld' \ + -G 'Unix Makefiles'; + +make -j${CPU_CORES}; +make install; + +# step3: replace asan debuginfo lib +rm -rf %{_rel_dir}/lib/clang/11.1.0/lib/linux +cp -rf %{_relwithdebinfo_dir}/lib/clang/11.1.0/lib/linux %{_rel_dir}/lib/clang/11.1.0/lib/ + +%install +# create dirs +# mkdir -p $RPM_BUILD_ROOT/%{_prefix}/bin +mkdir -p $RPM_BUILD_ROOT/%{_prefix} +cp -r %{_rel_dir}/* $RPM_BUILD_ROOT/%{_prefix} +# install necessary tools +# cp -d %{_tmppath}/bin/clang-11 %{_tmppath}/bin/lld %{_tmppath}/bin/llvm-ar %{_tmppath}/bin/clang %{_tmppath}/bin/llvm-dlltool %{_tmppath}/bin/llvm-lib \ +# %{_tmppath}/bin/llvm-ranlib %{_tmppath}/bin/clang++ %{_tmppath}/bin/clang-cl %{_tmppath}/bin/clang-cpp %{_tmppath}/bin/ld.lld %{_tmppath}/bin/ld64.lld \ +# %{_tmppath}/bin/lld-link %{_tmppath}/bin/wasm-ld %{_tmppath}/bin/llvm-objcopy %{_tmppath}/bin/llvm-install-name-tool %{_tmppath}/bin/llvm-strip \ +# %{_tmppath}/bin/clang-format $RPM_BUILD_ROOT/%{_prefix}/bin + +%files + +%defattr(-,root,root) + +%{_prefix} + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%changelog +* Tue Mar 8 2022 oceanbase +- support asan +* Fri May 7 2021 oceanbase +- reduce rpm package size by only installing necessary files +* Thu Mar 25 2021 oceanbase +- add spec of ob-llvm diff --git a/rpm/obdevtools-llvm.spec b/rpm/obdevtools-llvm.spec index 3b37611..95c6570 100644 --- a/rpm/obdevtools-llvm.spec +++ b/rpm/obdevtools-llvm.spec @@ -60,6 +60,9 @@ if [[ x"$arch" == x"x86_64" ]]; then elif [[ x"$arch" == x"aarch64" ]]; then echo "Build arch: AArch64" arch=AArch64 +elif [[ x"$arch" == x"ppc64le" ]]; then + echo "Build arch: ppc64le" + arch=PowerPC else echo "Unknown arch" exit 1 From 52afc3f6c4518240d77a84d5391203cf3c96b8d6 Mon Sep 17 00:00:00 2001 From: lsq Date: Mon, 8 Jan 2024 21:17:36 +0800 Subject: [PATCH 2/5] commit-2 on 2024-1-8 for ppc64le --- rpm/devdeps-isa-l-static.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rpm/devdeps-isa-l-static.spec b/rpm/devdeps-isa-l-static.spec index 077c271..e90380d 100644 --- a/rpm/devdeps-isa-l-static.spec +++ b/rpm/devdeps-isa-l-static.spec @@ -26,6 +26,12 @@ ISA-L is a collection of optimized low-level functions targeting storage applica %build +BUILD_OPTION='' +OS_ARCH="$(uname -m)" +if [ "${OS_ARCH}x" = "ppc64lex" ]; then + BUILD_OPTION='--build=ppc64le' +fi + rm -rf %{_tmppath} mkdir -p %{_tmppath} cd $OLDPWD/../ @@ -33,7 +39,7 @@ rm -rf %{_src} tar -xf %{_src}.tar.gz cd %{_src} ./autogen.sh -./configure --enable-static --with-pic=yes --disable-shared --prefix=%{_tmppath} +./configure ${BUILD_OPTION} --enable-static --with-pic=yes --disable-shared --prefix=%{_tmppath} CPU_CORES=`grep -c ^processor /proc/cpuinfo` make -j${CPU_CORES}; make install From 0c896f67a2defea8991e05012935c0a4d9d3e23e Mon Sep 17 00:00:00 2001 From: lsq Date: Tue, 9 Jan 2024 13:31:32 +0800 Subject: [PATCH 3/5] commit-3 on 2024-1-9 for ppc64le --- rpm/build_all.sh | 2 ++ rpm/devdeps-rocksdb-build-with-system-gcc.sh | 32 ++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 rpm/devdeps-rocksdb-build-with-system-gcc.sh diff --git a/rpm/build_all.sh b/rpm/build_all.sh index c3a3aba..78a7475 100644 --- a/rpm/build_all.sh +++ b/rpm/build_all.sh @@ -62,6 +62,8 @@ if [ "${OS_ARCH}x" = "ppc64lex" ]; then scp devdeps-openssl-static.1.1.1u.spec devdeps-openssl-static.spec fi bash devdeps-openssl-static-build.1.1.1u.sh + + bash devdeps-rocksdb-build-with-system-gcc.sh fi diff --git a/rpm/devdeps-rocksdb-build-with-system-gcc.sh b/rpm/devdeps-rocksdb-build-with-system-gcc.sh new file mode 100644 index 0000000..f03f555 --- /dev/null +++ b/rpm/devdeps-rocksdb-build-with-system-gcc.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +CUR_DIR=$(dirname $(readlink -f "$0")) +ROOT_DIR=$CUR_DIR/../ +PROJECT_DIR=${1:-"$CUR_DIR"} +PROJECT_NAME=${2:-"devdeps-rocksdb"} +VERSION=${3:-"6.22.1"} +RELEASE=${4:-"1"} + +# check source code +if [[ -z `find $ROOT_DIR -maxdepth 1 -regex ".*/rocksdb-$VERSION.*[tar|gz|bz2|xz|zip]$"` ]]; then + for cnt in {1..6} + do + echo "Download source code with retry cnt = "$cnt + wget --no-check-certificate https://mirror.ghproxy.com/https://github.com/facebook/rocksdb/archive/refs/tags/v6.22.1.tar.gz -O $ROOT_DIR/rocksdb-$VERSION.tar.gz + if [[ $? == 0 ]];then + break + fi + done +fi + +# prepare building environment +# please prepare environment yourself if the following solution does not work for you. +OS_RELEASE=$(grep -Po '(?<=release )\d' /etc/redhat-release) + +echo "Use obdevtools-gcc9 may raise such ld.lld: error: expected a 'ld' for got-indirect to toc-relative relaxing" +echo "So build with gcc-toolset-11 gcc on ppc64le" + +source /opt/rh/gcc-toolset-11/enable + +cd $CUR_DIR +bash $CUR_DIR/rpmbuild.sh $PROJECT_DIR $PROJECT_NAME $VERSION $RELEASE From e09b7bb3a2118699b3d70389ae25787be99ce41b Mon Sep 17 00:00:00 2001 From: lsq Date: Tue, 9 Jan 2024 18:11:50 +0800 Subject: [PATCH 4/5] Update obdevtools-llvm.11.1.0.spec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For issue of error: ‘numeric_limits’ is not a member of ‘std’, add #include to llvm/utils/benchmark/src/benchmark_register.h --- rpm/obdevtools-llvm.11.1.0.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpm/obdevtools-llvm.11.1.0.spec b/rpm/obdevtools-llvm.11.1.0.spec index f3bc2bd..2137193 100644 --- a/rpm/obdevtools-llvm.11.1.0.spec +++ b/rpm/obdevtools-llvm.11.1.0.spec @@ -46,6 +46,7 @@ tar xf %{_compiler_rt_src}.tar.xz rm -rf $source_dir/llvm_src_dir mkdir -p $source_dir/llvm_src_dir mv -f %{_llvm_src} $source_dir/llvm_src_dir/llvm +sed -i 's/#include /#include \n#include /g' $source_dir/llvm_src_dir/llvm/utils/benchmark/src/benchmark_register.h mv -f %{_clang_src} $source_dir/llvm_src_dir/clang mv -f %{_compiler_rt_src} $source_dir/llvm_src_dir/compiler-rt mv -f %{_lld_src} $source_dir/llvm_src_dir/lld @@ -101,6 +102,7 @@ tar xf %{_compiler_rt_src}.tar.xz rm -rf $source_dir/llvm_src_dir mkdir -p $source_dir/llvm_src_dir mv -f %{_llvm_src} $source_dir/llvm_src_dir/llvm +sed -i 's/#include /#include \n#include /g' $source_dir/llvm_src_dir/llvm/utils/benchmark/src/benchmark_register.h mv -f %{_clang_src} $source_dir/llvm_src_dir/clang mv -f %{_compiler_rt_src} $source_dir/llvm_src_dir/compiler-rt mv -f %{_lld_src} $source_dir/llvm_src_dir/lld From 4eaa751d7b838b4d3bc84329c727c1e9036a05cc Mon Sep 17 00:00:00 2001 From: lsq Date: Tue, 9 Jan 2024 22:51:15 +0800 Subject: [PATCH 5/5] Update obdevtools-llvm.11.1.0.spec --- rpm/obdevtools-llvm.11.1.0.spec | 34 ++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/rpm/obdevtools-llvm.11.1.0.spec b/rpm/obdevtools-llvm.11.1.0.spec index 2137193..60d477c 100644 --- a/rpm/obdevtools-llvm.11.1.0.spec +++ b/rpm/obdevtools-llvm.11.1.0.spec @@ -39,21 +39,6 @@ tar xf %{_lld_src}.tar.xz tar xf %{_clang_src}.tar.xz tar xf %{_compiler_rt_src}.tar.xz -# LLVM_ENABLE_PROJECTS requires putting module source code directory and llvm source code directory into the same directory. -# llvm_src_dir/ -# ├── clang -# └── llvm -rm -rf $source_dir/llvm_src_dir -mkdir -p $source_dir/llvm_src_dir -mv -f %{_llvm_src} $source_dir/llvm_src_dir/llvm -sed -i 's/#include /#include \n#include /g' $source_dir/llvm_src_dir/llvm/utils/benchmark/src/benchmark_register.h -mv -f %{_clang_src} $source_dir/llvm_src_dir/clang -mv -f %{_compiler_rt_src} $source_dir/llvm_src_dir/compiler-rt -mv -f %{_lld_src} $source_dir/llvm_src_dir/lld -cd $source_dir/llvm_src_dir -mkdir -p build-rpm -cd build-rpm - arch=`uname -p` if [[ x"$arch" == x"x86_64" ]]; then echo "Build arch: x86" @@ -69,6 +54,23 @@ else exit 1 fi +# LLVM_ENABLE_PROJECTS requires putting module source code directory and llvm source code directory into the same directory. +# llvm_src_dir/ +# ├── clang +# └── llvm +rm -rf $source_dir/llvm_src_dir +mkdir -p $source_dir/llvm_src_dir +mv -f %{_llvm_src} $source_dir/llvm_src_dir/llvm +if [[ x"$arch" == x"ppc64le" ]]; then +sed -i 's/#include /#include \n#include /g' $source_dir/llvm_src_dir/llvm/utils/benchmark/src/benchmark_register.h +fi +mv -f %{_clang_src} $source_dir/llvm_src_dir/clang +mv -f %{_compiler_rt_src} $source_dir/llvm_src_dir/compiler-rt +mv -f %{_lld_src} $source_dir/llvm_src_dir/lld +cd $source_dir/llvm_src_dir +mkdir -p build-rpm +cd build-rpm + cmake ../llvm \ -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0" \ -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc -static-libstdc++" \ @@ -102,7 +104,9 @@ tar xf %{_compiler_rt_src}.tar.xz rm -rf $source_dir/llvm_src_dir mkdir -p $source_dir/llvm_src_dir mv -f %{_llvm_src} $source_dir/llvm_src_dir/llvm +if [[ x"$arch" == x"ppc64le" ]]; then sed -i 's/#include /#include \n#include /g' $source_dir/llvm_src_dir/llvm/utils/benchmark/src/benchmark_register.h +fi mv -f %{_clang_src} $source_dir/llvm_src_dir/clang mv -f %{_compiler_rt_src} $source_dir/llvm_src_dir/compiler-rt mv -f %{_lld_src} $source_dir/llvm_src_dir/lld