Skip to content

Commit

Permalink
Fix build of mingw-w64-clang-aarch64-libc++
Browse files Browse the repository at this point in the history
* Remove problematic flag from clang environment
* Rebuild crt, headers and compiler-rt with the new llvm/lld/clang version
  and flags (probably not necessary)
* Avoid build errors caused by inclusion of headers from existing
  mingw-w64-clang-aarch64-libc++ package
  • Loading branch information
Martchus committed Jan 14, 2025
1 parent 0684e93 commit 35f8f79
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion compiler-rt/mingw-w64-clang-aarch64/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pkgname=mingw-w64-clang-aarch64-compiler-rt
pkgver=19.1.6
pkgrel=1
pkgrel=2
pkgdesc="Compiler runtime libraries for clang (mingw-w64)"
arch=('any')
url="https://compiler-rt.llvm.org/"
Expand Down
2 changes: 1 addition & 1 deletion crt/mingw-w64/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pkgname=mingw-w64-crt
pkgver=12.0.0
pkgrel=1
pkgrel=4
pkgdesc='MinGW-w64 CRT for Windows'
arch=('any')
url='https://www.mingw-w64.org'
Expand Down
4 changes: 2 additions & 2 deletions environment/mingw-w64-clang/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pkgname=mingw-w64-clang-environment
pkgver=1
pkgrel=5
pkgrel=6
arch=('any')
pkgdesc="Script providing common environment variables and functions for targeting MinGW with Clang (mingw-w64)"
license=('GPL-2-or-later')
depends=('llvm' 'clang' 'lld')
url='https://github.com/Martchus/PKGBUILDs'
source=("mingw-env.sh" "lld.sh" "clang.sh" "clang++.sh" "windres.sh" "strip.sh")
sha256sums=('c3be528af25478987827c18238191c5606da9b960ed32ff0a4eda3769c25b7f3'
sha256sums=('7740f565de656b46fda9e96649e834384ff6cffe84042ff9b4f6dc07d444cd5e'
'db37ead09607a88a5b215687e106e6794fa1d0b4c9f50bfe4891b9b3840f1a0a'
'5722f79c9de1cb9ecac902b2d688f5a27398d5f1dacef9379f59aecc338a3d9d'
'b20f256f48d36e6f20b52d4835cccecc3a1aa1d46e9febdbd10043a6e197af2c'
Expand Down
2 changes: 1 addition & 1 deletion environment/mingw-w64-clang/mingw-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ _arch_=${_target%%-*}
compiler_prefix=mingw- || \
cross_clang_flags="-rtlib=compiler-rt -fuse-ld=lld -mguard=cf -target $_target -Xclang -triple -Xclang $_target"
default_mingw_pp_flags="-D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS"
default_mingw_compiler_flags="$cross_clang_flags $default_mingw_pp_flags -O2 -pipe -fno-plt -fexceptions --param=ssp-buffer-size=4 -Wformat -Werror=format-security -mguard=cf"
default_mingw_compiler_flags="$cross_clang_flags $default_mingw_pp_flags -O2 -pipe -fexceptions --param=ssp-buffer-size=4 -Wformat -Werror=format-security -mguard=cf"
default_mingw_cxx_compiler_flags="$default_mingw_compiler_flags -stdlib=libc++ -isystem/usr/$_target/include/c++/v1 -isystem/usr/$_target/include"
default_mingw_linker_flags="$cross_clang_flags -Wl,-O1,--sort-common,--as-needed -fstack-protector"
[[ $_arch_ == aarch64 ]] || [[ $_arch_ =~ arm.* ]] || default_mingw_compiler_flags+=" -fcf-protection"
Expand Down
2 changes: 1 addition & 1 deletion headers/mingw-w64/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pkgname=mingw-w64-headers
pkgver=12.0.0
pkgrel=1
pkgrel=2
pkgdesc="MinGW-w64 headers for Windows"
arch=('any')
url="https://www.mingw-w64.org"
Expand Down
5 changes: 5 additions & 0 deletions libc++/mingw-w64-clang-aarch64/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ build() {

source mingw-clang-env $_target

# avoid build errors caused by inclusion of headers from existing mingw-w64-clang-aarch64-libc++ package
# note: mingw-w64-clang-aarch64-cmake pulls the existing package into the build env.
export CXXFLAGS=${CXXFLAGS/-isystem\/usr\/aarch64-w64-mingw32\/include\/c++\/v1/}

$_target-cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER_WORKS=1 \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DLLVM_ENABLE_RUNTIMES="libunwind;libcxxabi;libcxx" \
-DLIBUNWIND_USE_COMPILER_RT=ON \
-DLIBUNWIND_ENABLE_SHARED=ON \
Expand Down

0 comments on commit 35f8f79

Please sign in to comment.