Hi,A supposed Haskell-guru hadn't been reading the list for the last few days until @wiz poked me off-list :D
On 8/6/25 21:59, Greg Troxel wrote:
Paul Ripke <stix%stix.id.au@localhost> writes:On Mon, Aug 04, 2025 at 07:15:59PM -0400, Greg Troxel wrote:Do we need to have some fixup code to work around upstream not coping with build/install rpath confusion?
That one has kept being a mystery for me for years. The upstream code has a bug, yes, but our GHC (actually Cabal, the module build system) is patched to fix the very bug. I've even sent the patch to the upstream but they've still not merged it:
https://github.com/NetBSD/pkgsrc/blob/trunk/lang/ghc910/patches/patch-libraries_Cabal_Cabal_src_Distribution_Simple_GHC_Build_Link.hsThe patch works for me, it works for @wiz as well, but it doesn't work for some people. I still haven't found out what is making the difference.
This is from my machine FWIW:> % readelf -d /usr/pkg/lib/aarch64-netbsd-ghc-9.10.1/libHShappy-lib-*.so | fgrep RPATH
0x000000000000000f (RPATH) Library rpath: [/usr/pkg/lib:/usr/pkg/lib/aarch64-netbsd-ghc-9.10.1:/usr/pkg/lib/ghc-9.10.1/lib/aarch64-netbsd-ghc-9.10.1] 0x000000000000000f (RPATH) Library rpath: [/usr/pkg/lib:/usr/pkg/lib/aarch64-netbsd-ghc-9.10.1:/usr/pkg/lib/ghc-9.10.1/lib/aarch64-netbsd-ghc-9.10.1] 0x000000000000000f (RPATH) Library rpath: [/usr/pkg/lib:/usr/pkg/lib/aarch64-netbsd-ghc-9.10.1:/usr/pkg/lib/ghc-9.10.1/lib/aarch64-netbsd-ghc-9.10.1] 0x000000000000000f (RPATH) Library rpath: [/usr/pkg/lib:/usr/pkg/lib/aarch64-netbsd-ghc-9.10.1:/usr/pkg/lib/ghc-9.10.1/lib/aarch64-netbsd-ghc-9.10.1] 0x000000000000000f (RPATH) Library rpath: [/usr/pkg/lib:/usr/pkg/lib/ghc-9.10.1/lib/aarch64-netbsd-ghc-9.10.1]But erm...
RPATH /usr/pkg/lib:/usr/pkg/lib/x86_64-netbsd-ghc-9.10.1:/usr/pkg/lib/ghc-9.10.1/lib/x86_64-netbsd-ghc-9.10.1:/tmp/work/devel/happy-lib/work/happy-lib-2.1.6/dist/build/backend-glr:/tmp/work/devel/happy-lib/work/happy-lib-2.1.6/dist/build/frontend
Perhaps the ${WRKDIR} pointing to /tmp is what is triggering the bug? I would love to test my hypothesis but I'm really busy right now. I hope I can do it after a few days or a week, and hope I can track down the real cause.
Hacky, but adding these to the Makefile fixes it: BUILDLINK_TRANSFORM+= rm:-Wl,-rpath,${WRKSRC}/dist/build/backend-glr BUILDLINK_TRANSFORM+= rm:-Wl,-rpath,${WRKSRC}/dist/build/frontendThanks. Fixes the issue on my system. It would be great if someone actually understood the haskell module build system and fixed this correctly. It's interesting and perhaps a clue that this is not more widespread, so perhaps a happy-specific bug (or a pkgsrc bug expressed only for happy). Until then, I think pkgsrc users are better off with the workaround than without, so I've committed it.
Yes, thanks for the commit. I appreciate anything that can work around the issue no matter how hacky it is.