pkgsrc-Users archive

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

Re: rust: use system libunwind



On Thu, 4 Apr 2024 10:08:28 -0500
Jason Bacon <jtocino%gmx.com@localhost> wrote:

> On 4/4/24 09:15, Martin Husemann wrote:
> > On Thu, Apr 04, 2024 at 03:16:42PM +0200, Thomas Klausner wrote:
> >>> My Alma 8 system doesn't have it at all outside of pkgsrc.  Which raises
> >>> an even more important issue about relying on "system" libraries under
> >>> Linux: They may or may not exist in the first place, or may be outright
> >>> removed beyond the control of pkgsrc.
> >>
> >> Yes, we don't want to depend on the "system" libraries on Linux.
> >
> > Is this a naming misunderstanding?
> >
> > My understanding of the various "system" configure args out there is
> > that they boil down to "something already present, do not build the
> > embedded one in my own distribution". In pkgsrc context "system" would
> > be pkgsrc, not the base system or some other package management.
> >
> > Martin
> 
> That's a good question.  My notion of what "system" usually means is the
> same.  I have not picked apart the rust build system in order to figure
> out what it means to rust, but for whatever reason, it fails to find the
> pkgsrc libunwind when enabled (at least on Linux).  I'll update the
> comment before committing the workaround to better reflect this.  Maybe
> there's a better solution to be found, but the package is broken on
> Linux right now, so I wouldn't want to delay some sort of fix much longer.

I think this has to do with the platform specific unwinder linkage
selection logic which you can find in library/unwind/src/lib.rs.

If I read this right, then libunwind is not being dynamically linked by
this module on NetBSD which explains why we don't see an issue there.
In the Linux case it tries to use libunwind dynamically, but it is outside
of the system's default search path when using pkgsrc. Providing library
paths to rust code is not straight forward. Something like this might
work assuming it will get the correct run path as a side effect of
linking with llvm.

RCS file: /cvsroot/pkgsrc/lang/rust/options.mk,v
retrieving revision 1.37
diff -p -u -r1.37 options.mk
--- options.mk	10 Mar 2024 21:24:36 -0000	1.37
+++ options.mk	4 Apr 2024 16:40:28 -0000
@@ -40,6 +40,7 @@ BUILDLINK_API_DEPENDS.llvm+=	llvm>=15
 CONFIGURE_ARGS+=	--enable-llvm-link-shared
 CONFIGURE_ARGS+=	--llvm-libunwind=system
 CONFIGURE_ARGS+=	--llvm-root=${BUILDLINK_PREFIX.llvm}
+BUILDLINK_TRANSFORM.Linux+=	opt:-lunwind:${BUILDLINK_PREFIX.libunwind}/lib/libunwind.so
 .endif





Home | Main Index | Thread Index | Old Index