Attempting to build GNUCobol 3.2 on FreeBSD 14.2 patch level 4. CJSON and XML2 libraries installed, library info:
libcjson-1.7.18_2
libxml22-2.14.5
Although not needed for desired options. GCC is version 13.3.0. Berkely DB version is 18.1.40, built with the following:
./configure --prefix=/usr/local and the standard FreeBSD "make"
For GNUCobol, I used the following configure:
./configure --prefix=/usr/local --without-xml2 --without-json --with-db CPPFLAGS=-I"/usr/local/include" LDFLAGS=-L"/usr/local/lib"
Output is attached file "configure.txt"
"Make" gives the following results:
/usr/local/bin/ld: ../libcob/.libs/libcob.so: undefined reference to `__isfinite'
collect2: error: ld returned 1 exit status
* Error code 1
Stop.
make[2]: stopped in /home/gpcramins/proj/tools/gnucobol-3.2/bin
* Error code 1
Stop.
make[1]: stopped in /home/gpcramins/proj/tools/gnucobol-3.2
* Error code 1
Stop.
make: stopped in /home/gpcramins/proj/tools/gnucobol-3.2
Not sure what I am doing wrong?
Garry
Forgot to add, "configure" without disabling json and xml2 libraries builds fine...
Diff:
My guess is that the libxml2 library definition via pkgconf or xml2-config include libm as a dependency. To know for sure - can you please upload config.log from a configuration that has libxml2? Note: some people consider user names or installed software visible in PATH as private, in this case you may drop those parts.
Also, please recheck building with
./configure --prefix=/usr/local --without-xml2 --without-json --with-db CPPFLAGS=-I"/usr/local/include" LDFLAGS=-L"/usr/local/lib" MATH_LIBS=-lmand report back.Actually... can you please send config.log for the build that did not work (or at least the parts around isfinite checks)?
Attached. Here is the configure command used:
./configure --prefix=/usr/local --with-db --without-json --without-xml2 CFLAGS=-I"/usr/local/include" LDFLAGS=-L"/usr/local/lib"
Here is the error when make is invoked:
ld: error: undefined reference: __isfinite
Stop.
make[2]: stopped in /home/gpcramins/proj/tools/gnucobol-3.2/bin
*** Error code 1
Stop.
make[1]: stopped in /home/gpcramins/proj/tools/gnucobol-3.2
*** Error code 1
Stop.
make: stopped in /home/gpcramins/proj/tools/gnucobol-3.2
Forgot the attached the log file, here it is...
Simon,
You are my hero! The "MATH_LIBS=-lm" did the trick! I configured with the following:
./configure --prefix=/usr/local --with-db --without-json --without-xml2 CC=cc CFLAGS=-I"/usr/local/include,/usr/include" LDFLAGS=-L"/usr/local/lib,/usr/lib" MATH_LIBS=-lm
GNUCobol built fine with the FreeBSD cc and ld!
By the way, for the FreeBSD folks out there, I uninstalled the following packages:
GCC
Bison
GMake
Pkgconfig
Automake
Autoconfig
Libcjson
GMP was installed vice MPIR.
Here is the configure command used:
./configure --prefix=/usr/local --with-db --without-json --without-xml2 MATH_LIBS=-lm CFLAGS=-I"/usr/local/include" LDFLAGS=-L"/usr/local/lib"
I did get the following warning:
configure: WARNING: gmp.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: gmp.h: proceeding with the compiler's result
Compiler was clang NOT gcc, no issues were noted save for the preprocessor warning.
The configure log and make check results are attached. I don't know if this is a "bug", or in my case, a "Problem between the screen and the keyboard", but I am thankful it worked!
Once again, Simon, thank you! I never would have figured this out on my own!
Garry
The warning is rooted in a wrong configure variable as
-Ishould go toCPPFLAGS, notCFLAGS.Last edit: Simon Sobisch 2025-10-15
Got it, ran again with this:
./configure --prefix=/usr/local --with-db --without-json --without-xml2 MATH_LIBS=-lm CPPFLAGS=-I"/usr/local/include" LDFLAGS=-L"/usr/local/lib"
No errors... Configure and check log files attached.
There is a provided FreeBSD package for GNUCobol 3.2, the issue being, it is Berkeley DB 5.3 and is no longer maintained. By downloading the most current Berkeley DB source (18.1.40), GNUCobol can be compiled with a more recent version. Not sure how the Linux distros handle it.
Apparently, this has been done owing to licensing changes with Berkeley DB...
Most distros kept the old BDB (or tried to get rid of it in general), because that was quite similar to LGPL.
While the newer AGPL is compatible to libcob, using it means that any software you link libcob to (which is linked to AGPL'd bdb) can only be made available as binary or as endpoint via network, if you provide the source of the the application [that includes the COBOL source] (and BDB and libcob, but those are already "covered" by upstream distribution if you use an unchanged published version)... under an AGPL compatible license.
As long as you don't make any binaries or "services" available with the resulting GnuCOBOL binaries, that's not an issue, if you do, that's potentially a license change to your software and most likely a need to provide source downloads.
"Of course" Oracle provides BDB as dual-licensed - you can also pay them to get the exact same version of BDB under a non-copyleft license [that was always the case, but nearly no one had to buy one for the sleepycat licensed version, even when changing the library]).
The two configure results seem to be generated by a different autoconf and/or have more differences than --without-xml2: /usr/local/bin is first in PATH (and several tools are found there while the other finds them in /usr/bin; cc vs. gcc, ...)
Can you please try to have to "identical" builds but one with and one without libxml2, showing the isfinite error during make (obviously only for bin/cobc, not for libcob itself)?
That would help in improving the configure script but currently I see a lot of differences - but none that directly points to the problem you've seen.
Simon,
Here you go for the second build.
Second build, without xml2 (FreeBSD 14.3) using the following configure command:
./configure --prefix=/usr/local --with-db --without-json --without-xml2 CPPFLAGS=-I"/usr/local/include" LDFLAGS=-L"/usr/local/lib"
This was with a FRESH untar of gnucobol 3.2 on FreeBSD 14.3, patch level 4. CLang was the compiler, no additional package support such as automake, autoconf, libtool, pkgconf, gcc, libcjson, bison, or similar.
The only package provided was libxml2, which was necessary for a separate install on this system.
Build fails with the following error:
Making all in bin
cc -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../lib -I/usr/local/include -O2 -pipe -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobcrun.o -MD -MP -MF .deps/cobcrun.Tpo -c -o cobcrun.o cobcrun.c
mv -f .deps/cobcrun.Tpo .deps/cobcrun.Po
/bin/sh ../libtool --tag=CC --mode=link cc -O2 -pipe -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -L/usr/local/lib -Wl,-z,relro,-z,now,-O1 -o cobcrun cobcrun.o ../libcob/libcob.la ../lib/libsupport.la -L/usr/local/lib -lintl -R/usr/local/lib
libtool: link: cc -O2 -pipe -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-O1 -o .libs/cobcrun cobcrun.o -L/usr/local/lib ../libcob/.libs/libcob.so -lgmp -lncursesw /usr/local/lib/libdb-18.1.so -lpthread -lssl -lcrypto ../lib/.libs/libsupport.a -lintl -pthread -Wl,-rpath -Wl,/usr/local/lib
ld: error: undefined reference: __isfinite
Stop.
make[2]: stopped in /home/gpcramins/proj/tools/tests/gnucobol-3.2_without_xml2/bin
*** Error code 1
Stop.
make[1]: stopped in /home/gpcramins/proj/tools/tests/gnucobol-3.2_without_xml2
*** Error code 1
Stop.
make: stopped in /home/gpcramins/proj/tools/tests/gnucobol-3.2_without_xml2
"make check" was not possible owing to build failure.
Garry
Simon,
Here you go.
First build, with xml2 (FreeBSD 14.3) using the following configure command:
./configure --prefix=/usr/local --with-db CPPFLAGS=-I"/usr/local/include" LDFLAGS=-L"/usr/local/lib"
(This configure provides xml2 by default)
Received the following warnings:
configure: WARNING: header for libcjson missing, you may adjust CJSON_CFLAGS or put cJSON sources in "libcob"
configure: WARNING: header for libcjson missing, you may adjust CJSON_CFLAGS or put cJSON sources in "libcob"
configure: WARNING: header for libjson-c missing, you may adjust JSON_C_CFLAGS
configure: WARNING: header for libjson-c missing, you may adjust JSON_C_CFLAGS
This was with a FRESH untar of gnucobol 3.2 on FreeBSD 14.3, patch level 4. CLang was the compiler, no additional package support such as automake, autoconf, libtool, pkgconf, gcc, libcjson, bison, or similar.
The only package provided was libxml2, which was necessary for a separate install on this system.
"make check" shows 1266 tests cleared with 16 tests skipped.
Garry
That makes sense. The difference comes from
xml2-config --libs, which output seems to be-L/usr/local/lib -lxml2 -lpthread -L/lib -lz -llzma -lm.But:
isfiniteis found in both scenarios by just including math.h (no libmath needed for that). I'd like to check more details but need config.log (created by configure itself) from the build--without-xml2.I'll have both for you Monday...
Garry P. Cramins
(505) 340-9093
On Fri, Oct 17, 2025, 11:33 Simon Sobisch sf-mensch@users.sourceforge.net
wrote:
Related
Bugs: #1154
Simon,
The requested config.log is attached.
Here is the configure command with arguments:
./configure --prefix=/usr/local --without-xml2 CPPFLAGS=-I"/usr/local/include" LDFLAGS=-L"/usr/local/lib"
Here is the error output from make:
Making all in bin
cc -DHAVE_CONFIG_H -I. -I.. -I.. -I../lib -I../lib -I/usr/local/include -O2 -pipe -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -MT cobcrun.o -MD -MP -MF .deps/cobcrun.Tpo -c -o cobcrun.o cobcrun.c
mv -f .deps/cobcrun.Tpo .deps/cobcrun.Po
/bin/sh ../libtool --tag=CC --mode=link cc -O2 -pipe -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -L/usr/local/lib -Wl,-z,relro,-z,now,-O1 -o cobcrun cobcrun.o ../libcob/libcob.la ../lib/libsupport.la -L/usr/local/lib -lintl -R/usr/local/lib
libtool: link: cc -O2 -pipe -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-O1 -o .libs/cobcrun cobcrun.o -L/usr/local/lib ../libcob/.libs/libcob.so -lgmp -lncursesw /usr/local/lib/libdb-18.1.so -lpthread -lssl -lcrypto ../lib/.libs/libsupport.a -lintl -pthread -Wl,-rpath -Wl,/usr/local/lib
ld: error: undefined reference: __isfinite
Stop.
make[2]: stopped in /home/gpcramins/proj/tools/gnucobol-3.2/bin
*** Error code 1
Stop.
make[1]: stopped in /home/gpcramins/proj/tools/gnucobol-3.2
*** Error code 1
Stop.
Garry