跳过不兼容的目录 - gcc 链接器

问题描述 投票:0回答:1

我遇到了一个 makefile 问题。惠特海湾合作委员会。

gcc -m32 -nostdlib -nodefaultlibs -lgcc start.o kernel.o -T linker.ld -omyos
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/11/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc: No such file or directory
collect2: error: ld returned 1 exit status
make: \*\*\* \[makefile:14: myos\] Error 1
CC=gcc
TARGET=myos
C_FILES=./kernel.c
OBJS=$(C_FILES:.c=.o)

all compile:$(TARGET)
all:finale
.PHONY:all compile clean finale

%.o:
    $(CC) -c $(@:.o=.c) -o $@ -ffreestanding -fno-exceptions -m32
$(TARGET):$(OBJS)
    $(shell nasm -f elf start.asm -o start.o)
    $(CC) -m32 -nostdlib -nodefaultlibs -lgcc start.o $? -T linker.ld -o$(TARGET)
finale:
    $(shell cd~/my_os/)
    $(shell cp$(TARGET) ./iso/boot/$(TARGET))
    $(shell grub2-mkresceu iso --output$(TARGET).iso)

clean:
    rm -f *.o(TARGET) $(TARGET).iso
    find .-name \*.o | xargs --no-run-if-empty rm

构建 s=make 文件脚本。制作 gcc 文件链接到 iso

c++ gcc makefile nasm linker-errors
1个回答
0
投票
sudo apt-get install gcc-multilib g++-multilib

问题很软

© www.soinside.com 2019 - 2024. All rights reserved.