从其他来源加载的库无法找到

5 浏览
0 Comments

从其他来源加载的库无法找到

首先,“other source”在标题中的意思是不是/usr/bin/ld

对于这个冗长的问题串,我感到非常抱歉。我在https://github.com/cliffordwolf/picorv32中进行make test时遇到了错误。我已经在GitHub上提了一个问题。

我仔细搜索了这个问题,并找到了以下问题,但没有一个答案能满足这个问题:

gcc /usr/bin/ld: cannot find -lglut32, -lopengl32, -lglu32, -lfreegut, but these are installed

Linking failure [ld cannot find library]

ld cannot find .so libraries

ld cannot find -l

ld cannot find libjasper library

ld cannot find an existing library

好了!现在问题是什么。如上所述,在https://github.com/cliffordwolf/picorv32中,当我执行make test时,我遇到了以下错误:

/opt/riscv32i/lib/gcc/riscv32-unknown-elf/8.2.0/../../../../riscv32-unknown-elf/bin/ld: cannot find -lgcc

collect2: error: ld returned 1 exit status

Makefile:110: recipe for target 'firmware/firmware.elf' failed

make: *** [firmware/firmware.elf] Error 1

在此之前,终端中写着:

/opt/riscv32i/bin/riscv32-unknown-elf-gcc -Os -ffreestanding -nostdlib -o firmware/firmware.elf \
    -Wl,-Bstatic,-T,firmware/sections.lds,-Map,firmware/firmware.map,--strip-debug \
    firmware/start.o firmware/irq.o firmware/print.o firmware/hello.o firmware/sieve.o firmware/multest.o firmware/stats.o tests/or.o tests/xor.o tests/sh.o tests/andi.o tests/sub.o tests/sll.o tests/sra.o tests/lh.o tests/bge.o tests/srai.o tests/lb.o tests/mulh.o tests/slti.o tests/srli.o tests/rem.o tests/lw.o tests/div.o tests/beq.o tests/auipc.o tests/sw.o tests/jalr.o tests/bgeu.o tests/ori.o tests/divu.o tests/mulhu.o tests/add.o tests/slt.o tests/lbu.o tests/lhu.o tests/lui.o tests/bltu.o tests/simple.o tests/remu.o tests/xori.o tests/sb.o tests/jal.o tests/mul.o tests/addi.o tests/srl.o tests/slli.o tests/j.o tests/bne.o tests/and.o tests/blt.o tests/mulhsu.o -lgcc

Makefile中的第110行是:

firmware/firmware.elf: $(FIRMWARE_OBJS) $(TEST_OBJS) firmware/sections.lds

$(TOOLCHAIN_PREFIX)gcc -Os -ffreestanding -nostdlib -o $@ \

-Wl,-Bstatic,-T,firmware/sections.lds,-Map,firmware/firmware.map,--strip-debug \

$(FIRMWARE_OBJS) $(TEST_OBJS) -lgcc

我的机器是什么?

uname -a 
Linux ahmad-pc 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -a 
LSB Version:    core-9.20170808ubuntu1-noarch:printing-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.5 LTS
Release:        18.04
Codename:       bionic
gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

我到目前为止做了什么:

locate libgcc_s.so
locate libgcc_s.so.1
locate libgcc.a

返回了很多位置,我在工作目录中进行了链接,但没有起作用。

export LD_LIBRARY_PATH=/path/to/libgcc_s.so.1:$LD_LIBRARY_PATH

这也没有起作用。

我还安装了在上述链接中推荐的软件包,但仍然没有起作用。

正如我在问题开始时提到的,任何帮助都将得到高度赞赏。

感谢您的关注。

0
0 Comments

这个问题的出现原因是由于缺少了一个名为"riscv32-unknown-elf-"的库。通过执行命令"make -j$(nproc) build-riscv32i-tools"来安装该库,问题得以解决。

0