jsandler18 / raspi-kernel

MIT License
298 stars 50 forks source link

Makefile fails to compile with error "collect2: error: ld returned 1 exit status make: *** [Makefile:39: build] Error 1" #25

Open MEMESCOEP opened 3 years ago

MEMESCOEP commented 3 years ago

When I run the command 'make', I get this error:

/mnt/c/users/andre/desktop/custom_rpi_os/gcc-arm-10.2-2020.11-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc -T linker.ld -o kernel.elf -ffreestanding -O2 -nostdlib objects/mailbox.o objects/mem.o objects/interrupts.o objects/atag.o objects/kerio.o objects/uart.o objects/gpu.o objects/process.o objects/timer.o objects/kernel.o objects/model2/framebuffer.o objects/stdlib.o objects/process_asm.o objects/interrupt_vector.o objects/boot.o objects/lock_asm.o /mnt/c/users/andre/desktop/custom_rpi_os/gcc-arm-10.2-2020.11-x86_64-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: objects/model2/framebuffer.o:/mnt/c/Users/andre/desktop/custom_rpi_os/raspi-kernel-master/build/../include/kernel/framebuffer.h:20: multiple definition of `fbinfo'; objects/gpu.o:/mnt/c/Users/andre/desktop/custom_rpi_os/raspi-kernel-master/build/../include/kernel/framebuffer.h:20: first defined here collect2: error: ld returned 1 exit status make: *** [Makefile:39: build] Error 1

How can I fix this issue?

(I am on Ubuntu WSL)

MEMESCOEP commented 3 years ago

wslberr here is a screenshot

jsandler18 commented 3 years ago

I'm not sure. It's hard to say just from the error message alone, but it seems to be an error in the code. It says that fbinfo is defined multiple times. I am not sure why it would say that if you just downloaded my code but if you made modification or wrote it yourself this could have happened on accident.

On Fri, Dec 18, 2020, 11:55 AM xxxMEMESCOEPxxx notifications@github.com wrote:

[image: wslberr] https://user-images.githubusercontent.com/67339620/102639973-cfc11680-4127-11eb-9c33-8995b63f213c.png here is a screenshot

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jsandler18/raspi-kernel/issues/25#issuecomment-748202599, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACDKDYWV66JKSF65UBQDRETSVOCO3ANCNFSM4VBNRBNQ .

InsaneMiner commented 3 years ago

I am having the same issue

yogirajh007 commented 3 years ago

I cloned the repository, and still I am getting this error, without changing any code. Any solution?

jherrin6 commented 3 years ago

I ran into the same issue. I worked around it by removing the following line from include/kernel/framebuffer.h framebuffer_info_t fbinfo;

I then added that line to src/kernel/model2/framebuffer.c, right before the first function

Then in src/kernel/gpu.c I added the following line before the first function: extern framebuffer_info_t fbinfo;

I'm not sure why the variable was being created in the header file, but it was probably for a reason i just don't understand. Anyway, this worked for me.

OmieSawie commented 2 months ago

This might occur as you have not mentioned your CPU in "make", I am assuming that this might be your issue. Try doing: make -mcpu = cortex-a7

along with other variables if necessary