Search code examples
centos7dynamic-linkingsungridengine

undefined reference to `tgetflag'


Here I'm compiling Sun Grid Engine source code, while executing last step ./aimk -no-java -no-jni -no-secure -spool-classic -no-dump -no-qmon, error occurred which stacktrace like below

    gcc -o tcsh          -DSGE_ARCH_STRING=\"linux-x64\" -O3 -Wall -Wstrict-prototypes -DUSE_POLL -DLINUX -DLINUX_NATIVE -DLINUXX64 -DLINUXX64 -D_GNU_SOURCE -DGETHOSTBYNAME_R6 -DGETHOSTBYADDR_R8 -DHAS_VSNPRINTF  -DHAS_IN_PORT_T -I/build/berkeleydb/include/ -DTARGET_64BIT  -DSPOOLING_classic  -DNO_JNI -DCOMPILE_DC -D__SGE_COMPILE_WITH_GETTEXT__  -D__SGE_NO_USERMAPPING__ -DTHREADBINDING -DHWLOC -Wno-error -DPROG_NAME='"qtcsh"' -DLINUXX64      -I. -I.. sh.o sh.dir.o sh.dol.o sh.err.o sh.exec.o sh.char.o sh.exp.o sh.func.o sh.glob.o sh.hist.o sh.init.o sh.lex.o sh.misc.o sh.parse.o sh.print.o sh.proc.o sh.sem.o sh.set.o sh.time.o glob.o mi.termios.o ma.setp.o vms.termcap.o tw.help.o tw.init.o tw.parse.o tw.spell.o tw.comp.o tw.color.o ed.chared.o ed.refresh.o ed.screen.o ed.init.o ed.inputl.o ed.defns.o ed.xmap.o ed.term.o tc.alloc.o tc.bind.o tc.const.o tc.defs.o tc.disc.o tc.func.o tc.os.o tc.printf.o tc.prompt.o tc.sched.o tc.sig.o tc.str.o tc.vers.o tc.who.o  -lcrypt                  -L../../../LINUXX64 -L/build/berkeleydb/lib/ -L. -Wl,-rpath,\$ORIGIN/../../lib/linux-x64  -lsge -lpthread    -ldl
ed.screen.o: In function `EchoTC':
ed.screen.c:(.text+0x119a): undefined reference to `tgetflag'
ed.screen.c:(.text+0x137e): undefined reference to `tgoto'
ed.screen.c:(.text+0x138e): undefined reference to `tputs'
ed.screen.c:(.text+0x13c5): undefined reference to `tgetstr'
ed.screen.c:(.text+0x14ab): undefined reference to `tgoto'
ed.screen.c:(.text+0x14bd): undefined reference to `tputs'
ed.screen.c:(.text+0x151e): undefined reference to `tputs'
ed.screen.o: In function `SetAttributes':
ed.screen.c:(.text+0x1ab4): undefined reference to `tputs'
ed.screen.c:(.text+0x1b9c): undefined reference to `tputs'
ed.screen.c:(.text+0x1bd4): undefined reference to `tputs'
ed.screen.o:ed.screen.c:(.text+0x1c35): more undefined references to `tputs' follow
ed.screen.o: In function `MoveToChar':

and i have already googled tgetflag function and this is it tgetflag(3) - Linux man page. So i thought maybe i lost ncurses library, more info can see this link, after install ncurses related package and re-compile such source and such error still occurred, which is really weird, this is my ncurses package list:

    [root@localhost source]# rpm -qa | grep "ncurses*"
ncurses-devel-5.9-14.20130511.el7_4.x86_64
ncurses-libs-5.9-14.20130511.el7_4.x86_64
ncurses-5.9-14.20130511.el7_4.x86_64
ncurses-base-5.9-14.20130511.el7_4.noarch

Solution

  • Hope this answer can take someone out, here is my steps:

    1. delete such project and extract original tar.gz file
    2. confirm that ncurses related library had been download and install
    3. export LD_LIBRARY_PATH=/usr/lib64/:/usr/lib/:/usr/local/lib, This step telling gcc to get its needed correct package directly
    4. ./aimk -no-java -no-jni -no-secure -spool-classic -no-dump -only-depend
    5. ./scripts/zerodepend
    6. ./aimk -no-java -no-jni -no-secure -spool-classic -no-dump depend