YosysHQ / oss-cad-suite-build

Multi-platform nightly builds of open source digital design and verification tools
ISC License
742 stars 67 forks source link

cocotb: libffi.so.7 often not found at runtime #74

Open dlmiles opened 11 months ago

dlmiles commented 11 months ago

The distribution appears to bundle $OSS_CAD_SUITE_HOME/lib/libffi.so.7 however this is often not found by cocotb when loading VPI DSOs for simulator support. Such a Verilator or CVC (Tachyon)

This error still occurs after use of source $OSS_CAD_SUITE_HOME/environment

The resolution has been to sudo -E apt-get install -y libffi7 on the system. Rendering the one provided by OSS CAD suite, not use for this use-case scenario.

Example of the generated use case, in particular it is the use of "-lcocotbvpi_verilator" that is provided by oss-cad-suite, that causes libffi.so.7 to be needed. This file is provided at lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/libs/libcocotbvpi_verilator.so

This is nothing special and can be largely created with use of SIM=verilator make

## EXAMPLE VERILATOR EXECUTION
verilator -cc --exe -Mdir sim_build -DCOCOTB_SIM=1 --top-module tb_project --vpi --public-flat-rw --prefix Vtop -o Vtop
-LDFLAGS "-Wl,-rpath,/home/runner/work/_temp/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/libs
-L/home/runner/work/_temp/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/libs
-lcocotbvpi_verilator"
--trace --trace-structs
--no-timing
--coverage --coverage-underscore
--timescale 1ns/1ps
/home/runner/work/project/src/tbc_project.v
/home/runner/work/project/src/top_project.v
/home/runner/work/project/src/MyMainThing.v
/home/runner/work/_temp/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/share/lib/verilator/verilator.cpp

## EXAMPLE FINAL LINK
g++     verilator.o verilated.o verilated_dpi.o verilated_vpi.o verilated_cov.o verilated_vcd_c.o verilated_threads.o Vtop__ALL.a
-Wl,-rpath,/home/runner/work/_temp/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/libs
-L/home/runner/work/_temp/oss-cad-suite/lib/python3.8/site-packages/cocotb-1.9.0.dev0-py3.8-linux-x86_64.egg/cocotb/libs
-lcocotbvpi_verilator
 -pthread -lpthread -latomic   -o Vtop