Upstream risc-v gdb

700 views
Skip to first unread message

Ben Horgan

unread,
Jan 6, 2017, 9:06:00 AM1/6/17
to sw-...@groups.riscv.org

Hi,

 

I’m trying to build gdb for risc-v from the upstream repository but it is failing with

=== configuring in build-gnulib

…<snip>

configure: error: configuration riscv32-unknown-elf is unsupported.

 

Is this expected to work? Am I missing a configure option? Is there anywhere I can download the binaries from test builds or see which revisions should work? Ultimately I would like a windows build but thought it was best to try and get it working on linux first. I am looking for gdb 7.12 with risc-v support.

 

I am running on CentOS

The top of my git log is

commit ac10a93e27993cf25cd2116227b12735d6481797

Author: GDB Administrator <gdba...@sourceware.org>

Date:   Fri Jan 6 00:00:25 2017 +0000

 

    Automatic date update in version.in

git clone git://sourceware.org/git/binutils-gdb.git

My steps are:

export TARGET=riscv32-unknown-elf

export PREFIX=/ust/work/bhorgan/riscv/riscv32-unknown-elf

export PATH=$PREFIX/bin:$PATH

../binutils-gdb/configure --target=$TARGET --prefix=$PREFIX --disable-werror --disable-soft-float --disable-nls

make all

 

Thanks

 

Ben

 

Palmer Dabbelt

unread,
Jan 6, 2017, 1:29:59 PM1/6/17
to ben.h...@ultrasoc.com, sw-...@groups.riscv.org
Have you tried riscv-gnu-toolchain?

https://github.com/riscv/riscv-gnu-toolchain

This is how we build the tools. It works on all the machines I have access
to (Ubuntu and Gentoo). I haven't built it on Red Hat in a few months, but it
used to work fine. IIRC Red Hat is on GCC-4.4, which is way too old. I used
devtoolset-2 to get a newer GCC.

On Fri, 06 Jan 2017 06:05:43 PST (-0800), ben.h...@ultrasoc.com wrote:
> Hi,
>
> I'm trying to build gdb for risc-v from the upstream repository but it is failing with
> === configuring in build-gnulib
> ...<snip>
> configure: error: configuration riscv32-unknown-elf is unsupported.
>
> Is this expected to work? Am I missing a configure option? Is there anywhere I can download the binaries from test builds or see which revisions should work? Ultimately I would like a windows build but thought it was best to try and get it working on linux first. I am looking for gdb 7.12 with risc-v support.
>
> I am running on CentOS
> The top of my git log is
> commit ac10a93e27993cf25cd2116227b12735d6481797
> Author: GDB Administrator <gdba...@sourceware.org>
> Date: Fri Jan 6 00:00:25 2017 +0000
>
> Automatic date update in version.in
> git clone git://sourceware.org/git/binutils-gdb.git
> My steps are:
> export TARGET=riscv32-unknown-elf
> export PREFIX=/ust/work/bhorgan/riscv/riscv32-unknown-elf
> export PATH=$PREFIX/bin:$PATH
> ../binutils-gdb/configure --target=$TARGET --prefix=$PREFIX --disable-werror --disable-soft-float --disable-nls
> make all
>
> Thanks
>
> Ben
>
> --
> You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
> To post to this group, send email to sw-...@groups.riscv.org.
> Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
> To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/39374d7a294a4f0fa41e2eab7f190e96%40THHSTE15D1BE1.hs20.net.

Michael Clark

unread,
Jan 6, 2017, 5:39:14 PM1/6/17
to Palmer Dabbelt, ben.h...@ultrasoc.com, sw-...@groups.riscv.org

> On 7 Jan 2017, at 7:29 AM, Palmer Dabbelt <palmer....@eecs.berkeley.edu> wrote:
>
> Have you tried riscv-gnu-toolchain?
>
> https://github.com/riscv/riscv-gnu-toolchain
>
> This is how we build the tools. It works on all the machines I have access
> to (Ubuntu and Gentoo). I haven't built it on Red Hat in a few months, but it
> used to work fine. IIRC Red Hat is on GCC-4.4, which is way too old. I used
> devtoolset-2 to get a newer GCC.


Just another data point. The “riscv-unknown-elf” toolchain build from that repo most of the time works fine on Darwin/macOS too (Clang ~4.0).

I have not yet tried building the “riscv-unknown-linux-gnu” Linux toolchain on macOS yet, but riscv-linux kernel builds with the “riscv-unknown-elf” toolchain /surprisingly/ also work on macOS (by adding an elf.h to the header search path and installing ncurses library for menuconfig).

