authorgravatar for timonkruiper@gmail.comTimon Kruiper <timonkruiper@gmail.com> 2021-03-01 19:52:51+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-03-01 11:02:20-08:00
log24215df8c56ba64e624487f914513212e3e747e9
tree1c8db80cdda1e44bd89074e03d9c260ffd3e240a
parent85eb05e9a8ed0998501535755cdf726552998e54

zig c++: fix compilation that includes any c++ std library file

LLVM 12 included a patch that changed the way availability annotations are specified. We now have to define the _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS flag to make sure that we tell the c++ headers that we don't use visibility annotations. Related LLVM patch: D90843

2 files changed, 2 insertions(+), 0 deletions(-)

src/Compilation.zig+1
......@@ -2264,6 +2264,7 @@ pub fn addCCArgs(
22642264 }
22652265 try argv.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS");
22662266 try argv.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS");
2267 try argv.append("-D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS");
22672268 }
22682269
22692270 const llvm_triple = try @import("codegen/llvm.zig").targetTriple(arena, target);
src/libcxx.zig+1
......@@ -128,6 +128,7 @@ pub fn buildLibCXX(comp: *Compilation) !void {
128128 try cflags.append("-DLIBCXX_BUILDING_LIBCXXABI");
129129 try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS");
130130 try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS");
131 try cflags.append("-D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS");
131132
132133 if (target.abi.isMusl()) {
133134 try cflags.append("-D_LIBCPP_HAS_MUSL_LIBC");