openXC7 / openXC7-snap

snap package for nextpnr PnR FPGA toolchain for Xilinx 7 series FPGAs, with Spartan7, Artix7, Zynq7 and Kintex7 support
BSD 3-Clause "New" or "Revised" License
26 stars 2 forks source link

nextpnr-xilinx from the snap seems to be broken on Ubuntu 22.04 and derivatives #1

Closed robinsonb5 closed 1 year ago

robinsonb5 commented 1 year ago

I'm attempting to build the blinky-qmtech project from the demo-projects repo, and while it works fine on my Mint 20.3 (Ubuntu 20.04 derivative), the build fails on Mint 21 (Ubuntu 22.04 derivative - and someone else had the same problem using Ubuntu 22.04 itself)

The problem seems to be python-related, and it's entirely possible I'm doing something wrong, but the error message I'm seeing is this:

nextpnr-xilinx --chipdb ../chipdb/xc7k325tffg676-1.bin --xdc blinky.xdc --json blinky.json --fasm blinky.fasm --verbose --debug
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/snap/nextpnr-kintex/x1/usr/bin/nextpnr-xilinx'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/snap/nextpnr-kintex/x1/usr/bin/nextpnr-xilinx'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.executable = '/snap/nextpnr-kintex/x1/usr/bin/nextpnr-xilinx'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python38.zip',
    '/usr/lib/python3.8',
    '/usr/lib/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f4b200f67c0 (most recent call first):
<no Python frame>
make: *** [Makefile:25: blinky.fasm] Error 1

Python is installed and working well enough to use litex, so I think the problem is related to the snap or its configuration.

hansfbaier commented 1 year ago

This should be fixed now: https://github.com/kintex-chatter/nextpnr-kintex-snap/releases/tag/v0.2.1 Works for me in a 22.04 VM.

hansfbaier commented 1 year ago

@robinsonb5 please confirm

robinsonb5 commented 1 year ago

Thanks for the update.

On Mint21 I still get the same error, but I spun up a fresh Ubuntu 22.04.1 VM and installed there, and now nextpnr-xilinx successfully compiles the blinky-qmtech demo.

I do see the following warning from fasm2frames though:

fasm2frames --part xc7k325tffg676-1 --db-root /snap/nextpnr-kintex/current/opt/n
extpnr-xilinx/external/prjxray-db/kintex7 blinky.fasm > blinky.frames
/snap/nextpnr-kintex/current/usr/lib/python3/dist-packages/fasm/parser/__init__.
py:30: RuntimeWarning: Unable to import fast Antlr4 parser implementation.
  ImportError: libffi.so.7: cannot open shared object file: No such file or dire
ctory

  Falling back to the much slower pure Python textX based parser
  implementation.

  Getting the faster antlr parser can normally be done by installing the
  required dependencies and then reinstalling the fasm package with:
    pip uninstall
    pip install -v fasm

  warn(

But it does appear to work, and I do have a .bit file at the end of the process.

hansfbaier commented 1 year ago

Yes that warning is a known issue.