使用 make 时出错

使用 make 时出错

你好,我是 Linux 新手,目前正在使用 Ubuntu 18.04.2 LTS。当我执行“make”命令来安装 nvclock 程序时,终端显示了此错误:


make -C src all
make[1]: Entering directory '/home/kishor/Downloads/nvclock/src'
make[2]: Entering directory '/home/kishor/Downloads/nvclock/src/backend'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/kishor/Downloads/nvclock/src/backend'
make[2]: Entering directory '/home/kishor/Downloads/nvclock/src/nvcontrol'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/kishor/Downloads/nvclock/src/nvcontrol'
make[2]: Entering directory '/home/kishor/Downloads/nvclock/src/gtk'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/kishor/Downloads/nvclock/src/gtk'
make[2]: Entering directory '/home/kishor/Downloads/nvclock/src/qt'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/kishor/Downloads/nvclock/src/qt'
gcc -o nvclock nvclock.c -I./backend -I./nvcontrol -I.. -lX11 -lXext  -L./backend -lbackend -L./nvcontrol -lnvcontrol

./nvcontrol/libnvcontrol.a(libnvcontrol.o): In function `NVFindDisplay':
libnvcontrol.c:(.text+0x19): undefined reference to `XextCreateExtension'
libnvcontrol.c:(.text+0x49): undefined reference to `XextFindDisplay'
libnvcontrol.c:(.text+0x81): undefined reference to `XextAddDisplay'
./nvcontrol/libnvcontrol.a(libnvcontrol.o): In function`NVQueryExtension':
libnvcontrol.c:(.text+0xd5): undefined reference to `XMissingExtension'
./nvcontrol/libnvcontrol.a(libnvcontrol.o): In function `NVQueryVersion':
libnvcontrol.c:(.text+0x179): undefined reference to `XMissingExtension'
libnvcontrol.c:(.text+0x1a3): undefined reference to `XMissingExtension'
./nvcontrol/libnvcontrol.a(libnvcontrol.o): In function `NVGetAttribute':
libnvcontrol.c:(.text+0x37c): undefined reference to `XMissingExtension'
./nvcontrol/libnvcontrol.a(libnvcontrol.o): In function `NVGetStringAttribute':
libnvcontrol.c:(.text+0x5c1): undefined reference to `XMissingExtension'
./nvcontrol/libnvcontrol.a(libnvcontrol.o):libnvcontrol.c:(.text+0x843): more undefined references to `XMissingExtension' follow
collect2: error: ld returned 1 exit status
Makefile:34: recipe for target 'nvclock' failed
make[1]: *** [nvclock] Error 1
make[1]: Leaving directory '/home/kishor/Downloads/nvclock/src'
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2

答案1

nvclock 需要静态 libXext.a,但要求动态 libXext.a。我通过在此步骤中添加 /usr/lib/x86_64-linux-gnu/libXext.a 并运行来使其工作

gcc -o nvclock nvclock.c -I./backend -I./nvcontrol -I.. -lX11  -lXext  -L./backend -lbackend -L./nvcontrol -lnvcontrol /usr/lib/x86_64-linux-gnu/libXext.a

在 src/

相关内容