Bug 277229 - lang/gnu-cobol: ld: error: undefined reference due to --no-allow-shlib-undefined: __isfinite with clang-17
Summary: lang/gnu-cobol: ld: error: undefined reference due to --no-allow-shlib-undefi...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Wen Heping
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-22 22:10 UTC by Marcin Cieślak
Modified: 2024-02-23 12:06 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (wen)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Cieślak 2024-02-22 22:10:25 UTC
This is FreeBSD 15.0-CURRENT #10 main-n267042-488e8a7faca5: Sun Dec 24 04:00:42 CET 2023 on amd64 with

# clang --version
FreeBSD clang version 17.0.6 (https://github.com/llvm/llvm-project.git llvmorg-17.0.6-0-g6009708b4367)
Target: x86_64-unknown-freebsd15.0
Thread model: posix
InstalledDir: /usr/bin

Linking of the cobcrun executable fails with:

/bin/sh ../libtool  --tag=CC   --mode=link cc  -O2 -pipe  -fstack-protector -fno-strict-aliasing  -pipe -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k  -L/usr/local/lib -fstack-protector  -Wl,-z,relro,-z,now,-O1 -o cobcrun cobcrun.o ../libcob/libcob.la ../lib/libsupport.la -L/usr/local/lib -lintl -Wl,-rpath,/usr/local/lib  
libtool: link: cc -O2 -pipe -fstack-protector -fno-strict-aliasing -pipe -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -fstack-protector -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-O1 -o .libs/cobcrun cobcrun.o -Wl,-rpath -Wl,/usr/local/lib  -L/usr/local/lib ../libcob/.libs/libcob.so ../lib/.libs/libsupport.a -lgmp -lxml2 -lcjson -lncursesw -ldb-5.3 -lintl -Wl,-rpath -Wl,/usr/local/lib
ld: error: undefined reference due to --no-allow-shlib-undefined: __isfinite
>>> referenced by ../libcob/.libs/libcob.so
cc: error: linker command failed with exit code 1 (use -v to see invocation)

(Please note, that autoconf code to detect if -lm should be linked in is commented out
 in https://sourceforge.net/p/gnucobol/code/HEAD/tree/tags/gnucobol-3.2/configure.ac)
Comment 1 Marcin Cieślak 2024-02-22 22:15:24 UTC
A quick fix seems to be this:

# git diff .
diff --git a/lang/gnu-cobol/Makefile b/lang/gnu-cobol/Makefile
index 8690cf388b63..a23a71f77d8a 100644
--- a/lang/gnu-cobol/Makefile
+++ b/lang/gnu-cobol/Makefile
@@ -16,6 +16,7 @@ LIB_DEPENDS=  libgmp.so:math/gmp \
 
 USES=          bdb gmake libtool ncurses tar:xz
 USE_LDCONFIG=  yes
+CONFIGURE_ENV= MATH_LIBS=-lm
 GNU_CONFIGURE= yes
 TEST_TARGET=   check
 TEST_ENV=      TESTSUITEFLAGS=--jobs=${MAKE_JOBS_NUMBER}
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-02-23 12:06:51 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=299683ae32dd945383498c0e78c2a274a4c94258

commit 299683ae32dd945383498c0e78c2a274a4c94258
Author:     Marcin Cieślak <saper@saper.info>
AuthorDate: 2024-02-23 12:03:50 +0000
Commit:     Wen Heping <wen@FreeBSD.org>
CommitDate: 2024-02-23 12:05:11 +0000

    lang/gnu-cobol: Fix ld error

    PR:             277229
    Reported by:    saper@saper.info

 lang/gnu-cobol/Makefile | 3 +++
 1 file changed, 3 insertions(+)