我正在尝试使用静态标志(静态链接)构建C程序。虽然我试图这样做,但链接器会抛出一个错误"无法找到-lc"的库。我使用的机器是HP-UX。我不知道它需要哪个库以及我可以在哪里找到它以便在使用-L选项构建程序时可以包含默认搜索位置。
]
另外,我已经在机器上安装了以下依赖项
avotclbh:/home/akhils/test_prog#
avotclbh:/home/akhils/test_prog#gcc -v
Using built-in specs.
Target: ia64-hp-hpux11.31
Configured with: ../gcc/configure
Thread model: posix
gcc version 4.2.3
You have mail in /var/mail/root
avotclbh:/home/akhils/test_prog#
avotclbh:/home/akhils/test_prog#gcc -v -static test_debugging.c -o test_debugging.out -L/usr/lib/hpux64
Using built-in specs.
Target: ia64-hp-hpux11.31
Configured with: ../gcc/configure
Thread model: posix
gcc version 4.2.3
/usr/local/libexec/gcc/ia64-hp-hpux11.31/4.2.3/cc1 -quiet -v test_debugging.c -quiet -dumpbase test_debugging.c -auxbase test_debugging -version -o /var/tmp//ccjCisnQ.s
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/lib/gcc/ia64-hp-hpux11.31/4.2.3/../../../../ia64-hp-hpux11.31/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/lib/gcc/ia64-hp-hpux11.31/4.2.3/include
/usr/include
End of search list.
GNU C version 4.2.3 (ia64-hp-hpux11.31)
compiled by GNU C version 4.2.3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 207e4f838aed34ece15d2a59ed6e0ca7
/usr/local/bin/as -x -o /var/tmp//cceZpXhF.o /var/tmp//ccjCisnQ.s
/usr/local/libexec/gcc/ia64-hp-hpux11.31/4.2.3/collect2 -z +Accept TypeMismatch -u main -noshared -o test_debugging.out crt0.o /usr/lib/hpux32/unix98.o -L/usr/lib/hpux64 -L/usr/local/lib/gcc/ia64-hp-hpux11.31/4.2.3 -L/usr/ccs/lib -L/usr/local/lib/gcc/ia64-hp-hpux11.31/4.2.3/../../.. /var/tmp//cceZpXhF.o -lgcc -lc -lgcc
**ld: Can't find library for -lc
Fatal error.
collect2: ld returned 1 exit status**
avotclbh:/home/akhils/test_prog#
答案 0 :(得分:1)
安装glibc
库包。