Skip to content

Commit 8efd4f4

Browse files
authored
libunwind: Link against Julia zlib (#57798)
As we don't add `$(build_shlibdir)` to the search path, currently unwind seems to link against the system zlib. As mentioned in libunwind/libunwind#653 and from `configure --help` the standard way to link against a library in a non standard location is to set the `CPPFLAGS` and `LDFLAGS`. Tested by building with nix and in the package_linux rootfs image where we don't install zlib (though the shared library happens to be in the search path, the headers aren't). Fixes #55617.
1 parent 4ac5ed2 commit 8efd4f4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

deps/unwind.mk

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ include $(SRCDIR)/unwind.version
33
include $(SRCDIR)/llvmunwind.version
44

55
ifneq ($(USE_BINARYBUILDER_LIBUNWIND),1)
6-
LIBUNWIND_CFLAGS := -U_FORTIFY_SOURCE $(fPIC) -lz $(SANITIZE_OPTS)
7-
LIBUNWIND_CPPFLAGS :=
6+
LIBUNWIND_CFLAGS := -U_FORTIFY_SOURCE $(fPIC) $(SANITIZE_OPTS)
7+
LIBUNWIND_CPPFLAGS := -I$(build_includedir)
8+
LIBUNWIND_LDFLAGS := -L$(build_shlibdir)
89

910
ifeq ($(USE_SYSTEM_ZLIB),0)
1011
$(BUILDDIR)/libunwind-$(UNWIND_VER)/build-configured: | $(build_prefix)/manifest/zlib
@@ -48,7 +49,7 @@ $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-disable-initial-exec-tls.patch-app
4849
$(BUILDDIR)/libunwind-$(UNWIND_VER)/build-configured: $(SRCCACHE)/libunwind-$(UNWIND_VER)/source-extracted $(SRCCACHE)/libunwind-$(UNWIND_VER)/libunwind-disable-initial-exec-tls.patch-applied
4950
mkdir -p $(dir $@)
5051
cd $(dir $@) && \
51-
$(dir $<)/configure $(CONFIGURE_COMMON) CPPFLAGS="$(CPPFLAGS) $(LIBUNWIND_CPPFLAGS)" CFLAGS="$(CFLAGS) $(LIBUNWIND_CFLAGS)" --enable-shared --disable-minidebuginfo --disable-tests --enable-zlibdebuginfo --disable-conservative-checks --enable-per-thread-cache
52+
$(dir $<)/configure $(CONFIGURE_COMMON) CPPFLAGS="$(CPPFLAGS) $(LIBUNWIND_CPPFLAGS)" CFLAGS="$(CFLAGS) $(LIBUNWIND_CFLAGS)" LDFLAGS="$(LDFLAGS) $(LIBUNWIND_LDFLAGS)" --enable-shared --disable-minidebuginfo --disable-tests --enable-zlibdebuginfo --disable-conservative-checks --enable-per-thread-cache
5253
echo 1 > $@
5354

5455
$(BUILDDIR)/libunwind-$(UNWIND_VER)/build-compiled: $(BUILDDIR)/libunwind-$(UNWIND_VER)/build-configured

0 commit comments

Comments
 (0)