I’m using macOS as my primary development platform but run toolchain build tests from time to time on Debian Stretch (gcc 6.2.1)…
> To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/mhng-1d73e8c7-10df-4e3a-a24b-e1d56edbb3aa%40palmer-mbp2014.

Mike Frysinger

unread,
Jan 6, 2017, 6:37:22 PM1/6/17
to Michael Clark, Palmer Dabbelt, ben.h...@ultrasoc.com, sw-...@groups.riscv.org

the kernel build doesn't care about the tuple, so riscv-linux-gnu or riscv-elf should be fine
-mike


--

-mike

Michael Clark

unread,
Jan 6, 2017, 7:37:53 PM1/6/17
to Mike Frysinger, Palmer Dabbelt, ben.h...@ultrasoc.com, sw-...@groups.riscv.org
Makes sense. I have always used riscv-elf on Darwin as I haven’t tried building the linux toolchain there, yet. I guess it compiles with -nostartfiles or similar as it doesn’t depend on libc. However I needed the linux toolchain to build Busybox.

The one thing I haven’t yet tried on Darwin is “make linux” in riscv-gnu-toolchain. “Theoretically it should work.”

Ben Horgan

unread,
Jan 9, 2017, 10:27:50 AM1/9/17
to Michael Clark, Mike Frysinger, Palmer Dabbelt, sw-...@groups.riscv.org

Thanks for the info. I can confirm that I can now build riscv gdb on centos using gcc 4.9 and on windows msys 2 both using the repo https://github.com/riscv/riscv-gnu-toolchain.

 

FYI, On mys2 I use:  (TARGET=riscv 32-unknown-elf)

$ ../riscv-binutils-gdb/configure --target=$TARGET --prefix=$PREFIX --disable-werror --disable-soft-float --disable-nls --host=x86_64-w64-mingw32 --build=x86_64-pc-msys2

 

Thanks

 

Ben

ganson

unread,
Mar 24, 2017, 2:13:38 AM3/24/17
to RISC-V SW Dev, ben.h...@ultrasoc.com
Dear,

I tried MSYS2 MinGW 64-bit. and follow your command steps

=================

git submodule update --init --recursive

export TARGET=riscv32-unknown-elf

export PREFIX=/home/mfdu/work/riscv/riscv32-unknown-elf

export PATH=$PREFIX/bin:$PATH

cd riscv-binutils-gdb/

./configure --target=$TARGET --prefix=$PREFIX --disable-werror --disable-soft-float --disable-nls --host=x86_64-w64-mingw32 --build=x86_64-pc-msys2

make all

==============
after command "make all"

I got these messages ......

make[2]: x86_64-w64-mingw32-ar: Command not found
make[2]: *** [Makefile:250: libiberty.a] Error 127
make[2]: Leaving directory '/home/mfdu/riscv-gnu-toolchain/riscv-binutils-gdb/libiberty'
make[1]: *** [Makefile:8341: all-libiberty] Error 2
make[1]: Leaving directory '/home/mfdu/riscv-gnu-toolchain/riscv-binutils-gdb'
make: *** [Makefile:857: all] Error 2

=========

I can't build successfully.

should I do something else or miss somthing?

thanks a lot.





在 2017年1月9日星期一 UTC+8下午11:27:50,Ben Horgan写道:

>> To post to this group, send email to sw...@groups.riscv.org.


>> Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
>> To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/39374d7a294a4f0fa41e2eab7f190e96%40THHSTE15D1BE1.hs20.net.
>
> --
> You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.

> To post to this group, send email to sw...@groups.riscv.org.


> Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
> To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/mhng-1d73e8c7-10df-4e3a-a24b-e1d56edbb3aa%40palmer-mbp2014.

--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.

To post to this group, send email to sw...@groups.riscv.org.

--

-mike

 

Tommy Murphy

unread,
Mar 24, 2017, 5:40:33 AM3/24/17
to RISC-V SW Dev, ben.h...@ultrasoc.com
Are you trying to build Windows 32 or 64 bit RISC-V tools?
Are you trying to build RISC-V 32 or 64 tools?
Are you using an MSYS2 MinGW 32-bit or MinGW 64-bit command shell?
Last time I built using MSYS2 this worked (I was building tools for rv32im as Windows 32 bit executables):

