Skip to content

Commit e9a9cfc

Browse files
x14ngch3nbanach-space
authored andcommitted
update LLVM version to 18
choose dynamic link when building on Arch Linux https://gitlab.archlinux.org/archlinux/packaging/packages/llvm/-/blob/main/PKGBUILD?ref_type=heads#L89 Update Dockerfile_ubuntu
1 parent f9ee5e3 commit e9a9cfc

File tree

9 files changed

+32
-23
lines changed

9 files changed

+32
-23
lines changed

.github/workflows/docker-archlinux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515
- name: Build the Docker image
16-
run: docker build . --file Dockerfile_archlinux --tag llvm-tutor:llvm-15
16+
run: docker build . --file Dockerfile_archlinux --tag llvm-tutor:llvm-18

.github/workflows/docker-fedora.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515
- name: Build the Docker image
16-
run: docker build . --file Dockerfile_fedora --tag llvm-tutor:llvm-17
16+
run: docker build . --file Dockerfile_fedora --tag llvm-tutor:llvm-18

.github/workflows/docker-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515
- name: Build the Docker image
16-
run: docker build . --file Dockerfile_ubuntu --tag llvm-tutor:llvm-17
16+
run: docker build . --file Dockerfile_ubuntu --tag llvm-tutor:llvm-18

.github/workflows/docker-ubunut-apt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515
- name: Build the Docker image
16-
run: docker build . --file Dockerfile_ubuntu_apt --tag llvm-tutor:llvm-17
16+
run: docker build . --file Dockerfile_ubuntu_apt --tag llvm-tutor:llvm-18

Dockerfile_archlinux

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# USAGE:
66
# ```bash
77
# wget https://raw.githubusercontent.com/banach-space/llvm-tutor/main/Dockerfile_archlinux
8-
# docker build -t=llvm-tutor:llvm-14 .
9-
# docker run --rm -it --hostname=llvm-tutor llvm-tutor:llvm-14 /bin/bash
8+
# docker build -t=llvm-tutor:llvm-18 .
9+
# docker run --rm -it --hostname=llvm-tutor llvm-tutor:llvm-18 /bin/bash
1010
# ```
1111
# =============================================================================
1212

@@ -19,6 +19,7 @@ ENV VENV_DIR /venv
1919
# 1. INSTALL DEPENDENCIES
2020
RUN pacman -Syu --noconfirm \
2121
git \
22+
zstd \
2223
cmake \
2324
ninja \
2425
gcc \

Dockerfile_fedora

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
# USAGE:
66
# ```bash
77
# wget https://raw.githubusercontent.com/banach-space/llvm-tutor/main/Dockerfile_fedora
8-
# docker build -t=llvm-tutor:llvm-15 .
9-
# docker run --rm -it --hostname=llvm-tutor llvm-tutor:llvm-15 /bin/bash
8+
# docker build -t=llvm-tutor:llvm-18 .
9+
# docker run --rm -it --hostname=llvm-tutor llvm-tutor:llvm-18 /bin/bash
1010
# ```
1111
# =============================================================================
1212

13-
FROM fedora:38
13+
FROM fedora:40
1414

1515
ENV LLVM_DIR /usr/
1616
ENV TUTOR_DIR /llvm-tutor
@@ -25,6 +25,7 @@ RUN dnf -y install \
2525
llvm-devel \
2626
clang \
2727
zlib-devel \
28+
libzstd-devel \
2829
python3-pip
2930

3031
# 2. INSTALL LIT

Dockerfile_ubuntu

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66
# USAGE:
77
# ```bash
88
# wget https://raw.githubusercontent.com/banach-space/llvm-tutor/main/Dockerfile_ubuntu
9-
# docker build -t=llvm-tutor:llvm-16 .
10-
# docker run --rm -it --hostname=llvm-tutor llvm-tutor:llvm-16 /bin/bash
9+
# docker build -t=llvm-tutor:llvm-18 .
10+
# docker run --rm -it --hostname=llvm-tutor llvm-tutor:llvm-18 /bin/bash
1111
# ```
1212
# =============================================================================
1313

14-
FROM debian:buster
14+
FROM ubuntu:22.04
1515

