Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Mar 2019 21:10:35 -0400
From:      Dennis Clarke <dclarke@blastwave.org>
To:        Mitchell Horne <mhorne063@gmail.com>
Cc:        freebsd-riscv@freebsd.org
Subject:   Re: wiki pages https://wiki.freebsd.org/riscv wrong
Message-ID:  <cf73ab37-7a39-be3e-dd7d-9a64b58c60fe@blastwave.org>
In-Reply-To: <CADeAsy3gzLdG4HYT4pvUV1hPDHb=7aJEEk6wodmUp_C6rsWctA@mail.gmail.com>
References:  <eaf0c690-cca7-f88f-7c3a-3e23964ffd61@blastwave.org> <20190224212643.GA67845@bsdpad.com> <CAPn%2BtrHWmuqD=iek0DxO-co7K3Djva_EJart9Xg=DQiO4CZQgQ@mail.gmail.com> <4b5341ca-b1f5-a9c5-bdda-0204d37703ae@blastwave.org> <20190312170103.GA9714@bsdpad.com> <2848569d-68e4-df5f-9d0f-7e96933450ca@blastwave.org> <20190313170129.GA25163@bsdpad.com> <eea1b11f-10aa-2112-12d0-b5934361037c@blastwave.org> <fdecd0e0-1c24-a2a4-239a-2c713f43fb5d@blastwave.org> <CADeAsy3gzLdG4HYT4pvUV1hPDHb=7aJEEk6wodmUp_C6rsWctA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3/13/19 9:59 PM, Mitchell Horne wrote:
> On Wed, Mar 13, 2019 at 8:18 PM Dennis Clarke <dclarke@blastwave.org> wrote:
>>
>> there sems to be no one home in irc.
>>
>> freenode
>>  #freebsd-riscv
>>
> It's usually pretty quiet in there. If you post questions you might need to wait
> a little while for a response but usually someone will try to help.
> 

Since the last email ( a day? ) I have tried an experiment with building
the toolchain as advertised on the main RISC-V github page and that went
very smoothly.  As a regular user :

dclarke@vesta$ uname -a
FreeBSD vesta 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC  amd64
dclarke@vesta$ pwd
/home/dclarke
dclarke@vesta$ id
uid=16411(dclarke) gid=20002(devl) groups=20002(devl),20(staff),20002(devl)
dclarke@vesta$

dclarke@vesta$ git clone https://github.com/riscv/riscv-gnu-toolchain
Cloning into 'riscv-gnu-toolchain'...
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 6997 (delta 11), reused 11 (delta 6), pack-reused 6977
Receiving objects: 100% (6997/6997), 4.42 MiB | 5.27 MiB/s, done.
Resolving deltas: 100% (3402/3402), done.
dclarke@vesta$

