0

First of all by "other source" in title i mean not /usr/bin/ld

Then I am so sorry for this long thread of question. I also would like to say here that any help would be appreciated peacefully.

I have encountered an error during make test according to https://github.com/cliffordwolf/picorv32. I have opened an issue on github already.

I have searched thoroughly the issue and found the following Questions but none of the answers satisfied the issue.

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

OK! Now What is the issue. As I mentioned above while make test according to https://github.com/cliffordwolf/picorv32 i get the following error:

/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

before that in terminal is written:

/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

The line 110 in Makefile is:

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

WHAT IS MY MACHINE?

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

WHAT HAVE I DONE SO FAR:

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

returns many locations which i linked within the working directory but didn't work.

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

Which again didn't work.

I Also installed the recommended packages in the mentioned links but again didn't work.

As i mentioned at the begining of my question, ANY HELP WOULD BE APPRECIATED PEACEFULLY.

Thank you for your attention this far.

ahmad sedigh
  • 81
  • 1
  • 8
  • 1
    Add there `-v` like `}gcc -v -Os ...` and please show the output. `LD_LIBRARY_PATH` are directories, not files. do `export LD_LIBRARY_PATH=/path/to/` – KamilCuk May 27 '21 at 13:38
  • I had `riscv32-unknown-elf-` but then i installed `make -j$(nproc) build-riscv32i-tools` and the issue went away. Thanks @KamilCuk – ahmad sedigh May 29 '21 at 10:25

1 Answers1

0

I had riscv32-unknown-elf- but then i installed make -j$(nproc) build-riscv32i-tools and the issue went away. Thanks @KamilCuk

ahmad sedigh
  • 81
  • 1
  • 8