You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by PEIJIE LI <li...@berkeley.edu> on 2018/11/01 00:30:08 UTC

Setting up RISC-V toolchain for Linux

Hi,
    I am trying to set up RISC-V as the toolchain on a Linux system. But I am getting an error saying "sys/mman.h: No such file or director”. Here is what I did:
    1. I installed newt by following the instructions on “Installing Newt on Linux”
    2. I then modified the <mynewt-src-directory>/repos/apache-mynewt-core/compiler/sim/compiler.yml file to change the default gcc-5 to riscv64-unknown-elf-gcc. 
    3. I ran newt test @apache-mynewt-core/sys/config
    The full error message is 
    hw/bsp/native/src/sbrk.c:20:10: fatal error: sys/mman.h: No such file or directory
    #include <sys/mman.h>
          ^~~~~~~~~~~~
    compilation terminated.
    Error: Test failure(s):
    Passed tests: []
    Failed tests: [sys/config/test-fcb sys/config/test-nffs]

    And all tests passed before I changed the compiler.yml file.
    The error messages is saying there is a missing file, but I don’t really know how I can fix it. I don’t have much experience in doing this, so any advice will be helpful!
    Thank you very much!
    Best,
    Peijie

Re: Setting up RISC-V toolchain for Linux

Posted by Fabio Utzig <ut...@apache.org>.
On Wed, Nov 7, 2018, at 8:04 PM, PEIJIE LI wrote:
> Hi Andrey:
>     Thank you for your help.
>     I switched to use the risvc64 package. Yet I am still seeing the
> missing sys/mman.h error.
>     I tried installing gcc-multilib, build-essential, libc6-dev but none of
> them solves the problem.
>     Any idea on what I should do to fix this?

To build for RISC-V you only need binutils + gcc (riscv64).

The errors you get when running `newt test ...` are because the tests run on a simulated environment. You need gcc-multilib and a 32-bit libc-dev. Not sure which distro you use, but installing `libc6-dev`on a 64-bit distr installs only the 64-bit libc. To get 32-bit, for Ubuntu you would need to install like this: `apt-get install linux-libc-dev:i386 `. Or just search with your package manager for something like "libc-dev-i386".

Re: Setting up RISC-V toolchain for Linux

Posted by Andrey Serdtsev <an...@yotadevices.com>.
Should be in place. Possibly some problems with glibc for riscv64 installation.


On 08.11.2018 1:04, PEIJIE LI wrote:
Hi Andrey:
    Thank you for your help.
    I switched to use the risvc64 package. Yet I am still seeing the missing sys/mman.h error.
    I tried installing gcc-multilib, build-essential, libc6-dev but none of them solves the problem.
    Any idea on what I should do to fix this?

    Thanks!
    Best,
    Peijie


On Thu, Nov 1, 2018 at 1:05 AM Andrey Serdtsev <an...@yotadevices.com>> wrote:
There is riscv64 package in compiler folder. Why not to try it?
Just change 'bsp.compiler' value in your bsp.yml.


On 01.11.2018 3:30, PEIJIE LI wrote:
> Hi,
>      I am trying to set up RISC-V as the toolchain on a Linux system. But I am getting an error saying "sys/mman.h: No such file or director”. Here is what I did:
>      1. I installed newt by following the instructions on “Installing Newt on Linux”
>      2. I then modified the <mynewt-src-directory>/repos/apache-mynewt-core/compiler/sim/compiler.yml file to change the default gcc-5 to riscv64-unknown-elf-gcc.
>      3. I ran newt test @apache-mynewt-core/sys/config
>      The full error message is
>      hw/bsp/native/src/sbrk.c:20:10: fatal error: sys/mman.h: No such file or directory
>      #include <sys/mman.h>
>            ^~~~~~~~~~~~
>      compilation terminated.
>      Error: Test failure(s):
>      Passed tests: []
>      Failed tests: [sys/config/test-fcb sys/config/test-nffs]
>
>      And all tests passed before I changed the compiler.yml file.
>      The error messages is saying there is a missing file, but I don’t really know how I can fix it. I don’t have much experience in doing this, so any advice will be helpful!
>      Thank you very much!
>      Best,
>      Peijie

Re: Setting up RISC-V toolchain for Linux

Posted by PEIJIE LI <li...@berkeley.edu>.
Hi Andrey:
    Thank you for your help.
    I switched to use the risvc64 package. Yet I am still seeing the
missing sys/mman.h error.
    I tried installing gcc-multilib, build-essential, libc6-dev but none of
them solves the problem.
    Any idea on what I should do to fix this?

    Thanks!
    Best,
    Peijie


On Thu, Nov 1, 2018 at 1:05 AM Andrey Serdtsev <
andrey.serdtsev@yotadevices.com> wrote:

> There is riscv64 package in compiler folder. Why not to try it?
> Just change 'bsp.compiler' value in your bsp.yml.
>
>
> On 01.11.2018 3:30, PEIJIE LI wrote:
> > Hi,
> >      I am trying to set up RISC-V as the toolchain on a Linux system.
> But I am getting an error saying "sys/mman.h: No such file or director”.
> Here is what I did:
> >      1. I installed newt by following the instructions on “Installing
> Newt on Linux”
> >      2. I then modified the
> <mynewt-src-directory>/repos/apache-mynewt-core/compiler/sim/compiler.yml
> file to change the default gcc-5 to riscv64-unknown-elf-gcc.
> >      3. I ran newt test @apache-mynewt-core/sys/config
> >      The full error message is
> >      hw/bsp/native/src/sbrk.c:20:10: fatal error: sys/mman.h: No such
> file or directory
> >      #include <sys/mman.h>
> >            ^~~~~~~~~~~~
> >      compilation terminated.
> >      Error: Test failure(s):
> >      Passed tests: []
> >      Failed tests: [sys/config/test-fcb sys/config/test-nffs]
> >
> >      And all tests passed before I changed the compiler.yml file.
> >      The error messages is saying there is a missing file, but I don’t
> really know how I can fix it. I don’t have much experience in doing this,
> so any advice will be helpful!
> >      Thank you very much!
> >      Best,
> >      Peijie
>

Re: Setting up RISC-V toolchain for Linux

Posted by Andrey Serdtsev <an...@yotadevices.com>.
There is riscv64 package in compiler folder. Why not to try it?
Just change 'bsp.compiler' value in your bsp.yml.


On 01.11.2018 3:30, PEIJIE LI wrote:
> Hi,
>      I am trying to set up RISC-V as the toolchain on a Linux system. But I am getting an error saying "sys/mman.h: No such file or director”. Here is what I did:
>      1. I installed newt by following the instructions on “Installing Newt on Linux”
>      2. I then modified the <mynewt-src-directory>/repos/apache-mynewt-core/compiler/sim/compiler.yml file to change the default gcc-5 to riscv64-unknown-elf-gcc.
>      3. I ran newt test @apache-mynewt-core/sys/config
>      The full error message is
>      hw/bsp/native/src/sbrk.c:20:10: fatal error: sys/mman.h: No such file or directory
>      #include <sys/mman.h>
>            ^~~~~~~~~~~~
>      compilation terminated.
>      Error: Test failure(s):
>      Passed tests: []
>      Failed tests: [sys/config/test-fcb sys/config/test-nffs]
>
>      And all tests passed before I changed the compiler.yml file.
>      The error messages is saying there is a missing file, but I don’t really know how I can fix it. I don’t have much experience in doing this, so any advice will be helpful!
>      Thank you very much!
>      Best,
>      Peijie