YosysHQ / yosys

Yosys Open SYnthesis Suite
https://yosyshq.net/yosys/
ISC License
3.32k stars 859 forks source link

Add YosysHQ/abc as a submodule located in abc. #4243

Closed RCoeurjoly closed 2 months ago

RCoeurjoly commented 4 months ago

Add YosysHQ/abc as a submodule located in abc. Apart from cloning with submodules, no other modifications are made to github actions.

This would enable building yosys with abc fetched as tar.gz, as pointed out by @mmicko in https://github.com/YosysHQ/yosys/pull/4238#issuecomment-1966067326

Before starting the compilation of abc, we check four cases:

  1. abc directory does not exist. The compilation is stopped with the following error.

Error: The 'abc' directory does not exist. Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule.

  1. abc is a clone of abc (abc/.gitcommit content is Format). The compilation is stopped with the following error.

Error: 'abc' is not configured as a git submodule. To resolve this:

  1. Back up your changes: Save any modifications from the 'abc' directory to another location.
  2. Remove the existing 'abc' directory: Delete the 'abc' directory and all its contents.
  3. Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule.
  4. Reapply your changes: Move your saved changes back to the 'abc' directory, if necessary.
  1. abc comes from a tarball (abc/.gitcommit content is different than $Format:%h$). The compilation can continue.

'abc' comes from a tarball. Continuing.

  1. abc is a git submodule (checked with git submodule status). The compilation can continue.

'abc' is a git submodule. Continuing.

mmicko commented 4 months ago

@RCoeurjoly please note that WASI is intentionally built in build directory since that exercise out of tree build that is used in YoWASP distribution. That is then very useful since it points out if changes done in Makefiles affect out of tree builds.

RCoeurjoly commented 4 months ago

@RCoeurjoly please note that WASI is intentionally built in build directory since that exercise out of tree build that is used in YoWASP distribution. That is then very useful since it points out if changes done in Makefiles affect out of tree builds.

Oh I see.

mmicko commented 4 months ago

Also abc.tar.gz that is used is one from https://github.com/YosysHQ/yosys/releases This is more for situations where people are downloading specific Yosys version and corresponding abc.tar.gz file and building them on isolated environments.

RCoeurjoly commented 3 months ago

Finally!!! Great job!

Thanks! It was a team effort. Also note that since you approved of the changes, I made a change to address @povik proposal here https://github.com/YosysHQ/yosys/pull/4243#discussion_r1508766314.

You may want to review that also.

whitequark commented 2 months ago

This broke the YoWASP build after all: https://github.com/YoWASP/yosys/actions/runs/9010585766/job/24756882140#step:7:657

'abc' comes from a tarball. Continuing.
mkdir -p abc && make -C abc -f "" ABCSRC="/home/runner/work/yosys/yosys/yosys-src/abc"  CC="ccache clang" CXX="ccache clang" ABC_USE_LIBSTDCXX=1 ABC_USE_NAMESPACE=abc VERBOSE= AR="llvm-ar" RANLIB="llvm-ranlib" ARCHFLAGS="-target wasm32-wasi --sysroot /home/runner/work/yosys/yosys/wasi-sdk-19.0/share/wasi-sysroot  -D_WASI_EMULATED_PROCESS_CLOCKS -DABC_USE_STDINT_H -DABC_NO_DYNAMIC_LINKING -DABC_NO_RLIMIT" OPTFLAGS="-Os" "ABC_USE_NO_READLINE=1" "ABC_USE_NO_PTHREADS=1" PROG="abc" MSG_PREFIX="-> ABC: " libabc.a
make: the '-f' option requires a non-empty string argument
make: Entering an unknown directory
Usage: make [options] [target] ...
whitequark commented 2 months ago

So it turns out the YoWASP build was broken because I didn't check out submodules recursively, and the really confusing error message comes from the combination of an improper check for the presence of the submodule combined with the use of realpath.