From 871dc29e0d97d953757df9af1141bd4d89574ab0 Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Thu, 24 Feb 2022 01:42:22 +0000 Subject: [PATCH 1/9] log commands in build_utils.sh --- scripts/build-util.sh | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/scripts/build-util.sh b/scripts/build-util.sh index 1af11aeec1..1cf0a0d535 100644 --- a/scripts/build-util.sh +++ b/scripts/build-util.sh @@ -28,29 +28,30 @@ module_prepare() ( # [ignored-submodule..] echo "=> Starting ${name} build" echo "==> Initializing ${name} submodule" if [ $# -gt 0 ] ; then - git submodule update --init "${dir}" + (set -x; git submodule update --init "${dir}") while [ -n "$1" ] ; do - git -C "${dir}" config submodule."${1}".update none + (set -x; git -C "${dir}" config submodule."${1}".update none) shift done fi - git submodule update --init --recursive "${dir}" + (set -x; git submodule update --init --recursive "${dir}") ) module_run() ( # set -e + echo "=> cd ${SRCDIR}/${1}" cd "${SRCDIR}/${1}" shift - "$@" + (set -x; "$@") ) module_make() ( # set -e -o pipefail - cd "${SRCDIR}/${1}/build" + build_dir="${SRCDIR}/${1}/build" shift - "${MAKE}" "$@" | tee "build-${1:-make}.log" + (set -x; "${MAKE}" -C "$build_dir" "$@") | tee "build-${1:-make}.log" if [ -n "$CLEANAFTERINSTALL" ] ; then - "${MAKE}" clean # get rid of intermediate files + (set -x; "${MAKE}" -C "$build_dir" clean) # get rid of intermediate files fi ) @@ -59,33 +60,33 @@ module_build() ( # [configure-arg..] name=$1 shift + echo "==> cd ${SRCDIR}/${name}" cd "${SRCDIR}/${name}" if [ -e build ] ; then echo "==> Removing existing ${name}/build directory" - rm -rf build + (set -x; rm -rf build) fi if ! [ -e configure ] ; then echo "==> Updating autoconf files for ${name}" find . -iname configure.ac -type f -print0 | while read -r -d '' file ; do - mkdir -p -- "${file%/*}/m4" + (set -x; mkdir -p -- "${file%/*}/m4") done - autoreconf -i + (set -x; autoreconf -i) fi - mkdir -p build - cd build + (set -x; mkdir -p build) { export PATH="${RISCV:+${RISCV}/bin:}${PATH}" echo "==> Configuring ${name}" - ../configure "$@" + (set -x; cd build && ../configure "$@") echo "==> Building ${name}" - "${MAKE}" + (set -x; "${MAKE}" -C build) echo "==> Installing ${name}" - "${MAKE}" install + (set -x; "${MAKE}" -C build install) if [ -n "$CLEANAFTERINSTALL" ] ; then - "${MAKE}" clean # get rid of intermediate files + (set -x; "${MAKE}" -C build clean) # get rid of intermediate files fi } 2>&1 | tee build.log ) From c223d09cb628a64abc173aca1cf611a91814d39b Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Thu, 24 Feb 2022 01:46:23 +0000 Subject: [PATCH 2/9] explicitly disable boost for spike build because https://github.com/riscv-software-src/riscv-isa-sim/issues/834 and we don't need the debug socket --- scripts/build-toolchains.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index e89ba4f00e..68989eeca6 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -154,7 +154,7 @@ else module_make riscv-gnu-toolchain linux fi -module_all riscv-isa-sim --prefix="${RISCV}" +module_all riscv-isa-sim --prefix="${RISCV}" --with-boost=no # build static libfesvr library for linking into firesim driver (or others) echo '==> Installing libfesvr static library' module_make riscv-isa-sim libfesvr.a From 9aee0abe0cf3dd828c5d21cf6d72640e1a6ed908 Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Thu, 24 Feb 2022 01:57:30 +0000 Subject: [PATCH 3/9] tweak build-toolchains.sh to work with conda env * more env vars need to be cleared when using the RISCV cross compiler * use LD_GOLD to link QEMU because QEMU's LDFLAGS_NOPIC uses incorrect format for the version of bfd ld --- scripts/build-toolchains.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 68989eeca6..b0467fb789 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -160,13 +160,14 @@ echo '==> Installing libfesvr static library' module_make riscv-isa-sim libfesvr.a cp -p "${SRCDIR}/riscv-isa-sim/build/libfesvr.a" "${RISCV}/lib/" -CC= CXX= module_all riscv-pk --prefix="${RISCV}" --host=riscv${XLEN}-unknown-elf +CC= CXX= CFLAGS= CPPFLAGFS= CXXFLAGS= LDFLAGS= DEBUG_CXXFLAGS= DEBUG_CPPFLAGS= DEBUG_CFLAGS= OBJCOPY= \ + module_all riscv-pk --prefix="${RISCV}" --host=riscv${XLEN}-unknown-elf module_all riscv-tests --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --with-xlen=${XLEN} # Common tools (not in any particular toolchain dir) -CC= CXX= SRCDIR="$(pwd)/toolchains" module_all libgloss --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --host=riscv${XLEN}-unknown-elf - +CC= CXX= CFLAGS= CPPFLAGFS= CXXFLAGS= LDFLAGS= DEBUG_CXXFLAGS= DEBUG_CPPFLAGS= DEBUG_CFLAGS= \ + SRCDIR="$(pwd)/toolchains" module_all libgloss --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --host=riscv${XLEN}-unknown-elf if [ -z "$IGNOREQEMU" ] ; then echo "=> Starting qemu build" dir="$(pwd)/toolchains/qemu" @@ -186,8 +187,15 @@ if [ -z "$IGNOREQEMU" ] ; then git -C "$dir" submodule foreach --quiet --recursive '! grep -q "git\.qemu\.org" .gitmodules 2>/dev/null' && \ echo "==> PLEASE REMOVE qemu URL-REWRITING from scripts/build-toolchains.sh. It is no longer needed!" && exit 1 + ld_directive="$LD" + if [[ -n "${LD_GOLD:-z}" ]]; then + # conda bfd ld suffers from https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789 + # so use GOLD to link instead + ld_directive="$LD_GOLD" + fi + # now actually do the build - SRCDIR="$(pwd)/toolchains" module_build qemu --prefix="${RISCV}" --target-list=riscv${XLEN}-softmmu --disable-werror + LD="$ld_directive" SRCDIR="$(pwd)/toolchains" module_build qemu --prefix="${RISCV}" --target-list=riscv${XLEN}-softmmu --disable-werror fi # make Dromajo From 7783e6eb8043c398dd6a08adc24147f9617943eb Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Mon, 14 Mar 2022 17:48:46 +0000 Subject: [PATCH 4/9] add comment about spike autoconf issue w/ boost --- scripts/build-toolchains.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index b0467fb789..92a9cf75eb 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -154,6 +154,8 @@ else module_make riscv-gnu-toolchain linux fi +# disable boost explicitly for https://github.com/riscv-software-src/riscv-isa-sim/issues/834 +# since we don't have it in our requirements module_all riscv-isa-sim --prefix="${RISCV}" --with-boost=no # build static libfesvr library for linking into firesim driver (or others) echo '==> Installing libfesvr static library' From 7a848937abe94d3e8d2c2fc10ac19a070e082086 Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Tue, 22 Mar 2022 04:37:30 +0000 Subject: [PATCH 5/9] bump testchipip for missing include --- generators/testchipip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/testchipip b/generators/testchipip index 52027a049f..d838384350 160000 --- a/generators/testchipip +++ b/generators/testchipip @@ -1 +1 @@ -Subproject commit 52027a049f7810013e5940a1c115ff83127c1a96 +Subproject commit d83838435003cc12add9b8ce2975f572fa430c76 From 80300a0bc53da2e244f5168925149423d9d00261 Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Mon, 11 Apr 2022 19:52:04 +0000 Subject: [PATCH 6/9] Revert "bump testchipip for missing include" This reverts commit 7a848937abe94d3e8d2c2fc10ac19a070e082086. --- generators/testchipip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/testchipip b/generators/testchipip index d838384350..52027a049f 160000 --- a/generators/testchipip +++ b/generators/testchipip @@ -1 +1 @@ -Subproject commit d83838435003cc12add9b8ce2975f572fa430c76 +Subproject commit 52027a049f7810013e5940a1c115ff83127c1a96 From bdf8f4f46110b0a44789f5650d8a81ab93131c8e Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Mon, 11 Apr 2022 19:53:17 +0000 Subject: [PATCH 7/9] Revert "tweak build-toolchains.sh to work with conda env" This reverts commit 9aee0abe0cf3dd828c5d21cf6d72640e1a6ed908. --- scripts/build-toolchains.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 92a9cf75eb..d8d4a30ff8 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -162,14 +162,13 @@ echo '==> Installing libfesvr static library' module_make riscv-isa-sim libfesvr.a cp -p "${SRCDIR}/riscv-isa-sim/build/libfesvr.a" "${RISCV}/lib/" -CC= CXX= CFLAGS= CPPFLAGFS= CXXFLAGS= LDFLAGS= DEBUG_CXXFLAGS= DEBUG_CPPFLAGS= DEBUG_CFLAGS= OBJCOPY= \ - module_all riscv-pk --prefix="${RISCV}" --host=riscv${XLEN}-unknown-elf +CC= CXX= module_all riscv-pk --prefix="${RISCV}" --host=riscv${XLEN}-unknown-elf module_all riscv-tests --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --with-xlen=${XLEN} # Common tools (not in any particular toolchain dir) -CC= CXX= CFLAGS= CPPFLAGFS= CXXFLAGS= LDFLAGS= DEBUG_CXXFLAGS= DEBUG_CPPFLAGS= DEBUG_CFLAGS= \ - SRCDIR="$(pwd)/toolchains" module_all libgloss --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --host=riscv${XLEN}-unknown-elf +CC= CXX= SRCDIR="$(pwd)/toolchains" module_all libgloss --prefix="${RISCV}/riscv${XLEN}-unknown-elf" --host=riscv${XLEN}-unknown-elf + if [ -z "$IGNOREQEMU" ] ; then echo "=> Starting qemu build" dir="$(pwd)/toolchains/qemu" @@ -189,15 +188,8 @@ if [ -z "$IGNOREQEMU" ] ; then git -C "$dir" submodule foreach --quiet --recursive '! grep -q "git\.qemu\.org" .gitmodules 2>/dev/null' && \ echo "==> PLEASE REMOVE qemu URL-REWRITING from scripts/build-toolchains.sh. It is no longer needed!" && exit 1 - ld_directive="$LD" - if [[ -n "${LD_GOLD:-z}" ]]; then - # conda bfd ld suffers from https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1907789 - # so use GOLD to link instead - ld_directive="$LD_GOLD" - fi - # now actually do the build - LD="$ld_directive" SRCDIR="$(pwd)/toolchains" module_build qemu --prefix="${RISCV}" --target-list=riscv${XLEN}-softmmu --disable-werror + SRCDIR="$(pwd)/toolchains" module_build qemu --prefix="${RISCV}" --target-list=riscv${XLEN}-softmmu --disable-werror fi # make Dromajo From 497a5592877c4133f08caa9e5b85350e86e55305 Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Mon, 11 Apr 2022 21:28:33 +0000 Subject: [PATCH 8/9] still need workaround for linking QEMU with newer toolchains --- scripts/build-toolchains.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index d8d4a30ff8..0b7881caf0 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -188,8 +188,24 @@ if [ -z "$IGNOREQEMU" ] ; then git -C "$dir" submodule foreach --quiet --recursive '! grep -q "git\.qemu\.org" .gitmodules 2>/dev/null' && \ echo "==> PLEASE REMOVE qemu URL-REWRITING from scripts/build-toolchains.sh. It is no longer needed!" && exit 1 + ( + # newer version of BFD-based ld has made '-no-pie' an error because it renamed to '--no-pie' + # meanwhile, ld.gold will still accept '-no-pie' + # QEMU 5.0 still uses '-no-pie' in it's linker options + + # default LD to ld if it isn't set + if ( set +o pipefail; ${LD:-ld} -no-pie |& grep 'did you mean --no-pie' >/dev/null); then + echo "==> LD doesn't like '-no-pie'" + # LD has the problem, look for ld.gold + if type ld.gold >&/dev/null; then + echo "==> Using ld.gold to link QEMU" + export LD=ld.gold + fi + fi + # now actually do the build SRCDIR="$(pwd)/toolchains" module_build qemu --prefix="${RISCV}" --target-list=riscv${XLEN}-softmmu --disable-werror + ) fi # make Dromajo From 2b6e1362dfd59341e1b69ac9cb36ba6be0e018c1 Mon Sep 17 00:00:00 2001 From: Tim Snyder Date: Tue, 12 Apr 2022 21:33:31 +0000 Subject: [PATCH 9/9] bump tools cache version per request from Abe in PR --- .github/workflows/chipyard-run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/chipyard-run-tests.yml b/.github/workflows/chipyard-run-tests.yml index 902b5bd980..0465fb31df 100644 --- a/.github/workflows/chipyard-run-tests.yml +++ b/.github/workflows/chipyard-run-tests.yml @@ -7,7 +7,7 @@ on: - main env: - tools-cache-version: v13 + tools-cache-version: v14 BUILDSERVER: ${{ secrets.BUILDSERVER }} BUILDUSER: ${{ secrets.BUILDUSER }} SERVER: ${{ secrets.BUILDUSER }}@${{ secrets.BUILDSERVER }}