'MIPS cross-compiling fails due to undefined reference
i hope you are doing fine. Currently i am messing with some Cisco gear and my goal is to boot a linux kernel on these devices. In order to do so i have to compile a bootloader in order to load multi segment ELF executable like the linux kernel. Unfortunately i am struggeling compiling this project for a week already. I am using a new Arch system, with mips-elf-gcc installed from the AUR. Usually i work with binaries only, because i want to avoid cross-compiling at all costs, unfortunately these are not available anymore. The target architecture is MIPS III and i'm building on a x86_64 machine. I was able to build single-file "Hello World" MIPS executables already, but not this one.
That's the project i'd like to build. https://git.bocc.de/jochen/cilo
During this stage the process fails.
mips-elf-gcc -Ttext 0x80008000 -nostartfiles -nostdlib --entry _start string.o main.o ciloio.o printf.o elf_loader.o lzma_loader.o LzmaDecode.o mach/c3600/promlib.o mach/c3600/start.o mach/c3600/platio.o mach/c3600/platform.o -o ciscoload.elf
/usr/lib/gcc/mips-elf/11.2.0/../../../../mips-elf/bin/ld: main.o: in function `start_bootloader':
(.text+0x64): undefined reference to `printf'
/usr/lib/gcc/mips-elf/11.2.0/../../../../mips-elf/bin/ld: (.text+0x90): undefined reference to `printf'
/usr/lib/gcc/mips-elf/11.2.0/../../../../mips-elf/bin/ld: (.text+0xbc): undefined reference to `printf'
/usr/lib/gcc/mips-elf/11.2.0/../../../../mips-elf/bin/ld: (.text+0xcc): undefined reference to `printf'
/usr/lib/gcc/mips-elf/11.2.0/../../../../mips-elf/bin/ld: (.text+0xe4): undefined reference to `printf'
/usr/lib/gcc/mips-elf/11.2.0/../../../../mips-elf/bin/ld: main.o:(.text+0x244): more undefined references to `printf' follow
collect2: error: ld returned 1 exit status
make: *** [Makefile:85: ciscoload] Error 1
So far my steps were: 1st, downloading and building the mips-elf-gcc toolchain, 2nd cloning the git, and compiling using "make".
Unfortunately during my past time in the university i have only worked with "single file projects", so never had to link something etc., so this issue is quite new to me.
I have googled this issue prior creating this post, but most of the advices didn't help in my case.
Am i missing something, or what might cause the problem here? The header file for printf is present as well.
I hope someone is capable of helping me, or at least giving some hints on how to further proceed. I'd like to learn as much as possible as well in order to provent this from happening in future projects :)
Thanks in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
