Bazel Build does not compile libraries from GITLab CI Job (Docker container)

123 views
Skip to first unread message

Kevin McKinney

unread,
Sep 19, 2022, 3:34:49 PM9/19/22
to bazel-discuss
Hi Bazel Community,

I am performing a simple c++ compile of my project using Bazel 5.3.0. from a Docker container running in a GITLab Ci Job. I have customized the image to install Bazel and all dependencies. I am able to compile successfully on my host by running:

" docker exec -it pdi-container /bin/bash -c "bazel build --config-cpp_config //main:verify_tool""

However, when I compile this project from my GitLab Job, I receive the below error:

"$ bazel --output_base output build --genrule_strategy=standalone --spawn_strategy=standalone --verbose_failures --sandbox_debug --config=cpp_config //main:verify_tool
77Loading:
78Loading: 0 packages loaded
79Analyzing: target //main:verify_tool (0 packages loaded, 0 targets configured)
80INFO: Analyzed target //main:verify_tool (0 packages loaded, 6 targets configured).
81INFO: Found 1 target...
82[0 / 3] [Prepa] BazelWorkspaceStatusAction stable-status.txt
83[3 / 8] Compiling main/pm.cpp; 1s local ... (4 actions running)
84[3 / 8] Compiling main/pm.cpp; 11s local ... (4 actions running)
85ERROR: /builds/avsw/programs/new_shepard/PDI/pdi-verify-tool/main/BUILD:3:10: Compiling main/process_verify_data_helper.cpp failed: (Exit 1): g++ failed: error executing command
86 (cd /builds/avsw/programs/new_shepard/PDI/pdi-verify-tool/output/execroot/__main__ && \
87 exec env - \
88 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
89 PWD=/proc/self/cwd \
90 /usr/bin/g++ -MD -MF bazel-out/64-fastbuild/bin/main/_objs/verify_tool/process_verify_data_helper.d '-frandom-seed=bazel-out/64-fastbuild/bin/main/_objs/verify_tool/process_verify_data_helper.o' -iquote . -iquote bazel-out/64-fastbuild/bin -iquote external/bazel_tools -iquote bazel-out/64-fastbuild/bin/external/bazel_tools -g -Wall -Werror '-std=c++17' -I/usr/include/jinja2cpp/include -I/usr/local/include/boost -c main/process_verify_data_helper.cpp -o bazel-out/64-fastbuild/bin/main/_objs/verify_tool/process_verify_data_helper.o)
91# Configuration: 757e432bd578388925ee038e81d419bbf7bedee5ead3ef18301b28a7f1139389
92# Execution platform: @local_config_platform//:host
93g++: fatal error: Killed signal terminated program cc1plus
94compilation terminated.
95Target //main:verify_tool failed to build
96INFO: Elapsed time: 15.197s, Critical Path: 14.71s
97INFO: 5 processes: 5 internal.
98FAILED: Build did NOT complete successfully
"
The only difference is I am building the project from GITLab CI. Any help would be appreciated.


Austin Schuh

unread,
Sep 19, 2022, 3:59:24 PM9/19/22
to Kevin McKinney, bazel-discuss
Do you have server logs?  This smells like the OOM killer got you.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/72f051a4-56af-4f3d-b7c1-3113c67734a4n%40googlegroups.com.

Kevin McKinney

unread,
Sep 19, 2022, 4:59:06 PM9/19/22
to bazel-discuss
Hi Austin,
Thanks for responding to my message. You are absolutely correct!!!! OOM was the issue, so I added the below code to my .gitlab-ci.yml file, and it worked!!! The build takes a little longer than expected, but I think this is normal.

variables:
    KUBERNETES_MEMORY_REQUEST: 2Gi
    KUBERNETES_MEMORY_LIMIT: 8Gi       

Thanks again!!!!!!
Kevin McKinney
Reply all
Reply to author
Forward
0 new messages