ucb-bar / chipyard

An Agile RISC-V SoC Design Framework with in-order cores, out-of-order cores, accelerators, and more
https://chipyard.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
1.56k stars 618 forks source link

Chipyard1.110 version, vcs make failed #1922

Open YeyeQian opened 1 month ago

YeyeQian commented 1 month ago

Background Work

Chipyard Version and Hash

Release: 1.11.0

OS Setup

Ex: Output of uname -a + lsb_release -a + printenv + conda list Linux server146 3.10.0-862.el7.x86_64 #1 SMP Wed Mar 21 18:14:51 EDT 2018 x86_64 GNU/Linux

Other Setup

VCS version: N-2017.12-1

Current Behavior

I tried to run the vcs simulation in chipyard1.11.0, but it failed with the following informatiion:

g++ -w -pipe -fPIC -std=c++17 -I/data/userhome/zhaoyifan/Work/chipyard/.conda-env/riscv-tools/include -I/data/userhome/zhaoyifan/Work/chipyard/tools/DRAMSim2 -I/data/userhome/zhaoyifan/Work/chipyard/sims/vcs/generated-src/chipyard.harness.TestHarness.LoopbackNICRocketConfig/gen-collateral -O3 -I/eda/apps/snps/vcs-mx/N-2017.12-1/include -c /data/userhome/zhaoyifan/Work/chipyard/sims/vcs/generated-src/chipyard.harness.TestHarness.LoopbackNICRocketConfig/gen-collateral/uart.cc cc1: warning: command-line option '-std=c++17' is valid for C++/ObjC++ but not for C /data/userhome/zhaoyifan/Work/chipyard/.conda-env/bin/../lib/gcc/x86_64-conda-linux-gnu/11.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: /eda/apps/snps/vcs-mx/N-2017.12-1/linux64/lib/vcs_save_restore_new.o: relocation R_X86_64_32S against symbol `_sigintr' can not be used when making a PIE object; recompile with -fPIE /data/userhome/zhaoyifan/Work/chipyard/.conda-env/bin/../lib/gcc/x86_64-conda-linux-gnu/11.4.0/../../../../x86_64-conda-linux-gnu/bin/ld: failed to set dynamic section sizes: bad value collect2: error: ld returned 1 exit status make[1]: [Makefile:107: product_timestamp] Error 1 make[1]: Leaving directory '/data/userhome/zhaoyifan/Work/chipyard/sims/vcs/generated-src/chipyard.harness.TestHarness.LoopbackNICRocketConfig/chipyard.harness.TestHarness.LoopbackNICRocketConfig' Make exited with status 2 make: [Makefile:72: /data/userhome/zhaoyifan/Work/chipyard/sims/vcs/simv-chipyard.harness-LoopbackNICRocketConfig] Error 2

Expected Behavior

I have searched the solutions, including this one https://github.com/ucb-bar/chipyard/issues/1011, but none of them works. I suspect there is a mismatch between the vcs version and the gcc version, and it would be helpful if the matching version of vcs and gcc can be provided under chipyard 1.11.0 version.

Other Information

I tried to use another gcc version that is build from the local server, gcc-9.2.0. Thus, I modified the 'VCS' variable in chipyard/sims/vcs/Makefile: VCS = vcs -full64 -cpp /usr/local/gcc-9.2.0/bin/g++ -cc /usr/local/gcc-9.2.0/bin/gcc -LDFLAGS -Wl,--no-as-needed

However, this attempt did not work, while the error information changed to the following:

/data/userhome/zhaoyifan/Work/chipyard/.conda-env/x86_64-conda-linux-gnu/include/c++/11.4.0/ext/new_allocator.h:116: undefined reference to std::__throw_bad_array_new_length()' /data/userhome/zhaoyifan/Work/chipyard/.conda-env/bin/ld: /data/userhome/zhaoyifan/Work/chipyard/.conda-env/riscv-tools/lib/libriscv.so: undefined reference tostd::__throw_bad_array_new_length()@GLIBCXX_3.4.29' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:107: product_timestamp] Error 1

No response

jerryz123 commented 1 month ago

This is an unfortunate problem that arises when the libraries installed by the conda environment conflict with the system libraries expected by VCS.

Unfortunately, the only solution for this at the moment is to avoid using the conda environment entirely, and install the riscv-gnu-toolchain, riscv-isa-sim, circt, and other tools manually.

You can run build-setup.sh with the right set of flags to omit generating a Conda environment, in which case you must provide your own $RISCV directory into which the tools will be installed. After installing the tools into $RISCV, adding $RISCV/bin to your PATH should be sufficient to get the repo working with your system VCS.

Keep in mind when going down this path that you will have to manage and resolve any missing system dependencies required by various tools in Chipyard's dependencies. This can be a tedious process.

YeyeQian commented 1 month ago

Thank you very much. I'll give it a try