User Tools

Site Tools


Building Unfolding tools

Recent versions of Bison (e.g. v3.6.2 in MacPort and v3.5.1 in Ubuntu 20.04) have a new way to detect reduce/reduce conflicts. This affects generating a parser from unflib/pn_parse_hl.y grammar – the following error is reported by Bison: reduce/reduce conflicts: 162 found, 54 expected. A workaround is to change the number of expected reduce/reduce conflicts from 54 to 162.

for Linux

These instructions also work for Windows Subsystem for Linux (WSL).
See WSL documentation for detailed setup instructions.

  • Install development packages:
    sudo apt install gcc gcc-multilib  # GCC v9.3.0
    sudo apt install g++ g++-multilib  # G++ v9.3.0
    sudo apt install bison flex        # Bison v3.5.1
    sudo apt install make dos2unix
    sudo apt install libhwloc-dev
  • Run make cleanall and remove all static libraries (*.a files)
  • Run make

Binaries produced in Ubuntu 20.04 and 18.04 require Linux kernel v3.2.0 or newer. This may cause problems for EDA servers that often run Red Hat 6 with kernel v2.6.32. A workaround is to configure a build environment under Ubuntu 16.04 instead:

  1. Note that if you are using WSL, then Ubuntu 16.04 needs to be installed manually, via PowerShell:
    curl.exe -L -o ubuntu-1604.appx
    Add-AppxPackage .\Ubuntu_1604.2019.523.0_x64.appx
  2. Install GCC 8 and set it as a default alternative:
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo apt install gcc-8 gcc-8-multilib g++-8 g++-8-multilib
    sudo update-alternatives \
      --install /usr/bin/gcc gcc /usr/bin/gcc-8 20 \
      --slave /usr/bin/g++ g++ /usr/bin/g++-8 \
      --slave /usr/bin/gcov gcov /usr/bin/gcov-8
  3. Install other dependencies, excluding Bison (see below):
    sudo apt install m4 make flex dos2unix libhwloc-dev
  4. Build Bison v3.5.1 from source (only v3.0.4 is available from Ubuntu official repo, which is too old):
    tar xzfv bison-3.5.1.tar.gz
    cd bison-3.5.1
    sudo make install

for OSX

  1. Use MacPort to install GCC:
    sudo port install gcc8 +universal
    #sudo port select --list gcc
    sudo port select --set gcc mp-gcc8
  2. Install OpenSSL, Bison and DOS2Unix:
    sudo port install bison
    sudo port install openssl
    sudo port install dos2unix
  3. Use OSX flags:
    cp flags_osx flags

    The changes are as follows:

    • the flag -static is replaced with -static-libstdc++ -static-libgcc in CFLAGS
    • the flags -Wl,–whole-archive and -Wl,–no-whole-archive are removed from CXXFLAGS
  4. Change the number of expected reduce/reduce conflicts from 54 to 162 in unflib/parse_hl.y grammar file:
    sed -i'' 's/%expect-rr 54/%expect-rr 162/g' unflib/parse_hl.y
  5. Run make cleanall and remove all static libraries (*.a files)
  6. Run make
Copyright © 2014-2021