[Bug 270886] lang/swi-pl update to 9.0.4 requires -lstdthreads

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 17 Apr 2023 11:56:55 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270886

--- Comment #2 from dewayne@heuristicsystems.com.au ---
(In reply to Wen Heping from comment #1)
Hi Wen.  I raised this with the developers, though it seems that this is a
FreeBSD issue, you can find the discussion here
https://swi-prolog.discourse.group/t/freebsd-installation/6467

I have a very custom swi-pl/Makefile so providing a patch will only make life
complicated.  For 9.0.4 I have added to my Makefile

DISTVERSION=    9.0.4
LDFLAGS+= -lstdthreads

And to pkg-plist
diff --git a/local/swi-pl/pkg-plist b/local/swi-pl/pkg-plist
index 28f65c168e..b5c04bf765 100644
--- a/local/swi-pl/pkg-plist
+++ b/local/swi-pl/pkg-plist
@@ -96,8 +96,8 @@ lib/swipl/lib/%%ARCH%%-%%OS%%/isub.so
 lib/swipl/lib/%%ARCH%%-%%OS%%/json.so
 lib/swipl/lib/%%ARCH%%-%%OS%%/libedit4pl.so
 lib/swipl/lib/%%ARCH%%-%%OS%%/libswipl.so
-lib/swipl/lib/%%ARCH%%-%%OS%%/libswipl.so.8
-lib/swipl/lib/%%ARCH%%-%%OS%%/libswipl.so.8.4.3
+lib/swipl/lib/%%ARCH%%-%%OS%%/libswipl.so.9
+lib/swipl/lib/%%ARCH%%-%%OS%%/libswipl.so.9.0.4
 lib/swipl/lib/%%ARCH%%-%%OS%%/md54pl.so
 lib/swipl/lib/%%ARCH%%-%%OS%%/memfile.so
 lib/swipl/lib/%%ARCH%%-%%OS%%/ntriples.so

and of course a: make makesum

This should get a basic build working.

I've found that swi-pl is sensitive to some of the *FLAGS that I use, so I have
also modified the Makefile to force use of a two argument pthread_setname_np in
src/pl-thread.c by adding to 
post-patch:
        @${REINPLACE_CMD} -e '/HAVE_PTHREAD_SETNAME_NP_WITH_TID/s/ifdef
HAVE_PTHREAD_SETNAME_NP_WITH_TID/if 1/g'\
                ${WRKSRC}/src/pl-thread.c
I'd spent a lot of time trying to find the cause but to no avail.

You may wish to also use lto and O3 to build swipl, so I have added
WITH_LTO=       yes
C_CFLAGS=       -O3
and to post-patch:
        @${REINPLACE_CMD} -e '/CMAKE_C_FLAGS_RELEASE/s|O2|O3|1'\
                ${WRKSRC}/cmake/BuildType.cmake

That's the straight forward changes which should help with the update from
8.4.1 to 9.0.4.  I only use the cli version of swipl and without any GPL
additions.

I trust that this is useful?  :)

-- 
You are receiving this mail because:
You are the assignee for the bug.