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

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 16 Apr 2023 20:11:52 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270886

            Bug ID: 270886
           Summary: lang/swi-pl update to 9.0.4 requires -lstdthreads
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: dewayne@heuristicsystems.com.au
                CC: mailinglist@diamondbox.dk
             Flags: maintainer-feedback?(mailinglist@diamondbox.dk)
                CC: mailinglist@diamondbox.dk

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)

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