From 5e6072b6356d94306e918410087da08d6c80fff7 Mon Sep 17 00:00:00 2001 From: Jimmy Bourassa Date: Wed, 1 Jan 2025 21:42:40 -0500 Subject: [PATCH 1/9] Stop pinning clang in windows ucrt clang 15 fails to compile Ruby 3.4, but looks like rb-sys' bindgen properly works with more recent clang now. --- setup-ruby-and-rust/action.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/setup-ruby-and-rust/action.yml b/setup-ruby-and-rust/action.yml index b9afbaa..6382701 100644 --- a/setup-ruby-and-rust/action.yml +++ b/setup-ruby-and-rust/action.yml @@ -105,8 +105,6 @@ runs: working-directory: ${{ inputs.working-directory }} cache-version: ${{ inputs.cache-version }} rubygems: ${{ inputs.rubygems }} - # for now we have to use clang-15 for mingw builds, since our bindgen is too old to work with clang-16 - mingw: clang-15 - name: Install helpers shell: bash @@ -349,19 +347,10 @@ runs: exit 1 fi - libclang_path="$msys_root/opt/llvm-15/bin" bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root" - echo "::info::Listing files in $libclang_path" - ls -la "$libclang_path" echo "::info::Listing files in $msys_root" ls -la "$msys_root" - # We can't use llvm-16 just yet due to backwards compatibility issues, so we have to workaround for now - echo MSYS_ROOT="$msys_root" >> $GITHUB_ENV - echo LIBCLANG_PATH="$libclang_path" >> $GITHUB_ENV - echo "$libclang_path" >> $GITHUB_PATH - echo BINDGEN_EXTRA_CLANG_ARGS="$bindgen_extra_clang_args" >> $GITHUB_ENV - - echo "::info::Set LIBCLANG_PATH to $libclang_path" echo "::info::Set BINDGEN_EXTRA_CLANG_ARGS to $bindgen_extra_clang_args" + echo BINDGEN_EXTRA_CLANG_ARGS="$bindgen_extra_clang_args" >> $GITHUB_ENV From 09a5381eeae40b0c78a07cbf274bc437641f0052 Mon Sep 17 00:00:00 2001 From: Jimmy Bourassa Date: Thu, 9 Jan 2025 16:37:23 -0500 Subject: [PATCH 2/9] Debug: list clang includes --- setup-ruby-and-rust/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup-ruby-and-rust/action.yml b/setup-ruby-and-rust/action.yml index 6382701..fd42f3f 100644 --- a/setup-ruby-and-rust/action.yml +++ b/setup-ruby-and-rust/action.yml @@ -352,5 +352,8 @@ runs: echo "::info::Listing files in $msys_root" ls -la "$msys_root" + echo "::info::List clang include dir" + echo "int main() { return 0; }" > foo.c && clang foo.c -v + echo "::info::Set BINDGEN_EXTRA_CLANG_ARGS to $bindgen_extra_clang_args" echo BINDGEN_EXTRA_CLANG_ARGS="$bindgen_extra_clang_args" >> $GITHUB_ENV From 51a8d3e36de5ddc152074a2b989c5fccc7a96cff Mon Sep 17 00:00:00 2001 From: Jimmy Bourassa Date: Thu, 9 Jan 2025 16:53:32 -0500 Subject: [PATCH 3/9] Try with clang 15 but with clang 18 includes, why not? --- setup-ruby-and-rust/action.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/setup-ruby-and-rust/action.yml b/setup-ruby-and-rust/action.yml index fd42f3f..e454512 100644 --- a/setup-ruby-and-rust/action.yml +++ b/setup-ruby-and-rust/action.yml @@ -105,6 +105,8 @@ runs: working-directory: ${{ inputs.working-directory }} cache-version: ${{ inputs.cache-version }} rubygems: ${{ inputs.rubygems }} + # for now we have to use clang-15 for mingw builds, since our bindgen is too old to work with clang-16 + mingw: clang-15 - name: Install helpers shell: bash @@ -347,13 +349,23 @@ runs: exit 1 fi - bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root" + libclang_path="$msys_root/opt/llvm-15/bin" + bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root -I'C:\Program Files\LLVM\lib\clang\18\include'" + echo "::info::List clang include dir" + echo "int main() { return 0; }" > foo.c && clang foo.c -v + + echo "::info::Listing files in $libclang_path" + ls -la "$libclang_path" echo "::info::Listing files in $msys_root" ls -la "$msys_root" - echo "::info::List clang include dir" - echo "int main() { return 0; }" > foo.c && clang foo.c -v + # We can't use llvm-16 just yet due to backwards compatibility issues, so we have to workaround for now + echo MSYS_ROOT="$msys_root" >> $GITHUB_ENV + echo LIBCLANG_PATH="$libclang_path" >> $GITHUB_ENV + echo "$libclang_path" >> $GITHUB_PATH + echo BINDGEN_EXTRA_CLANG_ARGS="$bindgen_extra_clang_args" >> $GITHUB_ENV + + echo "::info::Set LIBCLANG_PATH to $libclang_path" echo "::info::Set BINDGEN_EXTRA_CLANG_ARGS to $bindgen_extra_clang_args" - echo BINDGEN_EXTRA_CLANG_ARGS="$bindgen_extra_clang_args" >> $GITHUB_ENV From d1bb492185eb953711aa86fca5894e42733d2014 Mon Sep 17 00:00:00 2001 From: Jimmy Bourassa Date: Thu, 9 Jan 2025 18:50:38 -0500 Subject: [PATCH 4/9] What if we only incldue 1 header? --- setup-ruby-and-rust/action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup-ruby-and-rust/action.yml b/setup-ruby-and-rust/action.yml index e454512..0f215e5 100644 --- a/setup-ruby-and-rust/action.yml +++ b/setup-ruby-and-rust/action.yml @@ -350,7 +350,10 @@ runs: fi libclang_path="$msys_root/opt/llvm-15/bin" - bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root -I'C:\Program Files\LLVM\lib\clang\18\include'" + mkdir %TEMP%\extra-includes + cp 'C:\Program Files\LLVM\lib\clang\18\include\stdchkint.h' %TEMP%\extra-includes + + bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root -I%TEMP%\extra-includes" echo "::info::List clang include dir" echo "int main() { return 0; }" > foo.c && clang foo.c -v From a7ac54ebaba76b1ecd1082b0ca0a62b9f5581e5c Mon Sep 17 00:00:00 2001 From: Jimmy Bourassa Date: Thu, 9 Jan 2025 19:09:19 -0500 Subject: [PATCH 5/9] Hmm, what's in that dir? --- setup-ruby-and-rust/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup-ruby-and-rust/action.yml b/setup-ruby-and-rust/action.yml index 0f215e5..0351995 100644 --- a/setup-ruby-and-rust/action.yml +++ b/setup-ruby-and-rust/action.yml @@ -351,7 +351,8 @@ runs: libclang_path="$msys_root/opt/llvm-15/bin" mkdir %TEMP%\extra-includes - cp 'C:\Program Files\LLVM\lib\clang\18\include\stdchkint.h' %TEMP%\extra-includes + ls 'C:\Program Files\LLVM\lib\clang\18\include' + # cp 'C:\Program Files\LLVM\lib\clang\18\include\stdchkint.h' %TEMP%\extra-includes bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root -I%TEMP%\extra-includes" From 1d5fd5f6e8b0c8a7def2eb95a726e3742b81f880 Mon Sep 17 00:00:00 2001 From: Jimmy Bourassa Date: Thu, 9 Jan 2025 19:48:48 -0500 Subject: [PATCH 6/9] what if we download stdckdint? --- setup-ruby-and-rust/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-ruby-and-rust/action.yml b/setup-ruby-and-rust/action.yml index 0351995..1e7eec1 100644 --- a/setup-ruby-and-rust/action.yml +++ b/setup-ruby-and-rust/action.yml @@ -351,7 +351,8 @@ runs: libclang_path="$msys_root/opt/llvm-15/bin" mkdir %TEMP%\extra-includes - ls 'C:\Program Files\LLVM\lib\clang\18\include' + curl https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang/lib/Headers/stdckdint.h > %TEMP%\extra-includes\stdckdint.h + # ls 'C:\Program Files\LLVM\lib\clang\18\include' # cp 'C:\Program Files\LLVM\lib\clang\18\include\stdchkint.h' %TEMP%\extra-includes bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root -I%TEMP%\extra-includes" @@ -364,7 +365,6 @@ runs: echo "::info::Listing files in $msys_root" ls -la "$msys_root" - # We can't use llvm-16 just yet due to backwards compatibility issues, so we have to workaround for now echo MSYS_ROOT="$msys_root" >> $GITHUB_ENV echo LIBCLANG_PATH="$libclang_path" >> $GITHUB_ENV echo "$libclang_path" >> $GITHUB_PATH From 0ed35c41cce6c3b1804cbe8d6f1fa7e2b4d642b5 Mon Sep 17 00:00:00 2001 From: Jimmy Bourassa Date: Thu, 9 Jan 2025 20:05:32 -0500 Subject: [PATCH 7/9] Does that even make its way to clang? --- setup-ruby-and-rust/action.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/setup-ruby-and-rust/action.yml b/setup-ruby-and-rust/action.yml index 1e7eec1..d0abc04 100644 --- a/setup-ruby-and-rust/action.yml +++ b/setup-ruby-and-rust/action.yml @@ -350,12 +350,19 @@ runs: fi libclang_path="$msys_root/opt/llvm-15/bin" - mkdir %TEMP%\extra-includes + tmp_dir=$(expander "%TMP%") + mkdir $tmp_dir\extra-includes + + + echo "::info::Debug" + echo $tmp_dir + ls $tmp_dir\extra-includes + curl https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang/lib/Headers/stdckdint.h > %TEMP%\extra-includes\stdckdint.h # ls 'C:\Program Files\LLVM\lib\clang\18\include' # cp 'C:\Program Files\LLVM\lib\clang\18\include\stdchkint.h' %TEMP%\extra-includes - bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root -I%TEMP%\extra-includes" + bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root -I$tmp_dir\extra-includes" echo "::info::List clang include dir" echo "int main() { return 0; }" > foo.c && clang foo.c -v From d179b40abfcb293dcbc970a5b465479f44786f3d Mon Sep 17 00:00:00 2001 From: Jimmy Bourassa Date: Thu, 9 Jan 2025 20:51:56 -0500 Subject: [PATCH 8/9] ... --- setup-ruby-and-rust/action.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/setup-ruby-and-rust/action.yml b/setup-ruby-and-rust/action.yml index d0abc04..029345d 100644 --- a/setup-ruby-and-rust/action.yml +++ b/setup-ruby-and-rust/action.yml @@ -350,19 +350,19 @@ runs: fi libclang_path="$msys_root/opt/llvm-15/bin" - tmp_dir=$(expander "%TMP%") - mkdir $tmp_dir\extra-includes + extra_includes=$msys_root/opt/extra-includes + echo $extra_includes + mkdir -p $extra_includes - echo "::info::Debug" - echo $tmp_dir - ls $tmp_dir\extra-includes + curl https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang/lib/Headers/stdckdint.h > $extra_includes/stdckdint.h - curl https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang/lib/Headers/stdckdint.h > %TEMP%\extra-includes\stdckdint.h + echo "::info::List extra includes" + ls $extra_includes # ls 'C:\Program Files\LLVM\lib\clang\18\include' # cp 'C:\Program Files\LLVM\lib\clang\18\include\stdchkint.h' %TEMP%\extra-includes - bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root -I$tmp_dir\extra-includes" + bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root -I$extra_includes" echo "::info::List clang include dir" echo "int main() { return 0; }" > foo.c && clang foo.c -v From 33f0cd8e1a66bf3a9d6880dfd3a919da8cabb265 Mon Sep 17 00:00:00 2001 From: Jimmy Bourassa Date: Fri, 10 Jan 2025 14:39:00 -0500 Subject: [PATCH 9/9] Use existing header --- setup-ruby-and-rust/action.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/setup-ruby-and-rust/action.yml b/setup-ruby-and-rust/action.yml index 029345d..50c965f 100644 --- a/setup-ruby-and-rust/action.yml +++ b/setup-ruby-and-rust/action.yml @@ -349,18 +349,11 @@ runs: exit 1 fi - libclang_path="$msys_root/opt/llvm-15/bin" - extra_includes=$msys_root/opt/extra-includes + libclang_path=$msys_root/opt/llvm-15/bin - echo $extra_includes - mkdir -p $extra_includes - - curl https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang/lib/Headers/stdckdint.h > $extra_includes/stdckdint.h - - echo "::info::List extra includes" - ls $extra_includes - # ls 'C:\Program Files\LLVM\lib\clang\18\include' - # cp 'C:\Program Files\LLVM\lib\clang\18\include\stdchkint.h' %TEMP%\extra-includes + extra_includes=$msys_root/opt/rb-sys/include + mkdir -p $msys_root/opt/rb-sys/include + cp 'C:\Program Files\LLVM\lib\clang\18\include\stdckdint.h' $extra_includes bindgen_extra_clang_args="--target=${{ steps.derive-toolchain.outputs.toolchain }} --sysroot=$msys_root -I$extra_includes"