collect2:错误:ld返回1退出状态[gem5]

时间:2019-06-26 12:33:35

标签: gcc gem5

我正在使用

构建gem5.opt
scons build/X86/gem5.opt

我遇到以下错误:

[    LINK]  -> X86/marshal
/usr/bin/ld: cannot find -lpng
collect2: error: ld returned 1 exit status
scons: *** [build/X86/marshal] Error 1
scons: building terminated because of errors.

我尝试链接libpng.so:

sudo ln -s /usr/lib/i386-linux-gnu/libpng.so /usr/lib/libpng.so

这当然告诉我它不兼容:

[    LINK]  -> X86/marshal
/usr/bin/ld: skipping incompatible /usr/lib/libpng.so when searching for -lpng
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libpng.so when searching for -lpng
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libpng.so when searching for -lpng
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/7/../../../libpng.so when searching for -lpng
/usr/bin/ld: skipping incompatible //usr/lib/libpng.so when searching for -lpng
/usr/bin/ld: cannot find -lpng
collect2: error: ld returned 1 exit status
 [    LINK]  -> X86/cpu/testers/memtest/lib.o.partial
 [     CXX] X86/dev/pci/device.cc -> .o
 [     CXX] X86/dev/pci/host.cc -> .o
 [     CXX] X86/dev/pci/copy_engine.cc -> .o
 [     CXX] X86/systemc/channel/sc_event_queue.cc -> .o
 [     CXX] X86/systemc/channel/sc_in_resolved.cc -> .o
 [     CXX] X86/systemc/channel/sc_inout_resolved.cc -> .o
scons: *** [build/X86/marshal] Error 1
 [     CXX] X86/systemc/channel/sc_out_resolved.cc -> .o
scons: building terminated because of errors.

那我从哪里得到64位的libpng.so?

git SHA: af8d107191cc69a77624e2af34f108dc9c1ff03f
OS: Ubuntu 18.04.2 LTS

编辑:我不知道this是否会有所帮助,以防万一。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的错误。传递 png lib 的正确路径并不能解决问题,构建过程仍然会抛出一个错误消息“collect2: error: ld returned 1 exit status” 我只是通过在构建命令的开头添加 sudo 解决了这个问题!!!

sudo scons build/X86/gem5.opt --force-lto

结果:

scons: Building targets ...
 [VER TAGS]  -> X86/sim/tags.cc
 [     CXX] X86/sim/tags.cc -> .o
 [     CXX] X86/base/date.cc -> .o
 [    LINK]  -> X86/gem5.opt
scons: done building targets.