llvm / llvm/llvm-project

Can't build hello world without gcc instalation on linux got: We don't know how to get the definition of mbstate_t on your

Open
#164,070 1 comment 1 reaction 0 assignees View on GitHub
libc++
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

I try to build simple hello world completely without gcc/g++ instalation just to use latest clang++-21.1.3.
hello.cxx:

#include

int main(int argc, char** argv)
{
std::cout << "hello world" << std::endl;
return std::cout.fail();
}

Command to build:

clang++ -std=c++20 -Wfatal-errors -stdlib=libc++ \
-isystem /home/leo/LLVM-21.1.3-Linux-X64/include/c++/v1 \
-isystem /home/leo/LLVM-21.1.3-Linux-X64/include/x86_64-unknown-linux-gnu/c++/v1 \
hello.cxx

Output:

In file included from hello.cxx:1:
In file included from /home/leo/LLVM-21.1.3-Linux-X64/include/c++/v1/iostream:45:
In file included from /home/leo/LLVM-21.1.3-Linux-X64/include/c++/v1/ios:222:
In file included from /home/leo/LLVM-21.1.3-Linux-X64/include/c++/v1/iosfwd:120:
In file included from /home/leo/LLVM-21.1.3-Linux-X64/include/c++/v1/__std_mbstate_t.h:14:
/home/leo/LLVM-21.1.3-Linux-X64/include/c++/v1/__mbstate_t.h:51:4: fatal error: "We don't know how to get the
definition of mbstate_t on your platform."
51 | # error "We don't know how to get the definition of mbstate_t on your platform."
| ^
1 error generated.

I think it should be possible to build binary without instalation gcc toolchain just using [llvm release](https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.3/LLVM-21.1.3-Linux-X64.tar.xz)

Contributor guide

Open the contributing guide

Research direction

Reproduce the reported command with the LLVM-21.1.3-Linux-X64 release and inspect the libc++ headers at include/c++/v1/__mbstate_t.h and __std_mbstate_t.h. Compare the platform setup used by the release with the missing mbstate_t definition; done means the cause and supported resolution for building without an installed GCC toolchain are established.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
build-system, compilers, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.