Menu

#1186 make issue cobfile (bin/Makefile.am) / undefined reference to `readline' / Ubuntu 25.04

GC 4.0
open
nobody
None
5 - default
2026-01-30
2026-01-30
No

I tried to make GC-4-early-dev under Ubuntu 25.04 from source:

svn checkout https://svn.code.sf.net/p/gnucobol/code/trunk gnucobol-code
cd gnucobol-code 
make distclean || true
rm -f config.cache
rm -f aclocal.m4
rm -rf autom4te.cache
autoreconf -fi
./configure
make
make check
svn info
Revision: 5640
Last Changed Author: sf-mensch
Last Changed Rev: 5627
Last Changed Date: 2025-12-08 13:42:18 +0100 (Mon, 08 Dec 2025)

gcc --version
gcc (Ubuntu 14.2.0-19ubuntu2) 14.2.0

and ran into this error:

make[2]: Entering directory '/home/jbm/gnucobol-code/bin' /bin/bash ../libtool --tag=CC --mode=link gcc -O2 -pipe -finline-functions -fsigned-char -Wall -Wwrite-strings -Wmissing-prototypes -Wno-format-y2k -Wl,-z,relro,-z,now,-O1 -o cobfile cobfile.o ../libcob/libcob.la ../lib/libsupport.la libtool: link: gcc -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/cobfile cobfile.o ../libcob/.libs/libcob.so ../lib/.libs/libsupport.a /usr/bin/ld: cobfile.o: in function main': cobfile.c:(.text.startup+0x384): undefined reference to readline' /usr/bin/ld: cobfile.c:(.text.startup+0x3ce): undefined reference to add_history' collect2: error: ld returned 1 exit status make[2]: *** [Makefile:621: cobfile] Error 1 make[2]: Leaving directory '/home/jbm/gnucobol-code/bin' make[1]: *** [Makefile:704: check-recursive] Error 1 make[1]: Leaving directory '/home/jbm/gnucobol-code' make: *** [Makefile:1004: check] Error 2

After fixing bin/Makefile.am (adding $(LIBCOB_LIBS) from

COMMON_LIBS = $(top_builddir)/libcob/libcob.la \
    $(top_builddir)/lib/libsupport.la \
    $(PROGRAMS_LIBS) $(CODE_COVERAGE_LIBS)
# AM_LDFLAGS = $(COB_EXPORT_DYN)
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)/lib -I$(top_srcdir)/lib
AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)

to

COMMON_LIBS = $(top_builddir)/libcob/libcob.la \
    $(top_builddir)/lib/libsupport.la \
    $(LIBCOB_LIBS) \
    $(PROGRAMS_LIBS) $(CODE_COVERAGE_LIBS)
# AM_LDFLAGS = $(COB_EXPORT_DYN)
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)/lib -I$(top_srcdir)/lib
AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)

all further steps run well and green with:

autoreconf -fi
./configure
make
make check

Discussion


Log in to post a comment.

MongoDB Logo MongoDB