[go: up one dir, main page]

Menu

#1154 GNUCobol build failure on FreeBSD

GC 3.x
pending
configure (12)
4
2025-10-20
2025-10-15
No

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

1 Attachments

Related

Bugs: #1154

Discussion

  • Garry Cramins

    Garry Cramins - 2025-10-15

    Forgot to add, "configure" without disabling json and xml2 libraries builds fine...

     
  • Simon Sobisch

    Simon Sobisch - 2025-10-15
    • labels: --> configure
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,20 +1,21 @@
    -**Attempting to build GNUCobol 3.2 on FreeBSD 14.2 patch level 4. CJSON and XML2 libraries installed, library info:
    +**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"
    +`./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"
    +`./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
    @@ -29,9 +30,8 @@
    
     Stop.
     make: stopped in /home/gpcramins/proj/tools/gnucobol-3.2
    +~~~
    
     Not sure what I am doing wrong?
    
     Garry
    -**
    -
    
    • status: open --> accepted
    • assigned_to: Simon Sobisch
    • Group: unclassified --> GC 3.x
    • Priority: 5 - default --> 4
     
  • Simon Sobisch

    Simon Sobisch - 2025-10-15

    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=-lm and report back.

     
  • Simon Sobisch

    Simon Sobisch - 2025-10-15

    Actually... can you please send config.log for the build that did not work (or at least the parts around isfinite checks)?

     
    • Garry Cramins

      Garry Cramins - 2025-10-15

      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

      referenced by ../libcob/.libs/libcob.so (disallowed by --no-allow-shlib-undefined)
      cc: error: linker command failed with exit code 1 (use -v to see invocation)
      *** 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

       
    • Garry Cramins

      Garry Cramins - 2025-10-15

      Forgot the attached the log file, here it is...

       
  • Garry Cramins

    Garry Cramins - 2025-10-15

    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

     
    • Simon Sobisch

      Simon Sobisch - 2025-10-15

      The warning is rooted in a wrong configure variable as -I should go to CPPFLAGS, not CFLAGS.

       

      Last edit: Simon Sobisch 2025-10-15
      • Garry Cramins

        Garry Cramins - 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...

         
        • Simon Sobisch

          Simon Sobisch - 2025-10-15

          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]).

           
    • Simon Sobisch

      Simon Sobisch - 2025-10-15

      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.

       
      • Garry Cramins

        Garry Cramins - 2025-10-15

        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

        referenced by ../libcob/.libs/libcob.so (disallowed by --no-allow-shlib-undefined)
        cc: error: linker command failed with exit code 1 (use -v to see invocation)
        *** Error code 1

        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

         
        👍
        1
  • Simon Sobisch

    Simon Sobisch - 2025-10-15
    • status: accepted --> pending
     
  • Garry Cramins

    Garry Cramins - 2025-10-15

    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

     
  • Simon Sobisch

    Simon Sobisch - 2025-10-17

    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: isfinite is 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.

     
    • Garry Cramins

      Garry Cramins - 2025-10-19

      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:

      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: isfinite is 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.


      [bugs:#1154] https://sourceforge.net/p/gnucobol/bugs/1154/ GNUCobol
      build failure on FreeBSD

      Status: pending
      Group: GC 3.x
      Labels: configure
      Created: Wed Oct 15, 2025 03:00 PM UTC by Garry Cramins
      Last Updated: Wed Oct 15, 2025 07:59 PM UTC
      Owner: Simon Sobisch
      Attachments:

      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

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/gnucobol/bugs/1154/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #1154

    • Garry Cramins

      Garry Cramins - 2025-10-20

      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

      referenced by ../libcob/.libs/libcob.so (disallowed by --no-allow-shlib-undefined)
      cc: error: linker command failed with exit code 1 (use -v to see invocation)
      *** 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.

      Garry

       

Log in to post a comment.