diff --git a/README.md b/README.md index 2925631..27663c6 100644 --- a/README.md +++ b/README.md @@ -45,11 +45,6 @@ normally provides, in the branch `tools`. -If the toolchain is used in an environment that already have got a -normal GCC based MinGW toolchain with the same triplet prefix in -the same path, you may need to add -`--sysroot=path/to/prefix/x86_64-w64-mingw32` to the clang commands. - Status ------ diff --git a/wrappers/clang-target-wrapper b/wrappers/clang-target-wrapper index 7185ca0..1e9b12f 100755 --- a/wrappers/clang-target-wrapper +++ b/wrappers/clang-target-wrapper @@ -3,6 +3,7 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" TARGET="$(basename $0 | sed 's/-clang.*//')" EXE=$(basename $0 | sed 's/.*-\(clang.*\)/\1/') ARCH=$(echo $TARGET | sed 's/-.*//') +SYSROOT="$(cd "$DIR"/../$TARGET && pwd)" case $ARCH in i686) # Dwarf is the default for i686, but currently there's an issue @@ -25,4 +26,4 @@ aarch64) ARCH_FLAGS=-femulated-tls ;; esac -$DIR/$EXE -target $TARGET -rtlib=compiler-rt -stdlib=libc++ -fuse-ld=lld $ARCH_FLAGS -Qunused-arguments "$@" +$DIR/$EXE -target $TARGET -rtlib=compiler-rt -stdlib=libc++ -fuse-ld=lld --sysroot="$SYSROOT" $ARCH_FLAGS -Qunused-arguments "$@"