Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use C++20 with more packages #8558

Merged
merged 17 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions abseil-cpp.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### RPM external abseil-cpp 20210324.2
### RPM external abseil-cpp 20230125.3
## INCLUDE cpp-standard
Source: https://github.com/abseil/abseil-cpp/archive/%{realversion}.tar.gz

BuildRequires: cmake gmake
Expand All @@ -13,7 +14,7 @@ cd ../build

cmake ../%{n}-%{realversion} \
-DCMAKE_INSTALL_PREFIX=%{i} \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_CXX_STANDARD=%{cms_cxx_standard} \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=ON \
Expand Down
12 changes: 6 additions & 6 deletions bazel-3.7.0-patches.patch
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
diff --git a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/StarlarkActionFactoryApi.java b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/StarlarkActionFactoryApi.java
index 0ea30a9..8df189f 100755
index 9f7fe1f..e584fb9 100755
--- a/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/StarlarkActionFactoryApi.java
+++ b/src/main/java/com/google/devtools/build/lib/starlarkbuildapi/StarlarkActionFactoryApi.java
@@ -359,7 +359,7 @@ public interface StarlarkActionFactoryApi extends StarlarkValue {
@@ -377,7 +377,7 @@ public interface StarlarkActionFactoryApi extends StarlarkValue {
+ " the former are more efficient."),
@Param(
name = "use_default_shell_env",
type = Boolean.class,
- defaultValue = "False",
+ defaultValue = "True",
named = true,
positional = false,
doc = "Whether the action should use the built in shell environment or not."),
diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
index d48485b..40ca051 100755
index bfb37bd..45e311c 100755
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -193,6 +193,7 @@ def _find_gold_linker_path(repository_ctx, cc):
@@ -184,6 +184,7 @@ def _find_linker_path(repository_ctx, cc, linker, is_clang):
Returns:
String to put as value to -fuse-ld= flag, or None if gold couldn't be found.
String to put as value to -fuse-ld= flag, or None if linker couldn't be found.
"""
+ return None
result = repository_ctx.execute([
Expand Down
25 changes: 25 additions & 0 deletions bazel-absl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--- bazel/distdir_deps.bzl.orig 2023-06-12 11:36:07.650810578 +0200
+++ bazel/distdir_deps.bzl 2023-06-12 11:37:10.490300045 +0200
@@ -162,17 +162,17 @@
],
},
"com_google_absl": {
- "archive": "20211102.0.tar.gz",
- "sha256": "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4",
+ "archive": "20230125.3.tar.gz",
+ "sha256": "5366d7e7fa7ba0d915014d387b66d0d002c03236448e1ba9ef98122c13b35c36",
"urls": [
- "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
- "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
+ "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20230125.3.tar.gz",
+ "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230125.3.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
- "strip_prefix": "abseil-cpp-20211102.0",
+ "strip_prefix": "abseil-cpp-20230125.3",
},
"zstd-jni": {
"archive": "v1.5.0-4.zip",
6 changes: 4 additions & 2 deletions bazel.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### RPM external bazel 3.7.2
### RPM external bazel 5.3.0
## INCLUDE cpp-standard

Source: https://github.com/bazelbuild/bazel/releases/download/%{realversion}/bazel-%{realversion}-dist.zip

Expand All @@ -17,7 +18,7 @@ BuildRequires: java-env python3 python-python3
# configuration issue
# https://github.com/bazelbuild/bazel/issues/9392
Patch0: bazel-3.7.0-patches
Patch1: bazel-3.7.2-gcc11
Patch1: bazel-absl

%prep
%setup -q -c -n bazel-%{realversion}
Expand All @@ -28,6 +29,7 @@ Patch1: bazel-3.7.2-gcc11
%build

export EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk --jobs %{compiling_processes}"
export BAZEL_CXXOPTS="-std=c++%{cms_cxx_standard}"
bash ./compile.sh

%install
Expand Down
2 changes: 2 additions & 0 deletions cpp-standard.file
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# C++ standard to use for CMS externals
%define cms_cxx_standard 20
3 changes: 2 additions & 1 deletion cuda-flags.file
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### FILE cuda-flags
## INCLUDE cpp-standard
# define the CUDA compilation flags in a way that can be shared by SCRAM-based and regular tools

# on X86 and Power, build support for Pascal, Volta and Turing
Expand All @@ -16,7 +17,7 @@
%define llvm_cuda_arch %(echo $(for ARCH in %cuda_arch; do echo "$ARCH"; done) | sed -e"s/ /,/g")

# C++ standard to use for building host and device code with nvcc
%define nvcc_stdcxx -std=c++20
%define nvcc_stdcxx -std=c++%{cms_cxx_standard}

# generate optimised code
%define cuda_flags_0 -O3
Expand Down
3 changes: 2 additions & 1 deletion dd4hep.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### RPM external dd4hep v01-25x
## INCLUDE compilation_flags
## INCLUDE compilation_flags_lto
## INCLUDE cpp-standard

%define tag b07fa115c59d80d37154cf205cf00dff8137ee36
%define branch master
Expand All @@ -23,7 +24,7 @@ Requires: root boost clhep xerces-c geant4
-DDD4HEP_USE_PYROOT=ON \\\
-DCMAKE_AR=$(which gcc-ar) \\\
-DCMAKE_RANLIB=$(which gcc-ranlib) \\\
-DCMAKE_CXX_STANDARD=17 \\\
-DCMAKE_CXX_STANDARD="%{cms_cxx_standard}" \\\
-DCMAKE_BUILD_TYPE=%{cmake_build_type} \\\
-DDD4HEP_USE_GEANT4_UNITS=ON \\\
-DXERCESC_ROOT_DIR=${XERCES_C_ROOT} \\\
Expand Down
8 changes: 5 additions & 3 deletions eigen.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
### RPM external eigen 82dd3710dac619448f50331c1d6a35da673f764a
### RPM external eigen 3bb6a48d8c171cf20b5f8e48bfb4e424fbd4f79e
## INITENV +PATH PKG_CONFIG_PATH %{i}/share/pkgconfig
## NOCOMPILER
%define tag 43d8892d117e4e76b6c472b942ebefee00bfc172
## INCLUDE cpp-standard

%define tag fe7e6a8ef4921dd6c7b5b893a9972948f1b451d3
%define branch cms/master/%{realversion}
%define github_user cms-externals
Source: git+https://github.com/%{github_user}/eigen-git-mirror.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}-%{tag}.tgz
Expand All @@ -13,7 +15,7 @@ BuildRequires: cmake
%build
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=%{i} -DBUILD_TESTING=OFF ../
cmake -DCMAKE_INSTALL_PREFIX=%{i} -DBUILD_TESTING=OFF -DCMAKE_CXX_STANDARD=%{cms_cxx_standard} ../

%install
cd build
Expand Down
16 changes: 9 additions & 7 deletions fasthadd.spec
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
### RPM external fasthadd 2.3
### RPM external fasthadd 2.4

#Change the commit hash every time a new version is needed.
%define commit 905af02d3369428df677c232537da6fca8982ff3
Source0: https://raw.githubusercontent.com/cms-sw/cmssw/%commit/DQMServices/Components/bin/fastHadd.cc
Source1: https://raw.githubusercontent.com/cms-sw/cmssw/%commit/DQMServices/Core/src/ROOTFilePB.proto
Requires: protobuf root
%define commit 003102d8516b652d80e76d8ca1c4b5dc47c9015b
%define user iarspider
Source0: https://raw.githubusercontent.com/%user/cmssw/%commit/DQMServices/Components/bin/fastHadd.cc
Source1: https://raw.githubusercontent.com/%user/cmssw/%commit/DQMServices/Core/src/ROOTFilePB.proto
Requires: protobuf root abseil-cpp

%prep

Expand All @@ -14,9 +15,10 @@ mkdir -p %i/bin %i/etc/profile.d
cp %{_sourcedir}/fastHadd.cc .
cp %{_sourcedir}/ROOTFilePB.proto .
protoc -I ./ --cpp_out=./ ROOTFilePB.proto
perl -p -i -e 's|DQMServices/Core/src/||' ROOTFilePB.pb.cc fastHadd.cc
perl -p -i -e 's|DQMServices/Core/interface/||' ROOTFilePB.pb.cc fastHadd.cc
g++ -O2 -o %i/bin/fastHadd ROOTFilePB.pb.cc ./fastHadd.cc \
-I$PROTOBUF_ROOT/include -L$PROTOBUF_ROOT/lib -lprotobuf \
-I$PROTOBUF_ROOT/include -L$PROTOBUF_ROOT/lib -lprotobuf -L$ABSEIL_CPP_ROOT/lib -labsl_log_internal_check_op \
-labsl_log_internal_message \
`root-config --cflags --libs`

%install
11 changes: 11 additions & 0 deletions flatbuffers-7422.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- flatbuffers/CMakeLists.txt.orig 2023-05-30 14:34:01.518107275 +0200
+++ flatbuffers/CMakeLists.txt 2023-05-30 14:35:11.112747553 +0200
@@ -223,7 +223,7 @@
"${CMAKE_CXX_FLAGS} -std=c++0x")
endif(CYGWIN)
set(CMAKE_CXX_FLAGS
- "${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Werror=shadow")
+ "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wno-unknown-warning-option -Werror -Wextra -Werror=shadow -Wno-error=stringop-overflow")
set(FLATBUFFERS_PRIVATE_CXX_FLAGS "-Wold-style-cast")
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.4)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
7 changes: 6 additions & 1 deletion flatbuffers.spec
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
### RPM external flatbuffers 1.12.0
### RPM external flatbuffers 2.0.6
## INITENV +PATH LD_LIBRARY_PATH %{i}/lib64

%define tag v%{realversion}
%define branch master
%define github_user google
Source: git+https://github.com/%{github_user}/%{n}.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}-%{tag}.tgz
Patch0: flatbuffers-7422

BuildRequires: cmake gmake

%prep
%setup -n %{n}-%{realversion}
%patch0 -p1

%build
rm -rf ../build
Expand All @@ -29,3 +31,6 @@ make -v %{makeprocesses}
cd ../build

make %{makeprocesses} install

%post
%{relocateConfig}lib64/pkgconfig/flatbuffers.pc
4 changes: 3 additions & 1 deletion gbl.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### RPM external gbl V02-04-01
## INCLUDE cpp-standard

%define tag 31e726d777fe93cdbed0c363dc15f803f7767f40
Source: git+https://gitlab.desy.de/claus.kleinwort/general-broken-lines.git?obj=main/%{tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}.tgz
Expand All @@ -19,7 +20,8 @@ cmake ../cpp \
-DCMAKE_INSTALL_PREFIX=%{i} \
-DCMAKE_BUILD_TYPE=Release \
-DEIGEN3_INCLUDE_DIR=${EIGEN_ROOT}/include/eigen3 \
-DSUPPORT_ROOT=False
-DSUPPORT_ROOT=False \
-DCMAKE_CXX_STANDARD=%{cms_cxx_standard}

make %{makeprocesses}

Expand Down
3 changes: 2 additions & 1 deletion grpc.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### RPM external grpc 1.35.0
## INCLUDE cpp-standard

Source: git+https://github.com/grpc/grpc.git?obj=master/v%{realversion}&export=%{n}-%{realversion}&submodules=1&output=/%{n}-%{realversion}.tgz
Source1: https://patch-diff.githubusercontent.com/raw/grpc/grpc/pull/28212.patch
Expand All @@ -22,7 +23,7 @@ cmake ../%{n}-%{realversion} \
-G Ninja \
-DgRPC_INSTALL=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_CXX_STANDARD=%{cms_cxx_standard} \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_LIBDIR=lib \
-DgRPC_ABSL_PROVIDER=package \
Expand Down
3 changes: 2 additions & 1 deletion heppdt.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### RPM external heppdt 3.04.01
## INCLUDE cpp-standard
%define tag 2b499cfb4302d48d1fd91911fddec88e94219a44
%define branch cms/%{realversion}
%define github_user cms-externals
Expand All @@ -13,7 +14,7 @@ Requires: tbb
%endif

%if "%{?cms_cxxflags:set}" != "set"
%define cms_cxxflags -O2 -std=c++17
%define cms_cxxflags -O2 -std=c++%{cms_cxx_standard}
%endif

%prep
Expand Down
5 changes: 5 additions & 0 deletions java-env.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
## INITENV +PATH LD_LIBRARY_PATH %{java_home}/lib
## NOCOMPILER

%if %{rhel} < 9
# /usr/lib/jvm/java on EL8 contains java 1.8, and Bazel requires java 11
%define java_home /usr/lib/jvm/java-11
%else
%define java_home /usr/lib/jvm/java
%endif
Source: none

%prep
Expand Down
12 changes: 7 additions & 5 deletions libzmq.spec
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
### RPM external libzmq 4.3.4
Source: https://github.com/zeromq/libzmq/releases/download/v%{realversion}/zeromq-%{realversion}.tar.gz
Source1: https://patch-diff.githubusercontent.com/raw/zeromq/libzmq/pull/4334.patch
### RPM external libzmq 4.3.5-5bf04ee
%define branch master
%define tag 5bf04ee2ff207f0eaf34298658fe354ea61e1839
Source: git+https://github.com/zeromq/libzmq.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}.tgz
BuildRequires: autotools

%prep
%setup -n zeromq-%{realversion}
patch -p1 < %{_sourcedir}/4334.patch
%setup -n %{n}-%{realversion}

./autogen.sh

./configure --prefix=%{i} \
--without-docs \
Expand Down
4 changes: 3 additions & 1 deletion lwtnn.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### RPM external lwtnn 2.13
## INCLUDE cpp-standard

Source: https://github.com/lwtnn/lwtnn/archive/v%{realversion}.tar.gz
BuildRequires: ninja cmake
Expand All @@ -21,7 +22,8 @@ cmake ../%{n}-%{realversion} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILTIN_BOOST=OFF \
-DBUILTIN_EIGEN=OFF \
-DCMAKE_PREFIX_PATH="${EIGEN_ROOT};${BOOST_ROOT}"
-DCMAKE_PREFIX_PATH="${EIGEN_ROOT};${BOOST_ROOT}" \
-DCMAKE_CXX_STANDARD=%{cms_cxx_standard}

ninja -v %{makeprocesses}

Expand Down
7 changes: 6 additions & 1 deletion onnxruntime.spec
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ cmake ../%{n}-%{realversion}/cmake -GNinja \
-Donnxruntime_USE_FULL_PROTOBUF=ON \
-Donnxruntime_DISABLE_CONTRIB_OPS=OFF \
-Donnxruntime_PREFER_SYSTEM_LIB=ON \
-Donnxruntime_BUILD_UNIT_TESTS=OFF \
-DCMAKE_CUDA_ARCHITECTURES=$(echo %{cuda_arch} | tr ' ' ';' | sed 's|;;*|;|') \
-DCMAKE_CUDA_FLAGS="-cudart shared" \
-DCMAKE_CUDA_RUNTIME_LIBRARY=Shared \
-DCMAKE_TRY_COMPILE_PLATFORM_VARIABLES="CMAKE_CUDA_RUNTIME_LIBRARY" \
-DCMAKE_PREFIX_PATH="${ZLIB_ROOT};${LIBPNG_ROOT};${PROTOBUF_ROOT};${PY3_PYBIND11_ROOT};${RE2_ROOT}" \
-DRE2_INCLUDE_DIR="${RE2_ROOT}/include"
-DRE2_INCLUDE_DIR="${RE2_ROOT}/include" \
-DCMAKE_CXX_FLAGS="-Wno-error=stringop-overflow"

# False positive string overflow
# https://github.com/google/flatbuffers/issues/7366

ninja -v %{makeprocesses}
python3 ../%{n}-%{realversion}/setup.py build
Expand Down
11 changes: 11 additions & 0 deletions opencv-cpp20.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/modules/imgproc/test/test_houghlines.cpp 2023-07-18 08:46:05.532555671 +0200
+++ b/modules/imgproc/test/test_houghlines.cpp 2023-07-18 08:46:39.922490881 +0200
@@ -53,7 +53,7 @@
T value;
float theta_eps;
float rho_eps;
- SimilarWith<T>(T val, float e, float r_e): value(val), theta_eps(e), rho_eps(r_e) { };
+ SimilarWith(T val, float e, float r_e): value(val), theta_eps(e), rho_eps(r_e) { };
bool operator()(const T& other);
};

7 changes: 6 additions & 1 deletion opencv.spec
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
### RPM external opencv 4.7.0
## INITENV +PATH PYTHON3PATH %{i}/${PYTHON3_LIB_SITE_PACKAGES}
## INCLUDE cpp-standard

%define tag %{realversion}
%define branch master
%define github_user opencv

Source0: git+https://github.com/%{github_user}/opencv.git?obj=%{branch}/%{tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}-%{tag}.tgz
Patch0: opencv-cpp20
BuildRequires: cmake ninja
Requires: python3 py3-numpy libpng libjpeg-turbo libtiff zlib eigen OpenBLAS

%prep
%setup -n %{n}-%{realversion}
%patch0 -p1

%build
rm -rf ../build
Expand All @@ -28,7 +32,8 @@ cmake ../%{n}-%{realversion} \
-DPYTHON3_INCLUDE_DIR:PATH="${PYTHON3_ROOT}/include/python%{cms_python3_major_minor_version}" \
-DPYTHON3_LIBRARY:FILEPATH="${PYTHON3_ROOT}/lib/libpython%{cms_python3_major_minor_version}.so" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${LIBPNG_ROOT};${LIBTIFF_ROOT};${LIBJPEG_TURBO_ROOT};${ZLIB_ROOT};${PYTHON3_ROOT};${PY2_NUMPY_ROOT};${PY3_NUMPY_ROOT};${EIGEN_ROOT};${OPENBLAS_ROOT}"
-DCMAKE_PREFIX_PATH="${LIBPNG_ROOT};${LIBTIFF_ROOT};${LIBJPEG_TURBO_ROOT};${ZLIB_ROOT};${PYTHON3_ROOT};${PY2_NUMPY_ROOT};${PY3_NUMPY_ROOT};${EIGEN_ROOT};${OPENBLAS_ROOT}" \
-DCMAKE_CXX_STANDARD=%{cms_cxx_standard}

ninja -v %{makeprocesses}

Expand Down
1 change: 1 addition & 0 deletions pip/jax.file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Requires: py3-ml_dtypes py3-numpy py3-opt-einsum py3-scipy py3-importlib-metadata
1 change: 1 addition & 0 deletions pip/ml_dtypes.file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Requires: py3-pybind11 py3-numpy
5 changes: 4 additions & 1 deletion pip/onnx.file
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## INCLUDE cpp-standard
Patch0: py3-onnx
Requires: cmake protobuf py3-protobuf py3-six py3-typing-extensions py3-numpy py3-pytest-runner
%define runpath_opts -n pb -n onnx
%define PipPreBuild export ONNX_ML=1
%define PipPreBuild export ONNX_ML=1;export CMAKE_ARGS="-DCMAKE_CXX_STANDARD=%{cms_cxx_standard} -DONNX_USE_PROTOBUF_SHARED_LIBS=ON -DProtobuf_USE_STATIC_LIBS=OFF -DCMAKE_PREFIX_PATH=%{cmake_prefix_path}"
%define patchsrc sed -i -e 's|CMAKE_CXX_STANDARD *11|CMAKE_CXX_STANDARD %{cms_cxx_standard}|' CMakeLists.txt
Loading