Skip to content

Build Error with clang20 Because Compiler flag -c Clashes with -E #925

@scratch-er

Description

@scratch-er

Describe the bug

When building riscv64-nemu-interpreter with clang20, there are compiler errors because -c and -E is specified in the same command line in

@$(CC) $(CFLAGS) -E $(SO_CFLAGS) -c -o $@.c $<

To Reproduce

The toolchain used to build NEMU is clang20 from the package manager of Arch Linux.

Configure NEMU with defualt configs, except architecture is set to riscv64 and the compiler is set to clang. And then run make.

Expected behavior

The project should build currently.

Error log or Screenshots

clang: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument]
make: *** [/home/scratcher/Workspace/NEMU/scripts/build.mk:61: /home/scratcher/Workspace/NEMU/build/obj-riscv64-nemu-interpreter/src/isa/riscv64/instr/decode.o] Error 1

Necessary information on versions

  • NEMU version: master branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions