Greetings everyone. I've been having issues trying to statically build a C file on my machine with ncurses. I have the ncurses-static and glibc-static libraries installed on my computer and have tried compiling with gcc -c test.c -o test.o
That works fine. But when I try to link with this:
ld test.o -o test -static -lncurses
I get a lot of errors for undefined referrences. Many of them are to SP but there are others as well. There are way too many errors to include them all here, but here's a snippet:
(.text+0x864): undefined reference to `tparm'
/lib/libncurses.a(lib_mvcur.o): In function `relative_move.constprop.2':
(.text+0x876): undefined reference to `_nc_str_copy'
/lib/libncurses.a(lib_mvcur.o): In function `relative_move.constprop.2':
(.text+0x882): undefined reference to `_nc_safe_strcat'
/lib/libncurses.a(lib_mvcur.o): In function `relative_move.constprop.2':
(.text+0x88f): undefined reference to `SP'
/lib/libncurses.a(lib_mvcur.o): In function `relative_move.constprop.2':
(.text+0x89e): undefined reference to `cur_term'
/lib/libncurses.a(lib_mvcur.o): In function `relative_move.constprop.2':
(.text+0x900): undefined reference to `_nc_safe_strcat'
/lib/libncurses.a(lib_mvcur.o): In function `relative_move.constprop.2':
(.text+0x958): undefined reference to `_nc_safe_strcat'
/lib/libncurses.a(lib_mvcur.o): In function `relative_move.constprop.2':
(.text+0x96e): undefined reference to `SP'
/lib/libncurses.a(lib_mvcur.o): In function `relative_move.constprop.2':
(.text+0x98a): undefined reference to `SP'
/lib/libncurses.a(lib_mvcur.o): In function `relative_move.constprop.2':
(.text+0x9aa): undefined reference to `SP'
/lib/libncurses.a(lib_mvcur.o): In function `relative_move.constprop.2':
(.text+0x9bd): undefined reference to `SP'
/lib/libncurses.a(lib_mvcur.o): In function `relative_move.constprop.2':
(.text+0x9fa): undefined reference to `SP'
/lib/libncurses.a(lib_mvcur.o)
.text+0xa0d): more undefined references to `SP' follow
Am I just passing the wrong arguments to gcc/ld or is there something more serious happening? I've tried checking various websites through Google but I can't seem to find a solution. The program does build dynamically with gcc test.c -o test -lncurses with no warnings or errors. I probably left out some information which would be useful and if so, please let me know and I will provide it here.