Skip to content

genshen/docker-clang-toolchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-clang-toolchain

clang-toolchain without gnu.

clang/clang++ will link musl libc, libc++, libcxxabi, libunwind and compiler-rt as C/C++ standard library or C++ runtime, not glibc、libstdc++ and libgcc in GNU C/C++ compiler.

Build

docker build --rm=true -t genshen/clang-toolchain:latest .

Usage

Dynamic Linking

docker run -it --rm -v ${PWD}:/project genshen/clang-toolchain:latest clang++ main.cpp -o a.out # compile
docker run -it --rm -v ${PWD}:/project genshen/clang-toolchain:latest ./a.out # run
docker run -it --rm -v ${PWD}:/project genshen/clang-toolchain:latest ldd ./a.out # show shared libs
	/lib/ld-musl-x86_64.so.1 (0x7fc960e6f000)
	libc++.so.1 => /usr/local/lib/libc++.so.1 (0x7fc960cc6000)
	libc++abi.so.1 => /usr/local/lib/libc++abi.so.1 (0x7fc960c67000)
	libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7fc960e6f000)

Static Linking

docker run -it --rm -v ${PWD}:/project genshen/clang-toolchain:latest clang++ main.cpp -static -lc++ -lc++abi -o main