Updating to 9.0.4 was problematic but successful. I'm sharing my experience in the hope that the maintainer (or others) can provide insight into the right solution. I modified the Makefile and pkg-plist with the usual number changes, eg 8.4.3 to 9.0.4. Compiling resulted in a failure ld-elf.so.1: /var/ports/usr/ports/local/swi-pl-9.0.4-fail/work/.build/src/libswipl.so.9: Undefined symbol "cnd_init" (5 hours later) I added -lstdthreads to the set statement in cmake/Params.cmake if(MULTI_THREADED) set(C_CFLAGS "${C_CFLAGS} -pthread") endif() Aside - cc converted -pthread to -lpthread (magic happens!) Build failure continued. Out of frustration, I added -lstdthreads to LDFLAGS which resulted in a successful build & execution, eg swipl -f /usr/local/lib/swipl/library/test_cover.pl -g 'assert((a(X):-yaml_read(X,_)))' -g 'show_coverage(a("/tmp/os.yaml"))' -g halt Aside: There is a noticeable size increase. Changing only LDFLAGS+=-lstdthreads -rwxr-xr-x 0 root wheel 2048104 16 Apr 19:26 /usr/local/lib/swipl/lib/amd64-freebsd/libswipl.so.8.4.3 -rwxr-xr-x 0 root wheel 2247928 17 Apr 05:14 /usr/local/lib/swipl/lib/amd64-freebsd/libswipl.so.9.0.4 (Note: I use O3 and lto=thin)
Would you upload your patch to update swi-prolog to 9.0.4 ? Thank you ! wen
(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? :)
Created attachment 241563 [details] Update to 9.0.4 Update to 9.0.4
(In reply to Wen Heping from comment #3) Thank-you Wen.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=e52b78e64cb910ac8bd7bb4839c0fc6ec5490575 commit e52b78e64cb910ac8bd7bb4839c0fc6ec5490575 Author: Wen Heping <wen@FreeBSD.org> AuthorDate: 2023-05-05 14:10:15 +0000 Commit: Wen Heping <wen@FreeBSD.org> CommitDate: 2023-05-05 14:10:15 +0000 lang/swi-pl: Update to 9.0.4 PR: 270886 Reported by: dewayne@heuristicsystems.com.au Approved by: maintainer(timeout, >= 20 days) lang/swi-pl/Makefile | 5 ++++- lang/swi-pl/distinfo | 6 +++--- lang/swi-pl/pkg-plist | 35 ++++++++++++++++++++++++++--------- 3 files changed, 33 insertions(+), 13 deletions(-)