Hi, I'm just starting to play with my newly installed system trying to make a simple project (nothing fancy, a z-code interpreter with ncurses support).
I'm basically done with the interpreter code, but now I have some problems when linking with the ncurses lib from nekoware.
I've made a simple "hello world" program in order to keep the things simple:
Code:
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
//extern "C" {
#include <curses.h>
//}
int main(int argc, char *argv[])
{
WINDOW *mainwin;
if ((mainwin = initscr()) == NULL) {
fprintf(stderr, "Error initializing ncurses.n");
exit(EXIT_FAILURE);
}
mvaddstr(13, 33, "Hello, world!");
refresh();
sleep(3);
delwin(mainwin);
endwin();
refresh();
return EXIT_SUCCESS;
}
My exported variables are:
Code:
declare -x CC="c99"
declare -x CFLAGS="-O2 -mips3 -I/usr/nekoware/include -TARG:proc=r4000"
declare -x LANG="C"
declare -x LDFLAGS="-L/usr/nekoware/lib -Wl,-rpath -Wl,/usr/nekoware/lib"
declare -x LD_LIBRARY_PATH="/usr/nekoware/lib:/usr/lib32"
declare -x PATH="/usr/nekoware/bin:/usr/sbin:/usr/bsd:/sbin:/usr/bin:/usr/bin/X11:"
declare -x PS1="\\u [ \\w ]\$ "
declare -x SHELL="/usr/nekoware/bin/bash"
declare -x TERM="iris-ansi"
My compile line is:
Code:
c99 ${CFLAGS} -o curhello curhello.c ${LDFLAGS} -lncurses -v
and the error is:
Code:
Compiling main
/usr/lib32/cmplrs/be -PHASE:w:c -G8 -TARG:t5_ll_sc_bug=on -TENV:PIC -m1 -O2 -TARG:isa=mips3 -TARG:proc=r4000 -show -TARG:abi=n32 -LANG:=ansi_c -fB,/tmp/ctmB.BAAa002yq -fo,curhello.o curhello.c
Compiling curhello.c (/tmp/ctmB.BAAa002yq) -- Back End
Compiling main(0)
/usr/lib32/cmplrs/ld32 -call_shared -no_unresolved -transitive_link -elf -_SYSTYPE_SVR4 -mips3 -L/usr/nekoware/lib -rpath /usr/nekoware/lib -show -n32 -L/usr/lib32/mips3/r4000 -L/usr/lib32/mips3 -L/usr/lib32 /usr/lib32/mips3/crt1.o -o curhello curhello.o -lncurses -dont_warn_unused -Bdynamic -lc /usr/lib32/mips3/crtn.o -warn_unused
ld32: ERROR 33 : Unresolved text symbol "initscr32" -- 1st referenced by curhello.o.
Use linker option -v to see when and which objects, archives and dsos are loaded.
ld32: INFO 152: Output file removed because of error.
c99 ERROR: /usr/lib32/cmplrs/ld32 returned non-zero status 2
I've installed the ncurses-5.4 from mips3 branch of nekoware. I've also tried to search for the symbol into libncurses.so:
Code:
asperi [ ~/mac/curses ]$ nm /usr/nekoware/lib/libncurses.so | grep initscr
[149] | 6457472| 212|FUNC |GLOB |DEFAULT |MIPS_TEXT|initscr
and it seems to be here.
Any clues on how to solve this problem?