Never mind. I found that although the system contains .so of tinfo/gmp, but not .a files. I added .a for both libs, and the problem is solved.