dclarke@vesta$ cd riscv-gnu-toolchain
dclarke@vesta$
dclarke@vesta$ git submodule update --init --recursive
Submodule 'riscv-binutils'
(https://github.com/riscv/riscv-binutils-gdb.git) registered for path
'riscv-binutils'
Submodule 'riscv-dejagnu' (https://github.com/riscv/riscv-dejagnu.git)
registered for path 'riscv-dejagnu'
Submodule 'riscv-gcc' (https://github.com/riscv/riscv-gcc.git)
registered for path 'riscv-gcc'
Submodule 'riscv-gdb' (https://github.com/riscv/riscv-binutils-gdb.git)
registered for path 'riscv-gdb'
Submodule 'riscv-glibc' (https://github.com/riscv/riscv-glibc.git)
registered for path 'riscv-glibc'
Submodule 'riscv-newlib' (https://github.com/riscv/riscv-newlib.git)
registered for path 'riscv-newlib'
Submodule 'riscv-qemu' (https://github.com/riscv/riscv-qemu.git)
registered for path 'riscv-qemu'
Cloning into '/usr/home/dclarke/riscv-gnu-toolchain/riscv-binutils'...
Cloning into '/usr/home/dclarke/riscv-gnu-toolchain/riscv-dejagnu'...
.
.
.
Submodule path 'riscv-qemu/roms/u-boot': checked out
'2072e7262965bb48d7fffb1e283101e6ed8b21a8'
Submodule path 'riscv-qemu/roms/vgabios': checked out
'19ea12c230ded95928ecaef0db47a82231c2e485'
dclarke@vesta$

With PREFIX=/home/dclarke/riscv the build went perfect smooth.

Minor snag was that you must have libexpat around :

dclarke@vesta$ ls -lapbtr /usr/local/lib/libexpat*
-rwxr-xr-x  1 root  wheel  177688 Mar 15 05:54
/usr/local/lib/libexpat.so.1.6.8
lrwxr-xr-x  1 root  wheel      17 Mar 15 05:54
/usr/local/lib/libexpat.so.1 -> libexpat.so.1.6.8
lrwxr-xr-x  1 root  wheel      17 Mar 15 05:54
/usr/local/lib/libexpat.so -> libexpat.so.1.6.8
-rw-r--r--  1 root  wheel  345298 Mar 15 05:54 /usr/local/lib/libexpat.a
dclarke@vesta$ ls -lapbtr /usr/local/include/expat*
-rw-r--r--  1 root  wheel   3514 Mar 15 05:54
/usr/local/include/expat_config.h
-rw-r--r--  1 root  wheel  43513 Mar 15 05:54 /usr/local/include/expat.h
-rw-r--r--  1 root  wheel   5532 Mar 15 05:54
/usr/local/include/expat_external.h

The result is a good looking cross compiler :

dclarke@vesta$ $PREFIX/bin/riscv64-unknown-elf-gcc-8.3.0 --version
riscv64-unknown-elf-gcc-8.3.0 (GCC) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

dclarke@vesta$ $PREFIX/bin/riscv64-unknown-elf-gcc-8.3.0 -v
Using built-in specs.
COLLECT_GCC=/home/dclarke/riscv/bin/riscv64-unknown-elf-gcc-8.3.0
COLLECT_LTO_WRAPPER=/usr/home/dclarke/riscv/bin/../libexec/gcc/riscv64-unknown-elf/8.3.0/lto-wrapper
Target: riscv64-unknown-elf
Configured with: /home/dclarke/riscv-gnu-toolchain/riscv-gcc/configure
--target=riscv64-unknown-elf --prefix=/home/dclarke/riscv
--disable-shared --disable-threads --enable-languages=c,c++
--with-system-zlib --enable-tls --with-newlib
--with-sysroot=/home/dclarke/riscv/riscv64-unknown-elf
--with-native-system-header-dir=/include --disable-libmudflap
--disable-libssp --disable-libquadmath --disable-libgomp --disable-nls
--src=.././riscv-gcc --enable-checking=yes --disable-multilib
--with-abi=lp64d --with-arch=rv64imafdc --with-tune=rocket
'CFLAGS_FOR_TARGET=-Os  -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-Os
-mcmodel=medlow'
Thread model: single
gcc version 8.3.0 (GCC)
dclarke@vesta$


Someone in the irc claims the this compiler won't work from FreeBSD but
thus far my only snag has been trying to build 'CURRENT' with it and
hitting :

/home/dclarke/riscv/bin/riscv64-unknown-elf-gcc
--sysroot=/home/dclarke/obj//usr/home/dclarke/freebsd-riscv/riscv.riscv64/tmp
-B/home/dclarke/riscv/bin  -O2 -pipe -march=rv64imafdc -mabi=lp64d
-fpic -fvisibility=hidden -DVISIBILITY_HIDDEN
-I/usr/home/dclarke/freebsd-riscv/contrib/libcxxrt -g -MD
-MF.depend.enable_execute_stack.o -MTenable_execute_stack.o -std=gnu99
-fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k
-Wno-uninitialized -Wno-pointer-sign -Wno-error=address
-Wno-error=array-bounds -Wno-error=attributes -Wno-error=bool-compare
-Wno-error=cast-align -Wno-error=clobbered -Wno-error=enum-compare
-Wno-error=extra -Wno-error=inline -Wno-error=logical-not-parentheses
-Wno-error=strict-aliasing -Wno-error=uninitialized
-Wno-error=unused-but-set-variable -Wno-error=unused-function
-Wno-error=unused-value -Wno-error=misleading-indentation
-Wno-error=nonnull-compare -Wno-error=shift-negative-value
-Wno-error=tautological-compare -Wno-error=unused-const-variable
-Wno-error=bool-operation -Wno-error=deprecated
-Wno-error=expansion-to-defined -Wno-error=format-overflow
-Wno-error=format-truncation -Wno-error=implicit-fallthrough
-Wno-error=int-in-bool-context -Wno-error=memset-elt-size
-Wno-error=noexcept-type -Wno-error=nonnull -Wno-error=pointer-compare
-Wno-error=stringop-overflow -Wno-error=aggressive-loop-optimizations
-Wno-error=cast-function-type -Wno-error=catch-value
-Wno-error=multistatement-macros -Wno-error=restrict
-Wno-error=sizeof-pointer-memaccess -Wno-error=stringop-truncation
-c
/usr/home/dclarke/freebsd-riscv/contrib/compiler-rt/lib/builtins/enable_execute_stack.c
-o enable_execute_stack.o
/usr/home/dclarke/freebsd-riscv/contrib/compiler-rt/lib/builtins/enable_execute_stack.c:14:10:
fatal error: sys/mman.h: No such file or directory
 #include <sys/mman.h>
          ^~~~~~~~~~~~
compilation terminated.
*** Error code 1

Stop.
make[4]: stopped in /usr/home/dclarke/freebsd-riscv/lib/libcompiler_rt
*** Error code 1

Stop.
make[3]: stopped in /usr/home/dclarke/freebsd-riscv
*** Error code 1

Stop.
make[2]: stopped in /usr/home/dclarke/freebsd-riscv
*** Error code 1

Stop.
make[1]: stopped in /usr/home/dclarke/freebsd-riscv
*** Error code 1

Stop.
make: stopped in /usr/home/dclarke/freebsd-riscv
dclarke@vesta$

So that is curious.

Regardless I have yet to arrive at a repeatable process that builds a
qemu image.

Dennis



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cf73ab37-7a39-be3e-dd7d-9a64b58c60fe>