0

From some random moment and for some unknown reason, my compiler stopped working. It lets me know about errors, warnings, etc., but i still get this error:

/home/vhajsman/opt/cross/lib/gcc/i686-elf/14.0.0/../../../../i686-elf/bin/ld: cannot find crt0.o: No such file or directory
/home/vhajsman/opt/cross/lib/gcc/i686-elf/14.0.0/../../../../i686-elf/bin/ld: cannot find -lc: No such file or directory
collect2: error: ld returned 1 exit status
/home/vhajsman/opt/cross/lib/gcc/i686-elf/14.0.0/../../../../i686-elf/bin/ld: cannot find crt0.o: No such file or directory
/home/vhajsman/opt/cross/lib/gcc/i686-elf/14.0.0/../../../../i686-elf/bin/ld: cannot find -lstdc++: No such file or directory
/home/vhajsman/opt/cross/lib/gcc/i686-elf/14.0.0/../../../../i686-elf/bin/ld: cannot find -lm: No such file or directory
/home/vhajsman/opt/cross/lib/gcc/i686-elf/14.0.0/../../../../i686-elf/bin/ld: cannot find -lc: No such file or directory
collect2: error: ld returned 1 exit status
cp: missing destination file operand after 'build/obj'
Try 'cp --help' for more information.
/home/vhajsman/opt/cross/lib/gcc/i686-elf/14.0.0/../../../../i686-elf/bin/ld: cannot find build/obj/*: No such file or directory
collect2: error: ld returned 1 exit status

I dont get it. Can someone please help me? Here is my build script, but i am sure it is correct, because compiler can not even compile simple hello world program (which is 100% correct) without throwing these errors.

SOURCES_CPP=$(find -type f -name "*.cpp")
SOURCES_C=$(find -type f -name "*.c")
SOURCES_ASM=$(find -type f -name "*.s")

CFLAGS=" -ffreestanding -O2 -Wall -Wextra -fno-exceptions -lgcc -I ./src/ -I ./src/libs/libc"

i686-elf-as $SOURCES_ASM 
i686-elf-gcc $CFLAGS $SOURCES_C  -std=gnu99
i686-elf-g++ $CFLAGS $SOURCES_CPP -fno-rtti

OBJFILES=$(find -type f -name "*.out")
cp $OBJFILES "build/obj"
rm -f $OBJFILES

i686-elf-g++ -T src/linker.ld -o build/bin/cubebox.bin -ffreestanding -O2 -nostdlib build/obj/* -lgcc

Can someone, please explain and help me? Thanks!

COOKIE
  • 33
  • 6
  • According to your error message, you're missing the C++ standard library, the C++ runtime, and many more files. Maybe you should consider re-install your compiler – LiuYuan Aug 31 '23 at 11:25
  • minimal reproduceable problem. is ASM stuff working fine? then remove it we dont need to see it.. only show the minimal amount of stuff needed to reproduce the problem. – UpAndAdam Aug 31 '23 at 19:37

1 Answers1

0

whats your linux distro ? Remove the ffreestanding option, its to not search for the standard lib.

(What is -ffreestanding option in gcc?)

Louis A.
  • 1
  • 1