1616
# 1. INSTALL DEPENDENCIES
1717
RUN apt-get update && apt-get install -y \
1818
git \
1919
cmake \
20+
libzstd-dev \
2021
ninja-build \
2122
build-essential \
2223
python3-minimal python3-pip\
@@ -30,7 +31,7 @@ RUN pip3 install lit
3031
# reason, we need to add `-DLLVM_INSTALL_UTILS=ON` CMake flag when building
3132
# LLVM.
3233
ENV LLVM_DIR /opt/llvm
33-
RUN git clone --branch release/17.x --depth 1 https://github.com/llvm/llvm-project \
34+
RUN git clone --branch release/18.x --depth 1 https://github.com/llvm/llvm-project \
3435
&& mkdir -p $LLVM_DIR \
3536
&& mkdir -p llvm-project/build \
3637
&& cd llvm-project/build \

Dockerfile_ubuntu_apt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
# USAGE:
77
# ```bash
88
# wget https://raw.githubusercontent.com/banach-space/llvm-tutor/main/Dockerfile_ubuntu_apt
9-
# docker build -t=llvm-tutor:llvm-17 .
10-
# docker run --rm -it --hostname=llvm-tutor llvm-tutor:llvm-17 /bin/bash
9+
# docker build -t=llvm-tutor:llvm-18 .
10+
# docker run --rm -it --hostname=llvm-tutor llvm-tutor:llvm-18 /bin/bash
1111
# ```
1212
# =============================================================================
1313

1414
FROM ubuntu:22.04
1515

16-
ENV LLVM_DIR /usr/lib/llvm-17/
16+
ENV LLVM_DIR /usr/lib/llvm-18/
1717
ENV TUTOR_DIR /llvm-tutor
1818

1919
# 1. INSTALL DEPENDENCIES
@@ -30,13 +30,14 @@ RUN apt-get update && apt-get install -y \
3030
build-essential \
3131
python3-minimal python3-pip\
3232
wget \
33+
libzstd-dev \
3334
software-properties-common \
3435
&& rm -rf /var/lib/apt/lists/*
3536

3637
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
37-
RUN apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
38+
RUN apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main"
3839
RUN apt-get update
39-
RUN apt-get install -y llvm-17 llvm-17-dev llvm-17-tools clang-17
40+
RUN apt-get install -y llvm-18 llvm-18-dev llvm-18-tools clang-18
4041
RUN apt-get install -y python3-setuptools
4142

4243
# 2. INSTALL LIT
@@ -50,8 +51,8 @@ RUN mkdir -p $TUTOR_DIR/hello-world-build \
5051
&& cd $TUTOR_DIR/hello-world-build \
5152
&& cmake -G Ninja -DLT_LLVM_INSTALL_DIR=$LLVM_DIR ../HelloWorld \
5253
&& ninja
53-
RUN cd $TUTOR_DIR/hello-world-build && /usr/bin/clang-17 -S -O1 -emit-llvm ../inputs/input_for_hello.c -o input_for_hello.ll
54-
RUN cd $TUTOR_DIR/hello-world-build && /usr/bin/opt-17 -load-pass-plugin ./libHelloWorld.so -passes=hello-world -disable-output input_for_hello.ll 2>&1 | grep "(llvm-tutor) Hello from: foo"
54+
RUN cd $TUTOR_DIR/hello-world-build && /usr/bin/clang-18 -S -O1 -emit-llvm ../inputs/input_for_hello.c -o input_for_hello.ll
55+
RUN cd $TUTOR_DIR/hello-world-build && /usr/bin/opt-18 -load-pass-plugin ./libHelloWorld.so -passes=hello-world -disable-output input_for_hello.ll 2>&1 | grep "(llvm-tutor) Hello from: foo"
5556

5657
# 5. BUILD AND RUN LLVM-TUTOR
5758
RUN mkdir -p $TUTOR_DIR/build \

tools/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ target_include_directories(
1010
PRIVATE
1111
"${CMAKE_CURRENT_SOURCE_DIR}/../include")
1212

13-
target_link_libraries(static
14-
LLVMCore LLVMPasses LLVMIRReader LLVMSupport
15-
)
13+
if(UNIX AND EXISTS "/etc/arch-release")
14+
message("LLVM is installed as shared library on Arch Linux")
15+
target_link_libraries(static LLVM)
16+
else()
17+
target_link_libraries(static
18+
LLVMCore LLVMPasses LLVMIRReader LLVMSupport
19+
)
20+
endif()

0 commit comments

Comments
 (0)