Skip to content

Fixed makefile and run.sh error that prevents them from being run.#1

Open
0xsiren wants to merge 2 commits into
xeome:masterfrom
0xsiren:slopren
Open

Fixed makefile and run.sh error that prevents them from being run.#1
0xsiren wants to merge 2 commits into
xeome:masterfrom
0xsiren:slopren

Conversation

@0xsiren

@0xsiren 0xsiren commented Jun 16, 2026

Copy link
Copy Markdown

makefile

When compiling a fresh project you're met with this error:

    clang -std=c11 -O2 -g3 -Wall -Wextra --target=riscv32 -ffreestanding -nostdlib -I include -Wl,-Tuser.ld -o build/shell.elf user/shell.c user/user.c kernel/common.c
    /usr/bin/ld: unrecognised emulation mode: elf32lriscv
    Supported emulations: elf_x86_64 elf_i386 elf32_x86_64 elf_iamcu i386pep i386pe elf64bpf
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [Makefile:30: build/shell.bin.o] Error 1

clang fails to find elf32lriscv emulation mode because it defaults to GNU ld during linking.
To fix that we must force it to use lld like specified in the dependencies using -fuse-ld=lld in the CFLAGS

run.sh

when running we're given with this error:

qemu-system-riscv32: -drive id=drive0,file=disk.tar,format=raw: Drive 'drive0' is already in use because it has been automatically connected to another device (did you need 'if=none' in the drive options?)

To fix that I just did as it said and added if=none to the drive config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant