sycuricon / riscv-spike-sdk

Run Linux on RISC-V Spike Simulator
MIT License
45 stars 18 forks source link

Potentially wrong version of GCC in toolchain installation #5

Closed rohuns closed 4 years ago

rohuns commented 4 years ago

Apologies in advance if this is a naive question; im new to this whole ecosystem. I was trying to make this project and am getting the following error with regards to the versioning of GCC associated with the build (it is looking for 9.X but is finding 10.1.0)

>>> skeleton-init-common  Installing to target                                                                                                                        
rsync -a --ignore-times --exclude .svn --exclude .git --exclude .hg --exclude .bzr --exclude CVS --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' system/skeleton/ 
/home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/target/                                                                                                           
/usr/bin/install -d -m 0755 /home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/target/bin                                                                            
/usr/bin/install -d -m 0755 /home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/target/sbin                                                                           
/usr/bin/install -d -m 0755 /home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/target/lib                                                                            
ln -snf lib /home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/target/lib64                                                                                          
ln -snf lib /home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/target/usr/lib64                                                                                      
/bin/sed -i -e 's,@PATH@,"/bin:/sbin:/usr/bin:/usr/sbin",' /home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/target/etc/profile                                     
/usr/bin/install -m 0644 support/misc/target-dir-warning.txt /home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM              
>>> skeleton-init-sysv  Extracting                                                                                                                                    
>>> skeleton-init-sysv  Patching                                                                                                                                      
>>> skeleton-init-sysv  Configuring                                                                                                                                   
>>> skeleton-init-sysv  Building                                                                                                                                      
>>> skeleton-init-sysv  Installing to target                                                                                                                          
rsync -a --ignore-times --exclude .svn --exclude .git --exclude .hg --exclude .bzr --exclude CVS --chmod=u=rwX,go=rX --exclude .empty --exclude '*~' package/skeleton-
init-sysv//skeleton/ /home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/target/                                                                                      
>>> skeleton  Extracting                                                                                                                                              
>>> skeleton  Patching                                                                                                                                                
>>> skeleton  Configuring                                                                                                                                             
>>> skeleton  Building                                                                                                                                                
>>> skeleton  Installing to target                                                                                                                                    
>>> toolchain-external-custom  Extracting                                                                                                                             
>>> toolchain-external-custom  Patching                                                                                                                               
>>> toolchain-external-custom  Configuring                                                                                                                            
Incorrect selection of gcc version: expected 9.x, got 10.1.0                                                                                                          
package/pkg-generic.mk:254: recipe for target '/home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/build/toolchain-external-custom/.stamp_configured' failed          
make[2]: *** [/home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/build/toolchain-external-custom/.stamp_configured] Error 1                                          
Makefile:84: recipe for target '_all' failed                                                                                                                          
make[1]: *** [_all] Error 2                                                                                                                                           
make[1]: Leaving directory '/home/ubuntu/riscv-rss-sdk/buildroot'                                                                                                     
Makefile:83: recipe for target '/home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/images/rootfs.tar' failed                                                         
make: *** [/home/ubuntu/riscv-rss-sdk/work/buildroot_initramfs/images/rootfs.tar] Error 2 

I was first under the impression that I had the wrong version of GCC, so updated that on my machine. However as I inspected the Makefile and the toolchain directory, I found toolchain/lib/gcc/riscv64-unknown-linux-gnu in which the stated version of GCC is 10.1.0 . I am not sure what the best course of action is to resolve this versioning issue

Phantom1003 commented 4 years ago

Sorry for that, I just simply upstream toolchain without checking ... The buildroot(2020.5.x) do not give the config option for gcc 10, but it is a simple version check, you can just delete the check codes ... I will upstream the buildroot as soon as the new version release

diff --git a/buildroot/toolchain/helpers.mk b/buildroot/toolchain/helpers.mk
index 17bc159f3e..e2d81d2c68 100644
--- a/buildroot/toolchain/helpers.mk
+++ b/buildroot/toolchain/helpers.mk
@@ -187,7 +187,6 @@ check_gcc_version = \
        if [[ ! "$${real_version}." =~ ^$${expected_version}\. ]] ; then \
                printf "Incorrect selection of gcc version: expected %s.x, got %s\n" \
                        "$${expected_version}" "$${real_version}" ; \
-               exit 1 ; \
        fi

I test on linux 5.7.y it works:

/home/phantom/test/riscv-rss-sdk/toolchain/bin/spike --isa=rv64imafdc -p4 /home/phantom/test/riscv-rss-sdk/work/riscv-pk/bbl
bbl loader

          RISC-V Spike Simulator SDK
      This SDK is based on SiFive Freedom U SDK.                    
          ___           ___           ___     
         /\  \         /\  \         /\  \    
        /  \  \       /  \  \       /  \  \   
       / /\ \  \     / /\ \  \     / /\ \  \  
      /  \~\ \  \   _\ \~\ \  \   _\ \~\ \  \ 
     / /\ \ \ \__\ /\ \ \ \ \__\ /\ \ \ \ \__\
     \/_|  \/ /  / \ \ \ \ \/__/ \ \ \ \ \/__/
        | |  /  /   \ \ \ \__\    \ \ \ \__\  
        | |\/__/     \ \/ /  /     \ \/ /  /  
        | |  |        \  /  /       \  /  /   
         \|__|         \/__/         \/__/ 

[    0.000000] OF: fdt: No chosen node found, continuing without
[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[    0.000000] Linux version 5.7.8 (phantom@vmware) (gcc version 10.1.0 (GCC), GNU ld (GNU Binutils) 2.34) #1 SMP Thu Jul 16 14:02:39 CST 2020
rohuns commented 4 years ago

That worked perfectly, thanks!