diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index e2aa1384d6..5e1ad1467e 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -48,6 +48,7 @@ CMAKE_BUILD_TYPE="RelWithDebInfo"
CMAKE_CMD="$CMAKE"
OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope ldpc_cuda ldpc_t2 websrv oai_iqplayer imscope"
TARGET_LIST=""
+BUILD_TOOL_OPT="-j$(nproc)"
function print_help() {
echo_info "
@@ -56,6 +57,8 @@ for a number of distributions (Ubuntu 22-24, Fedora, RHEL9).
Options:
--arch-native
Passes -march=native to the compiler.
+--build-tool-opt
+ Pass options to build tool (ninja/make), e.g. -k (\"keep going\")
-c | --clean
Erase all files to make a rebuild from start
-C | --clean-all
@@ -160,6 +163,9 @@ function main() {
--arch-native)
echo_fatal "Error: specify --arch-native on the command line to cmake directly: ./build_oai --cmake-opt \"-DCMAKE_C_FLAGS=-march=native -DCMAKE_CXX_FLAGS=-march=native\""
shift;;
+ --build-tool-opt)
+ BUILD_TOOL_OPT+=" $2"
+ shift 2;;
-c | --clean)
CLEAN=1
shift;;
@@ -490,7 +496,7 @@ function main() {
CMAKE_CMD="$CMAKE_CMD ../../.."
echo_info "Running \"$CMAKE_CMD\""
eval $CMAKE_CMD
- compilations $BUILD_DIR all.txt $TARGET_LIST
+ compilations $BUILD_DIR all.txt "$TARGET_LIST" "${BUILD_TOOL_OPT}"
###################
# Doxygen Support #
###################
@@ -513,9 +519,9 @@ function main() {
cd $DIR/nas_sim_tools/build
${CMAKE_CMD% *} ..
- compilations nas_sim_tools usim.txt usim
- compilations nas_sim_tools nvram.txt nvram
- compilations nas_sim_tools conf2uedata.txt conf2uedata
+ compilations nas_sim_tools usim.txt "usim" "${BUILD_TOOL_OPT}"
+ compilations nas_sim_tools nvram.txt "nvram" "${BUILD_TOOL_OPT}"
+ compilations nas_sim_tools conf2uedata.txt "conf2uedata" "${BUILD_TOOL_OPT}"
# generate USIM data
if [ -f conf2uedata ]; then
diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index dfb0b5a95e..13c8e4efde 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -208,20 +208,20 @@ check_errors() {
}
compilations() {
- [[ $# -gt 2 ]] || echo_fatal "compilations needs more than three arguments"
+ [[ $# -eq 4 ]] || echo_fatal "compilations
"
local dir=$1
- shift 1
- local logfile=$1
- shift 1
- local targets=$@
+ local logfile=$2
+ local targets=$3
+ local build_tool_opt=$4
local verbose=$([ "$VERBOSE_COMPILE" == "1" ] && echo "-v" || echo "")
echo cd $OPENAIR_DIR/cmake_targets/$dir/build
cd $OPENAIR_DIR/cmake_targets/$dir/build
- echo_info "Running \"$CMAKE --build . $verbose --target $targets -- -j$(nproc)\"" $green
+ cmd="$CMAKE --build . ${verbose} --target ${targets} -- ${build_tool_opt}"
+ echo_info "Running \"${cmd}\"" $green
echo "Log file for compilation is being written to: $dlog/$logfile"
set +e
{
- $CMAKE --build . $verbose --target $targets -- -j$(nproc)
+ eval ${cmd}
ret=$?
} > $dlog/$logfile 2>&1
# Print the errors and warnings for CI purposes
diff --git a/docker/Dockerfile.build.rhel9 b/docker/Dockerfile.build.rhel9
index ba10b3a4cd..cff25b7169 100644
--- a/docker/Dockerfile.build.rhel9
+++ b/docker/Dockerfile.build.rhel9
@@ -44,6 +44,7 @@ RUN /bin/sh oaienv && \
--build-e2 --cmake-opt -DXAPP_MULTILANGUAGE=OFF --cmake-opt \
-DKPM_VERSION=$KPM_VERSION --cmake-opt -DE2AP_VERSION=$E2AP_VERSION \
--build-lib 'telnetsrv enbscope uescope nrscope' \
+ --build-tool-opt -k10 \
-w USRP -t Ethernet \
--noavx512" && \
echo "---- ldd on executables ----" && \
diff --git a/docker/Dockerfile.build.rocky b/docker/Dockerfile.build.rocky
index 1126c42057..a3b8180dad 100644
--- a/docker/Dockerfile.build.rocky
+++ b/docker/Dockerfile.build.rocky
@@ -38,6 +38,7 @@ RUN /bin/sh oaienv && \
CXXFLAGS="-Werror -fstack-protector-strong" CFLAGS="-Werror -fstack-protector-strong" ./build_oai -c --ninja \
--eNB --gNB --RU --UE --nrUE \
--build-lib "telnetsrv enbscope uescope nrscope" \
+ --build-tool-opt -k10 \
-w USRP -t Ethernet \
--noavx512 && \
echo "---- ldd on executables ----" && \
diff --git a/docker/Dockerfile.build.ubuntu22 b/docker/Dockerfile.build.ubuntu22
index 9ee0b20158..c0de631c41 100644
--- a/docker/Dockerfile.build.ubuntu22
+++ b/docker/Dockerfile.build.ubuntu22
@@ -45,6 +45,7 @@ RUN /bin/sh oaienv && \
-w USRP -t Ethernet \
--build-e2 --cmake-opt -DXAPP_MULTILANGUAGE=OFF --cmake-opt -DKPM_VERSION=$KPM_VERSION --cmake-opt -DE2AP_VERSION=$E2AP_VERSION \
--noavx512 \
+ --build-tool-opt -k10 \
--cmake-opt -DCMAKE_C_FLAGS="-Werror" --cmake-opt -DCMAKE_CXX_FLAGS="-Werror" $BUILD_OPTION && \
# Mainly to see if the sanitize option was perfectly executed
echo "---- ldd on executables ----" && \
diff --git a/docker/Dockerfile.build.ubuntu22.cross-arm64 b/docker/Dockerfile.build.ubuntu22.cross-arm64
index 91b53ff6b4..78c7a64f64 100644
--- a/docker/Dockerfile.build.ubuntu22.cross-arm64
+++ b/docker/Dockerfile.build.ubuntu22.cross-arm64
@@ -48,7 +48,7 @@ RUN /bin/sh oaienv && \
-DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" && \
echo "====== Start of log for cross-build executables ======" && \
# making always passing so we can analyze the all.txt file
- ninja dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim lte-softmodem nr-softmodem nr-cuup oairu lte-uesoftmodem nr-uesoftmodem params_libconfig coding rfsimulator telnetsrv > ../../log/all.txt 2>&1; \
+ ninja -k10 dlsim ulsim ldpctest polartest smallblocktest nr_pbchsim nr_dlschsim nr_ulschsim nr_dlsim nr_ulsim nr_pucchsim nr_prachsim lte-softmodem nr-softmodem nr-cuup oairu lte-uesoftmodem nr-uesoftmodem params_libconfig coding rfsimulator telnetsrv > ../../log/all.txt 2>&1; \
# displaying errors and warnings
grep -E -A3 "warning:|error:" ../../log/all.txt || true && \
# will fail only if string "errors:" is found
diff --git a/docker/Dockerfile.clang.rhel9 b/docker/Dockerfile.clang.rhel9
index 41d3321fef..d1d4387e61 100644
--- a/docker/Dockerfile.clang.rhel9
+++ b/docker/Dockerfile.clang.rhel9
@@ -40,4 +40,7 @@ RUN /bin/sh oaienv && \
mkdir -p log && \
export CC=/usr/bin/clang && \
export CXX=/usr/bin/clang++ && \
- CFLAGS="-Werror" CXXFLAGS="-Werror -Wno-vla-cxx-extension" ./build_oai --phy_simulators --gNB --eNB --nrUE --UE --ninja --noavx512 --disable-T-Tracer -c
+ CFLAGS="-Werror" CXXFLAGS="-Werror -Wno-vla-cxx-extension" \
+ ./build_oai --phy_simulators --gNB --eNB --nrUE --UE \
+ --ninja --build-tool-opt -k10 \
+ --noavx512 --disable-T-Tracer -c
diff --git a/docker/Dockerfile.gNB.aerial.ubuntu22 b/docker/Dockerfile.gNB.aerial.ubuntu22
index 592421c2b3..c5b090f551 100644
--- a/docker/Dockerfile.gNB.aerial.ubuntu22
+++ b/docker/Dockerfile.gNB.aerial.ubuntu22
@@ -54,7 +54,7 @@ RUN /bin/sh oaienv && \
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
- ./build_oai -c -w AERIAL --gNB --ninja \
+ ./build_oai -c -w AERIAL --gNB --ninja --build-tool-opt -k10 \
--cmake-opt -DCMAKE_C_FLAGS="-Werror" --cmake-opt -DCMAKE_CXX_FLAGS="-Werror"
diff --git a/docker/Dockerfile.phySim.rhel9 b/docker/Dockerfile.phySim.rhel9
index e568c6bc00..a651b2b31d 100644
--- a/docker/Dockerfile.phySim.rhel9
+++ b/docker/Dockerfile.phySim.rhel9
@@ -38,7 +38,7 @@ RUN dnf install -y libasan libubsan
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
- ./build_oai --phy_simulators --ninja --sanitize --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
+ ./build_oai --phy_simulators --ninja --build-tool-opt -k10 --sanitize --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
#start from scratch for target executable
FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-physim