Skip to contentSkip to conversation

Patch for readline undefined references

PATCH Bgs 1 participant 1 message Feb 3, 2014 Device mapper

lore
Share & tools
lore

Bgs

author
#0 lore raw

Hello Christophe,

On some systems with libtermcap, readline produces undefined references for some functions.

For example on my Slackware laptop:

/usr/lib64/gcc/x86_64-slackware-linux/4.8.1/../../../../lib64/libreadline.so: undefined reference to tputs' /usr/lib64/gcc/x86_64-slackware-linux/4.8.1/../../../../lib64/libreadline.so: undefined reference to tgoto' /usr/lib64/gcc/x86_64-slackware-linux/4.8.1/../../../../lib64/libreadline.so: undefined reference to tgetflag' /usr/lib64/gcc/x86_64-slackware-linux/4.8.1/../../../../lib64/libreadline.so: undefined reference to UP' /usr/lib64/gcc/x86_64-slackware-linux/4.8.1/../../../../lib64/libreadline.so: undefined reference to tgetent' /usr/lib64/gcc/x86_64-slackware-linux/4.8.1/../../../../lib64/libreadline.so: undefined reference to tgetnum' /usr/lib64/gcc/x86_64-slackware-linux/4.8.1/../../../../lib64/libreadline.so: undefined reference to PC' /usr/lib64/gcc/x86_64-slackware-linux/4.8.1/../../../../lib64/libreadline.so: undefined reference to tgetstr' /usr/lib64/gcc/x86_64-slackware-linux/4.8.1/../../../../lib64/libreadline.so: undefined reference to `BC'

This is not a common problem, but it does show up on some systems.

The attached patch is a very simple solution. Addig libtermcap to the ld flags solves the issue.

I'm not sure how it should be included (or not), but even if it's not, it would be worth putting the info and patch on the web page.

Best regards
Zoltan Posfai

kpartx/Makefile +1 -1
index 4ba38ba..c95037f 100644
@@ -12,7 +12,7 @@ ifneq ($(strip $(LIBDM_API_COOKIE)),0)
 	CFLAGS += -DLIBDM_API_COOKIE
 endif
 
-LDFLAGS = -ldevmapper
+LDFLAGS = -ldevmapper -ltermcap
 OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o dasd.o sun.o \
        gpt.o mac.o ps3.o crc32.o lopart.o xstrncpy.o devmapper.o
 EXEC = kpartx
multipath/Makefile +1 -1
index 5e5958d..22d847a 100644
@@ -7,7 +7,7 @@ include ../Makefile.inc
 OBJS = main.o
 
 CFLAGS += -I$(multipathdir)
-LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath -ludev
+LDFLAGS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath -ludev -ltermcap
 
 EXEC = multipath
 
multipathd/Makefile +1 -1
index 781122a..ba892da 100644
@@ -9,7 +9,7 @@ CFLAGS += -I$(multipathdir) -I$(mpathpersistdir)
 ifdef SYSTEMD
 	CFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
 endif
-LDFLAGS += -lpthread -ldevmapper -lreadline
+LDFLAGS += -lpthread -ldevmapper -lreadline -ltermcap
 ifdef SYSTEMD
 	LDFLAGS += -lsystemd-daemon
 endif