Skip to content

Commit

Permalink
Merge pull request #5231 from wasmerio/llvm-fix
Browse files Browse the repository at this point in the history
Fix LLVM detection
  • Loading branch information
xdoardo authored Nov 11, 2024
2 parents 74e61fa + e4c740d commit 62f16d7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,10 @@ jobs:
- name: Set up base deps on musl
if: matrix.metadata.build == 'linux-musl'
run: |
./scripts/alpine-linux-install-deps.sh
./scripts/alpine-linux-install-deps.sh
echo "ENABLE_LLVM=0" >> $GITHUB_ENV
echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV
# echo "RUSTFLAGS=-L/usr/lib64 -L/usr/lib" >> $GITHUB_ENV
- name: Set up dependencies for Mac OS
run: |
brew install automake
Expand Down Expand Up @@ -796,7 +798,9 @@ jobs:
if: matrix.metadata.build == 'linux-musl'
run: |
./scripts/alpine-linux-install-deps.sh
echo "ENABLE_LLVM=0" >> $GITHUB_ENV
echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV
# echo "RUSTFLAGS=-L/usr/lib64 -L/usr/lib" >> $GITHUB_ENV
- name: Install MSVC dev-cmd (Windows)
uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.metadata.build == 'windows-x64' }}
Expand Down Expand Up @@ -916,7 +920,9 @@ jobs:
if: matrix.build == 'linux-musl'
run: |
./scripts/alpine-linux-install-deps.sh
echo "ENABLE_LLVM=0" >> $GITHUB_ENV
echo "LLVM_CONFIG_PATH=/usr/bin/llvm-config-18" >> $GITHUB_ENV
# echo "RUSTFLAGS=-L/usr/lib64 -L/usr/lib" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
id: download
with:
Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,19 @@ else ifeq ($(ENABLE_LLVM), 1)
LLVM_VERSION := $(shell llvm-config --version)
compilers += llvm
# … or try to autodetect LLVM from `llvm-config-<version>`.
else ifneq (, $(shell which llvm-config-15 2>/dev/null))
LLVM_VERSION := $(shell llvm-config-15 --version)
else ifneq (, $(shell which llvm-config-18 2>/dev/null))
LLVM_VERSION := $(shell llvm-config-18 --version)
compilers += llvm
# need force LLVM_SYS_150_PREFIX, or llvm_sys will not build in the case
export LLVM_SYS_150_PREFIX = $(shell llvm-config-15 --prefix)
# need force LLVM_SYS_180_PREFIX, or llvm_sys will not build in the case
export LLVM_SYS_180_PREFIX = $(shell llvm-config-18 --prefix)
else ifneq (, $(shell which llvm-config 2>/dev/null))
LLVM_VERSION := $(shell llvm-config --version)
ifneq (, $(findstring 15,$(LLVM_VERSION)))
ifneq (, $(findstring 18,$(LLVM_VERSION)))
compilers += llvm
export LLVM_SYS_150_PREFIX = $(shell llvm-config --prefix)
export LLVM_SYS_180_PREFIX = $(shell llvm-config --prefix)
else ifneq (, $(findstring 14,$(LLVM_VERSION)))
compilers += llvm
export LLVM_SYS_150_PREFIX = $(shell llvm-config --prefix)
export LLVM_SYS_180_PREFIX = $(shell llvm-config --prefix)
endif
endif

Expand Down
3 changes: 2 additions & 1 deletion scripts/alpine-linux-install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
# This script is used by the CI!

apk update
apk add build-base bash musl-dev curl tar make libtool libffi-dev gcc automake autoconf git openssl-dev g++ pkgconfig llvm18-dev clang18-static llvm18-static
apk add bash mold make curl cmake ninja clang18 zstd-static llvm18-dev clang18-static llvm18-static ncurses-static zlib-static
ln -s /usr/bin/clang-18 /usr/bin/clang

0 comments on commit 62f16d7

Please sign in to comment.