Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build with clang on linux #1805

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,50 @@ jobs:
- name: make posix32
run: make posix32 -j $(nproc)

ubuntu-clang-20_04:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Fix GitHub's mess
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo dpkg --add-architecture i386
sudo apt-get update -qq
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal libpcre2-16-0/focal libpcre2-32-0/focal libpcre2-posix2/focal
- name: Set up dependencies
run: |
sudo apt-get install -yqq libasound2-dev libfluidsynth-dev libgl1-mesa-dev liblo-dev libmagic-dev libpulse-dev libsdl2-dev libsndfile1-dev libx11-dev libxcursor-dev libxext-dev libxrandr-dev pkg-config pyqt5-dev-tools qtbase5-dev
sudo apt-get install -yqq clang lld libx11-6:i386 libxext6:i386
# Fix 32bit bridge build
sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
sudo ln -s /usr/lib/i386-linux-gnu/libXext.so.6 /usr/lib/i386-linux-gnu/libXext.so
- name: make features
run: make CC=clang CXX=clang++ LDFLAGS="-fuse-ld=lld" features
- name: make
run: make CC=clang CXX=clang++ LDFLAGS="-fuse-ld=lld" -j $(nproc)

ubuntu-clang-22_04:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Fix GitHub's mess
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo dpkg --add-architecture i386
sudo apt-get update -qq
sudo apt-get install -yqq --allow-downgrades libc6:i386 libgcc-s1:i386 libstdc++6:i386
- name: Set up dependencies
run: |
sudo apt-get install -yqq libasound2-dev libfluidsynth-dev libgl1-mesa-dev liblo-dev libmagic-dev libpulse-dev libsdl2-dev libsndfile1-dev libx11-dev libxcursor-dev libxext-dev libxrandr-dev pkg-config pyqt5-dev-tools qtbase5-dev
sudo apt-get install -yqq clang lld libx11-6:i386 libxext6:i386
# Fix 32bit bridge build
sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
sudo ln -s /usr/lib/i386-linux-gnu/libXext.so.6 /usr/lib/i386-linux-gnu/libXext.so
- name: make features
run: make CC=clang CXX=clang++ LDFLAGS="-fuse-ld=lld" features
- name: make
run: make CC=clang CXX=clang++ LDFLAGS="-fuse-ld=lld" -j $(nproc)

wasm:
runs-on: ubuntu-22.04
env:
Expand Down
12 changes: 12 additions & 0 deletions source/Makefile.deps.mk
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ endif # BSD
# ---------------------------------------------------------------------------------------------------------------------
# Auto-detect the processor

COMPILER_VERSION := $(shell $(CC) --version)

ifneq (,$(findstring clang,$(COMPILER_VERSION)))
CLANG = true
endif
ifneq (,$(findstring gcc,$(COMPILER_VERSION)))
GCC = true
endif

# ---------------------------------------------------------------------------------------------------------------------
# Auto-detect the processor

TARGET_PROCESSOR := $(firstword $(subst -, ,$(TARGET_MACHINE)))

ifneq (,$(filter i%86,$(TARGET_PROCESSOR)))
Expand Down
2 changes: 1 addition & 1 deletion source/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ CXXFLAGS += -fvisibility-inlines-hidden
endif

ifneq ($(MACOS_OR_WASM_OR_WINDOWS),true)
ifneq ($(BSD),true)
ifeq ($(GCC),true)
BASE_FLAGS += -fno-gnu-unique
endif
endif
Expand Down