Skip to content

hello.c compilation error #39

Description

@nitish2112

I am having this issue while compiling hello.c. I tried the solution mentioned in the other issue as well. Please see the compilation results below:

PS: I noticed that I did not have riscv-elf folder in my /opt/riscv folder which has all the the standard libraries. What is wrong with the installation. I followed the steps here: https://riscv.org/software-tools/low-level-virtual-machine-llvm/

Compilation Results:
% clang -target riscv64 -mriscv=RV64IAMFD -S hello.c -o hello.S

gives:
In file included from hello.c:1:
In file included from /usr/include/stdio.h:27:
/usr/include/features.h:367:12: fatal error: 'sys/cdefs.h' file not found
#include
^
1 error generated.

% clang -target riscv -mriscv=RV64IAMFD -nostdinc -I/opt/riscv/riscv-elf/include -I/opt/riscv/lib/clang/3.9.0/include -S hello.c -o hello.S

gives:
hello.c:1:10: fatal error: 'stdio.h' file not found
#include
^
1 error generated.

and
% clang -target riscv64 -mriscv=RV64IAMFD -nostdinc -I/opt/riscv/riscv-elf/include -I/opt/riscv/lib/clang/3.9.0/include -S hello.c -o hello.S

gives:
hello.c:1:10: fatal error: 'stdio.h' file not found
#include
^
1 error generated.

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