cpp-tutorial/stage1 bazel build looks for compiler in wrong /tmp path

Abierto
#394 1 comentario 4 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
30/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
cpp, linux, ubuntu
Área
build-system

Línea de trabajo

Reproduce el fallo con bazel build //main:hello-world --verbose_failures en cpp-tutorial/stage1 en Ubuntu 22.04. Inspecciona main/BUILD en la línea 3 y el wrapper generado external/gcc_toolchain_x86_64/bin/gcc, comparando la ruta /tmp indicada con las rutas de caché de Bazel mostradas en el issue. Se considera terminado cuando el ejemplo se compila correctamente sin el error de compilador ausente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Hello!

I was trying to build cpp-tutorial/stage1 on Ubuntu 22.04 with a bazel binary installed from the Bazel's apt repository, and it returned the following error:

(base) user@computer:/media/user/drive/repositories/bazel_examples/cpp-tutorial/stage1$ bazel build //main:hello-world --verbose_failures
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Analyzed target //main:hello-world (69 packages loaded, 6451 targets configured).
ERROR: /media/user/drive/repositories/bazel_examples/cpp-tutorial/stage1/main/BUILD:3:10: Compiling main/hello-world.cc failed: (Exit 127): gcc failed: error executing CppCompile command (from target //main:hello-world) 
  (cd /home/user/.cache/bazel/_bazel_user/57a42fc2a5495574ce64c6e247ef67dd/sandbox/linux-sandbox/1/execroot/_main && \
  exec env - \
    BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 \
    PATH=/bin:/usr/bin:/usr/local/bin \
    PWD=/proc/self/cwd \
  external/gcc_toolchain_x86_64/bin/gcc -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF bazel-out/k8-fastbuild/bin/main/_objs/hello-world/hello-world.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/main/_objs/hello-world/hello-world.pic.o' -fPIC -iquote . -iquote bazel-out/k8-fastbuild/bin -iquote external/bazel_tools -iquote bazel-out/k8-fastbuild/bin/external/bazel_tools --sysroot external/sysroot_x86_64/ -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' '-fdiagnostics-color=always' -nostdinc -nostdinc++ -Bexternal/gcc_toolchain_x86_64/bin -isystemexternal/sysroot_x86_64//include/c++/10.3.0 -isystemexternal/sysroot_x86_64//include/c++/10.3.0/x86_64-linux -isystemexternal/sysroot_x86_64//lib/gcc/x86_64-linux/10.3.0/include-fixed -isystemexternal/sysroot_x86_64//lib/gcc/x86_64-linux/10.3.0/include -isystemexternal/sysroot_x86_64//usr/include -c main/hello-world.cc -o bazel-out/k8-fastbuild/bin/main/_objs/hello-world/hello-world.pic.o)
# Configuration: 957e8b61236b28eb7e242f1293c1f3119632cdff86140ed1fb6bf77ff4547bca
# Execution platform: @@local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
external/gcc_toolchain_x86_64/bin/gcc: line 45: /tmp/external/gcc_toolchain_x86_64_files/bin/x86_64-linux-gcc: No such file or directory
Target //main:hello-world failed to build
INFO: Elapsed time: 127.229s, Critical Path: 0.18s
INFO: 5 processes: 5 internal.
ERROR: Build did NOT complete successfully

I checked the bazel cache folder and found both

  • /home/user/.cache/bazel/_bazel_user/57a42fc2a5495574ce64c6e247ef67dd/external/gcc_toolchain_x86_64/bin/gcc
  • /home/user/.cache/bazel/_bazel_user/57a42fc2a5495574ce64c6e247ef67dd/external/gcc_toolchain_x86_64_files/bin/x86_64-linux-gcc

but I had trouble figuring out how to direct the build to reach the latter path.

Any help will be very much appreciated!

Lenguaje dominante
Starlark
Estrellas
958
Forks
582
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bazelbuild/examples

Todos los issues de bazelbuild/examples

Issues similares

Más issues de Build System

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.