Package: gcc-riscv64-unknown-elf
Version: 8.3.0.2019.08+dfsg-1
Severity: normal

Dear Maintainer,

I am trying to use the riscv toolchain to build a bare metal
application. It appears to have a broken stdint.h:

$ cat test.c
#include <stdint.h>
$ riscv64-unknown-elf-gcc -E   -march=rv32i      -mabi=ilp32  -c test.c
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.c"
# 1 "/usr/lib/gcc/riscv64-unknown-elf/8.3.0/include/stdint.h" 1 3 4
In file included from test.c:1:
/usr/lib/gcc/riscv64-unknown-elf/8.3.0/include/stdint.h:9:16: fatal error: 
stdint.h: No such file or directory
 # include_next <stdint.h>
                ^~~~~~~~~~

$ cat /usr/lib/gcc/riscv64-unknown-elf/8.3.0/include/stdint.h
#ifndef _GCC_WRAP_STDINT_H
#if __STDC_HOSTED__
# if defined __cplusplus && __cplusplus >= 201103L
#  undef __STDC_LIMIT_MACROS
#  define __STDC_LIMIT_MACROS
#  undef __STDC_CONSTANT_MACROS
#  define __STDC_CONSTANT_MACROS
# endif
# include_next <stdint.h>
#else
# include "stdint-gcc.h"
#endif
#define _GCC_WRAP_STDINT_H
#endif

$ riscv64-unknown-elf-gcc -E   -march=rv32i      -mabi=ilp32 -dM -nostdlib - < 
/dev/null |grep STDC_HOSTED
#define __STDC_HOSTED__ 1

stdint-gcc.h is a "real" stdint.h, containing the definitions I want.
I'm not sure how a user is supposed to tell the toolchain to use that
instead, if they can at all.

Comparing it to Debian's arm bare metal toolchain:

$ dpkg -L gcc-arm-none-eabi |grep stdint
/usr/lib/gcc/arm-none-eabi/8.3.1/include/stdint.h
/usr/lib/gcc/arm-none-eabi/8.3.1/plugin/include/config/newlib-stdint.h

The stdint.h here is equivalent to the riscv stdint-gcc.h, so the test
program compiles in that case.

Is this something that can be fixed with the riscv toolchain? Or is it
user error on my part?

-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (900, 'testing'), (300, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-1-amd64 (SMP w/8 CPU threads)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_AU:en
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)
LSM: SELinux: enabled - Mode: Permissive - Policy name: default

Versions of packages gcc-riscv64-unknown-elf depends on:
ii  binutils-riscv64-unknown-elf  2.32.2020.04+dfsg-2
ii  libc6                         2.31-6
ii  libgcc-s1 [libgcc1]           10.2.1-3
ii  libgmp10                      2:6.2.1+dfsg-1
ii  libmpc3                       1.2.0-1
ii  libmpfr6                      4.1.0-3
ii  libstdc++6                    10.2.1-3
ii  zlib1g                        1:1.2.11.dfsg-2

gcc-riscv64-unknown-elf recommends no packages.

gcc-riscv64-unknown-elf suggests no packages.

-- no debconf information

Reply via email to