pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: rust: use system libunwind



On 4/5/24 07:04, Jason Bacon wrote:
On 4/5/24 02:26, Tobias Nygren wrote:
On Thu, 4 Apr 2024 14:09:22 -0500
Jason Bacon <jtocino%gmx.com@localhost> wrote:

+BUILDLINK_TRANSFORM.Linux+= opt:-lunwind:${BUILDLINK_PREFIX.libunwind}/lib/libunwind.so

This leads to a different error on Lubuntu 23.10, shown below.  Any
objections to patching out --llvm-libunwind=system for Linux as a
temporary workaround?  It will be documented as such.

Oh, bummer. (It worked on Fedora 39 though!)
I do object:
I think the interim fix should instead be to add Linux to the list of
platforms for which we use the "rust-internal-llvm" option by default.
This is the workaround I have been using. Mixing pkgsrc llvm with
rust's bundled libunwind seems less safe to me and we can treat Linux
the same as SunOS and Darwin.

-Tobias



That's a painful solution, but I agree that it's probably the safest.
Here's a new patch proposal using bundled llvm and libunwind, with a
comment documenting what we know so far.

--- options.mk  10 Mar 2024 21:24:36 -0000      1.37
+++ options.mk  5 Apr 2024 11:56:10 -0000
@@ -5,8 +5,26 @@

  .include "../../mk/bsd.fast.prefs.mk"

+##########################################################################
+# Temporary fix: Use bundled llvm and libunwind on Linux
+#
+# --llvm-libunwind=system causes build failures on Linux.
+# The presumption is that specifying "system" libunwind should cause
+# the rust build system to use pkgsrc libunwind, but the linker doesn't
+# find it.  One user reported that using libunwind-dev from apt
+# resolves the issue, indicating that a "system" libunwind from
+# outside pkgsrc is leaking into the build.  This is not acceptable, as
+# the version and build parameters vary widely across Linux distros.
+# It could also be upgraded or removed by tools outside of pkgsrc,
+# causing spontaneous breakage, assuming it was ever installed in the
+# first place.
+#
+# It would be preferable to patch the build system so that pkgsrc
+# libunwind is found when building on Linux.
+##########################################################################
+
  # The bundled LLVM current has issues building on SunOS.
-.if ${OPSYS} != "SunOS"
+.if ${OPSYS} != "SunOS" && ${OPSYS} != Linux
  PKG_SUPPORTED_OPTIONS+=                rust-internal-llvm
  # There may be compatibility issues with the base LLVM on e.g. NetBSD.
  .  if !empty(HAVE_LLVM) || ${MACHINE_PLATFORM:MDarwin-*-aarch64}


Ooops, patched the wrong line due to brain fog. Only halfway through my first cup of tea this morning...

--- options.mk  10 Mar 2024 21:24:36 -0000      1.37
+++ options.mk  5 Apr 2024 12:30:32 -0000
@@ -5,11 +5,29 @@

 .include "../../mk/bsd.fast.prefs.mk"

+##########################################################################
+# Temporary fix: Use bundled llvm and libunwind on Linux
+#
+# --llvm-libunwind=system causes build failures on Linux.
+# The presumption is that specifying "system" libunwind should cause
+# the rust build system to use pkgsrc libunwind, but the linker doesn't
+# find it.  One user reported that using libunwind-dev from apt
+# resolves the issue, indicating that a "system" libunwind from
+# outside pkgsrc is leaking into the build.  This is not acceptable, as
+# the version and build parameters vary widely across Linux distros.
+# It could also be upgraded or removed by tools outside of pkgsrc,
+# causing spontaneous breakage, assuming it was ever installed in the
+# first place.
+#
+# It would be preferable to patch the build system so that pkgsrc
+# libunwind is found when building on Linux.
+##########################################################################
+
 # The bundled LLVM current has issues building on SunOS.
 .if ${OPSYS} != "SunOS"
 PKG_SUPPORTED_OPTIONS+=                rust-internal-llvm
 # There may be compatibility issues with the base LLVM on e.g. NetBSD.
-.  if !empty(HAVE_LLVM) || ${MACHINE_PLATFORM:MDarwin-*-aarch64}
+. if !empty(HAVE_LLVM) || ${MACHINE_PLATFORM:MDarwin-*-aarch64} || ${OPSYS} == "Linux"
 PKG_SUGGESTED_OPTIONS+=                rust-internal-llvm
 .  endif
 .endif



Home | Main Index | Thread Index | Old Index