./configure --prefix=`pwd`/riscv32-unknown-elf-gcc --with-arch=rv32im --host=i686-w64-mingw32

Ben Horgan

unread,
Mar 24, 2017, 1:46:20 PM3/24/17
to ganson, RISC-V SW Dev

Hi,

 

I think the make[2]: x86_64-w64-mingw32-ar: Command not found

error is caused by a mismatch in naming. To work around this I did:

cp /mingw64/bin/x86_64-w64-mingw32-gcc-ar.exe x86_64-w64-mingw32-ar.exe

 

However, I can’t currently build the riscv gdb because of the error:

undefined reference to `ada_yylex()'. This looks like https://sourceware.org/bugzilla/show_bug.cgi?id=21057

 

For reference, my msys2 setup is:

cmd.exe /c msys2_shell.cmd -mingw64 -mintty

$ pacman -S msys/make

$ pacman -S msys/mpc msys/mpc-devel

$ pacman -S msys/patch

$ pacman -S msys/svn

$ pacman -S msys/tar

$ pacman -S msys/gcc

$ pacman -S mingw-w64-x86_64-gcc
$ pacman -S msys/diffutils #for cmp
$ pacman -S msys/texinfo # for makinfo
$ pacman -S msys/bison
$ cp /mingw64/bin/x86_64-w64-mingw32-gcc-ar.exe x86_64-w64-mingw32-ar.exe
$ cp /mingw64/bin/x86_64-w64-mingw32-gcc-ranlib.exe x86_64-w64-mingw32-ranlib.exe
$ cp /mingw64/bin/x86_64-w64-mingw32-gcc-nm.exe x86_64-w64-mingw32-nm.exe

 

Thanks

 

Ben

To post to this group, send email to sw-...@groups.riscv.org.

Tommy Murphy

unread,
Mar 24, 2017, 2:09:25 PM3/24/17
to RISC-V SW Dev, maof...@gmail.com, ben.h...@ultrasoc.com
I'm surprised that you're having to hack things like that (copying/renaming tools) as I didn't have to do that.
The yylex issue is due to the latest flex on MSYS2 having a bug.
I had to manually roll back to an earlier version.
I had to Google for older packages for MSYS2, uninstall the latest flex and install the most recent previous version.

Ben Horgan

unread,
Mar 27, 2017, 7:48:49 AM3/27/17
to Tommy Murphy, RISC-V SW Dev, maof...@gmail.com

Thanks Tommy, gdb now builds for me. I used flex 2.6.0 built using the script at https://github.com/Alexpux/MSYS2-packages/commit/31e92a3e5cc5342643981e4ab25a9e93244cd6dd

 

Ben

 

From: Tommy Murphy [mailto:tommy_...@hotmail.com]
Sent: 24 March 2017 18:09
To: RISC-V SW Dev
Cc: maof...@gmail.com; Ben Horgan
Subject: Re: [sw-dev] Upstream risc-v gdb

 

I'm surprised that you're having to hack things like that (copying/renaming tools) as I didn't have to do that.

ganson

unread,
Mar 31, 2017, 1:34:52 AM3/31/17
to RISC-V SW Dev, tommy_...@hotmail.com, maof...@gmail.com, ben.h...@ultrasoc.com
Dear :

I use google to search this packet "flex-2.6.0-1-x86_64.pkg.tar.xz"

Now it build for me too. 

but it miss something.

actually I need the file  "riscv64-unknown-elf-gcc.exe"

following files in the bin folder

riscv64-unknown-elf-addr2line.exe
riscv64-unknown-elf-ar.exe
riscv64-unknown-elf-as.exe
riscv64-unknown-elf-c++filt.exe
riscv64-unknown-elf-elfedit.exe
riscv64-unknown-elf-gdb.exe
riscv64-unknown-elf-gprof.exe
riscv64-unknown-elf-ld.bfd.exe
riscv64-unknown-elf-ld.exe
riscv64-unknown-elf-nm.exe
riscv64-unknown-elf-objcopy.exe
riscv64-unknown-elf-objdump.exe
riscv64-unknown-elf-ranlib.exe
riscv64-unknown-elf-readelf.exe
riscv64-unknown-elf-run.exe
riscv64-unknown-elf-size.exe
riscv64-unknown-elf-strings.exe
riscv64-unknown-elf-strip.exe

How could I do to fix this problem?

Thanks a lot.

在 2017年3月27日星期一 UTC+8下午7:48:49,Ben Horgan写道:
Reply all
Reply to author
Forward
0 new messages