Error while building percona mongodb server from source (6.0.16-13 and 7.0.12-7)

Hi, I am following the below link to build mongodb server pro from source code.

Below are the steps i tried to build 6.0.16-13 version,

  1. wget https://raw.githubusercontent.com/percona/percona-server-mongodb/psmdb-6.0.16-13/percona-packaging/scripts/psmdb_builder.sh -O psmdb_builder.sh

docker run -ti -u root -v /tmp/psmdb:/tmp/psmdb centos:7 sh -c '
set -o xtrace
cd /tmp/psmdb
bash -x ./psmdb_builder.sh --builddir=/tmp/psmdb/test --install_deps=1
bash -x ./psmdb_builder.sh --builddir=/tmp/psmdb/test --repo=https://github.com/percona/percona-server-mongodb.git --branch=release-6.0.16-13 --psm_ver=6.0.16 --psm_release=13 --mongo_tools_tag=100.10.0 --enable_fipsmode=1 --get_sources=1'
docker run -ti -u root -v /tmp/psmdb:/tmp/psmdb centos:7 sh -c '
set -o xtrace
cd /tmp/psmdb
bash -x ./psmdb_builder.sh --builddir=/tmp/psmdb/test --install_deps=1
bash -x ./psmdb_builder.sh --builddir=/tmp/psmdb/test --repo=https://github.com/percona/percona-server-mongodb.git \
--branch=release-6.0.16-13 --psm_ver=6.0.16 --psm_release=13 --mongo_tools_tag=100.10.0 --full-featured=1 --enable_fipsmode=1 --build_src_rpm=1'
docker run -ti -u root -v /tmp/psmdb:/tmp/psmdb oraclelinux:9 sh -c '
set -o xtrace
cd /tmp/psmdb
bash -x ./psmdb_builder.sh --builddir=/tmp/psmdb/test --install_deps=1
bash -x ./psmdb_builder.sh --builddir=/tmp/psmdb/test --repo=https://github.com/percona/percona-server-mongodb.git \
--branch=release-6.0.16-13 --psm_ver=6.0.16 --psm_release=13 --mongo_tools_tag=100.10.0 --full-featured=1 --enable_fipsmode=1 --build_rpm=1'

I am able to do step #2 (get_sources) and #3 (build_src_rpm) but during the #4, i am getting the below error,

+ cp -r /tmp/psmdb/test/rpmbuild/BUILD/./percona-server-mongodb-6.0.16-13/mongo-tools /tmp/psmdb/test/rpmbuild/BUILD//src/github.com/mongodb
+ pushd /tmp/psmdb/test/rpmbuild/BUILD//src/github.com/mongodb/mongo-tools
/tmp/psmdb/test/rpmbuild/BUILD/src/github.com/mongodb/mongo-tools /tmp/psmdb/test/rpmbuild/BUILD /tmp/psmdb/test/rpmbuild/BUILD/percona-server-mongodb-6.0.16-13
+ . ./set_tools_revision.sh
++ export PSMDB_TOOLS_COMMIT_HASH=6d4f001be3fcf673de04d20176e90ee02ef233a9
++ PSMDB_TOOLS_COMMIT_HASH=6d4f001be3fcf673de04d20176e90ee02ef233a9
++ export PSMDB_TOOLS_REVISION=6.0.16-13
++ PSMDB_TOOLS_REVISION=6.0.16-13
+ sed -i 15d buildscript/build.go
+ sed -i 195,204d buildscript/build.go
+ sed -i ‘s:versionStr,:“6.0.16-13”,:’ buildscript/build.go
+ sed -i ‘s:gitCommit):“6d4f001be3fcf673de04d20176e90ee02ef233a9”):’ buildscript/build.go
+ ./make build
# github.com/mongodb/mongo-tools/buildscript
buildscript/build.go:195:2: syntax error: non-declaration statement outside function body
error: Bad exit status from /var/tmp/rpm-tmp.7XRhkh (%build)
RPM build errors:
** Bad exit status from /var/tmp/rpm-tmp.7XRhkh (%build)**
+ return_code=1
+ ‘[’ 1 ‘!=’ 0 ‘]’
+ exit 1

I tried with latest 7.0.12-7 and also older versions of 6.x, but the build_rpm step is always failed in this step. Please suggest how to resolve this issue and i am in need of rpm package for mongod and mongo shell?

Can anyone please help on resolving this error or is there any other approach to build rpm for mongod pro version ?

Hi,

PSMDB 6.0.16-13 and 7.0.12-7 is supposed to have mongo tools 100.9.5 version, please try to use this version for all the build steps.