Skip to content

Commit f2d5190

Browse files
committed
[Runner] Adjust clang flags to make it work slightly better on Linux
1 parent bcde7e8 commit f2d5190

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

src/Runner.jl

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,39 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
449449
add_system_includedir(flags)
450450
end
451451

452-
if !Sys.isbsd(p) && !isnothing(gcc_version)
453-
append!(flags, String["-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/include/c++/$(gcc_version)",
454-
"-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/include/c++/$(gcc_version)/$(aatriplet(p))",
455-
"-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/include/c++/$(gcc_version)/backward",
456-
"-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/include",
457-
"-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/sys-root/include"])
452+
if !Sys.isbsd(p)
453+
# libc++ header files
454+
append!(flags, [
455+
# NOTE: this first directory doesn't exist out-of-the-box in our toolchain,
456+
# but you should put in there the C++ standard libraries for libc++ from
457+
# LLLVMLibcxx_jll. This must come before GCC header files (added below).
458+
"-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/sys-root/include/c++/v1",
459+
# This directory contains C header files. Must come after the C++ ones, see
460+
# for example <https://github.com/llvm/llvm-project/blob/4bcdb26dac4cdadd7f8850a5f9b2e775b73aaf7f/libcxx/include/cmath#L336-L338>.
461+
# This directory is in default search paths, but we have to explicitly put
462+
# it here to give it higher precedence than the following directories.
463+
"-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/sys-root/usr/include",
464+
])
465+
# GCC header files
466+
if !isnothing(gcc_version)
467+
append!(flags, [
468+
"-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/include/c++/$(gcc_version)",
469+
"-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/include/c++/$(gcc_version)/$(aatriplet(p))",
470+
"-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/include/c++/$(gcc_version)/backward",
471+
])
472+
end
473+
# MinGW header files
474+
if Sys.iswindows(p)
475+
append!(flags, [
476+
"-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/include",
477+
])
478+
end
479+
# Extra stuff
480+
append!(flags, [
481+
# "-isystem /opt/$(aatriplet(p))/$(aatriplet(p))/sys-root/include", # <-- this directory doesn't exist out-of-the box (unless manually created to put libc++ in its subdirs, but this would remain without header files anyway), commenting out for the time being
482+
])
458483
end
484+
459485
if Sys.iswindows(p) && nbits(p) == 32
460486
push!(flags, "-fsjlj-exceptions")
461487
end

0 commit comments

Comments
 (0)