Skip to content

C++ linking fails when toolchain invokes gcc instead of g++ (missing libstdc++) #221

Description

@abdi810103

When using a custom GCC toolchain with Bazel (remote execution via Buildbarn), C++ linking fails with many undefined references to standard C++ symbols.

The linker is invoked as:

gcc -o ...

instead of:

g++ -o ...

This results in missing symbols like:

std::__cxx11::basic_string
operator new/delete
__gxx_personality_v0

Expected behavior:

C++ linking should use g++ or otherwise include libstdc++ automatically.

Actual behavior:

gcc is used without linking libstdc++, causing link failures.

Environment:

Bazel 8.4.2
Linux (container-based execution)
Remote execution via Buildbarn

Question:

Is this expected behavior for GCC toolchains, or should the toolchain explicitly ensure g++ (or -lstdc++) is used for C++ linking?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions