Skip to content

Commit 9e69f44

Browse files
authored
build: Error when attempting to set USECLANG/USEGCC (JuliaLang#58795)
Way back in the good old days, these used to switch between GCC and Clang. I guess these days we always auto-switch based on the CC value. If you try to directly set USECLANG, things get into a bad state. Give a better error message for that case.
1 parent 3ae69f6 commit 9e69f44

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

Make.inc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,10 @@ endif
521521

522522
# Compiler specific stuff
523523

524+
ifneq ($(USECLANG)$(USEGCC),)
525+
$(error "These internal variables are not overridable. Set CC instead.")
526+
endif
527+
524528
ifeq (default,$(origin CC))
525529
CC := $(CROSS_COMPILE)$(CC) # attempt to add cross-compiler prefix, if the user
526530
# is not overriding the default, to form target-triple-cc (which
@@ -1661,8 +1665,8 @@ endif
16611665
# Note: we're passing *FLAGS here computed based on your system compiler to
16621666
# clang. If that causes you problems, you might want to build and/or run
16631667
# specific clang-sa-* files with clang explicitly selected:
1664-
# make CC=~+/../usr/tools/clang CXX=~+/../usr/tools/clang USECLANG=1 analyzegc
1665-
# make USECLANG=1 clang-sa-*
1668+
# make CC=~+/../usr/tools/clang CXX=~+/../usr/tools/clang analyzegc
1669+
# make clang-sa-*
16661670
CLANGSA_FLAGS :=
16671671
CLANGSA_CXXFLAGS :=
16681672
ifeq ($(OS), Darwin) # on new XCode, the files are hidden

contrib/asan/Make.user.asan

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ BINDIR=$(TOOLCHAIN)/usr/bin
33
TOOLDIR=$(TOOLCHAIN)/usr/tools
44

55
# use our new toolchain
6-
USECLANG=1
76
override CC=$(TOOLDIR)/clang
87
override CXX=$(TOOLDIR)/clang++
98
override PATCHELF=$(TOOLDIR)/patchelf

contrib/pgo-lto/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ STAGE2_FLAGS:=LDFLAGS="-fuse-ld=lld -flto=thin -Wl,--undefined-version -fprofile
3232
CFLAGS="-fprofile-use=$(PROFILE_FILE)" $\
3333
CXXFLAGS="-fprofile-use=$(PROFILE_FILE)"
3434

35-
COMMON_FLAGS:=USECLANG=1 USE_BINARYBUILDER_LLVM=0
35+
COMMON_FLAGS:=USE_BINARYBUILDER_LLVM=0
3636

3737
all: stage2 # Default target as first in file
3838

contrib/tsan/Make.user.tsan

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ BINDIR=$(TOOLCHAIN)/usr/bin
33
TOOLDIR=$(TOOLCHAIN)/usr/tools
44

55
# use our new toolchain
6-
USECLANG=1
76
override CC=$(TOOLDIR)/clang
87
override CXX=$(TOOLDIR)/clang++
98

doc/src/devdocs/sanitizers.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ If you require customization or further detail, see the documentation below.
2121

2222
## General considerations
2323

24-
Using Clang's sanitizers obviously requires you to use Clang (`USECLANG=1`), but there's another
24+
Using Clang's sanitizers obviously requires you to use Clang, but there's another
2525
catch: most sanitizers require a run-time library, provided by the host compiler, while the instrumented
2626
code generated by Julia's JIT relies on functionality from that library. This implies that the
2727
LLVM version of your host compiler must match that of the LLVM library used within Julia.
2828

2929
An easy solution is to have a dedicated build folder for providing a matching toolchain, by building
3030
with `BUILD_LLVM_CLANG=1`. You can then refer to this toolchain from another build
31-
folder by specifying `USECLANG=1` while overriding the `CC` and `CXX` variables.
31+
folder by overriding the `CC` and `CXX` variables.
3232

3333
The sanitizers error out when they detect a shared library being opened using `RTLD_DEEPBIND`
3434
(ref: [google/sanitizers#611](https://github.com/google/sanitizers/issues/611)).
@@ -44,7 +44,7 @@ look like this, plus one or more of the `SANITIZE_*` flags listed below:
4444

4545
make -C deps USE_BINARYBUILDER_LLVM=0 LLVM_VER=svn stage-llvm
4646

47-
make -C src SANITIZE=1 USECLANG=1 \
47+
make -C src SANITIZE=1 \
4848
CC=~+/deps/scratch/llvm-svn/build_Release/bin/clang \
4949
CXX=~+/deps/scratch/llvm-svn/build_Release/bin/clang++ \
5050
CPPFLAGS="-isysroot $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" \
@@ -99,7 +99,6 @@ Checkout a Git worktree (or create out-of-tree build directory) at
9999
TOOLCHAIN=$(TOOLCHAIN_WORKTREE)/usr/tools
100100
101101
# use our new toolchain
102-
USECLANG=1
103102
override CC=$(TOOLCHAIN)/clang
104103
override CXX=$(TOOLCHAIN)/clang++
105104
export ASAN_SYMBOLIZER_PATH=$(TOOLCHAIN)/llvm-symbolizer

0 commit comments

Comments
 (0)