Repository: cocotb/cocotb

Issue:
Installing cocotb with FLI for Questa-2021.2 not possible: vdbg obsolete
Using latest relase of cocotb 1.6.1.
After installing cocotb and when trying to run a project with SIM=questa it results in the error:

ERROR: cocotb was not installed with an FLI library, as the mti.h header could not be located.
If you installed an FLI-capable simulator after cocotb, you will need to reinstall cocotb.

However, questa is installed and vdbg executable is in PATH but invoking vdbg results in:

vdbg command is now obsolete. Please run vopt with "-debugdb" option to enable schematic and causality fuctionalities.

Is there a way to fix this?


Discussion:
This is kind of a sore point. cocotb must be built with vdbg in your path for cocotb to build support for the FLI. Once cocotb is built, pip stores the built object in a cache, so any successive attempt to install the project will use the cached version, never allowing the package to be rebuilt with FLI support. You will have to add the `--no-cache-dir` when using `pip install` to override pip's wheel cache. 

As for vdbg being deprecated, we could move to another executable (say `vsim`).
>As for vdbg being deprecated, we could move to another executable (say vsim).

I think there is also `vsim` in Riviera. At the time I tied something that is only in Questa. 
Need to find something else.

How about detect vsim and then see if mti.h is present? I would hope Riviera doesn't ship a file called mti.h that is incompatible.
Seems like we can use `vopt`. It is only in Questa.
> This is kind of a sore point. cocotb must be built with vdbg in your path for cocotb to build support for the FLI. Once cocotb is built, pip stores the built object in a cache, so any successive attempt to install the project will use the cached version, never allowing the package to be rebuilt with FLI support. You will have to add the `--no-cache-dir` when using `pip install` to override pip's wheel cache.

Thanks, '--no-cache-dir' was the missing thing and it is working now. I did not find this in the installation docs.

> As for vdbg being deprecated, we could move to another executable (say `vsim`).

I see. So the functionality of vdbg is actually not needed but only its existence is used for checking for FLI support? Maybe  vdbg is not going to go away despite it being obsolete. All the "executables" in '<questa_install>/bin/' are symlinks to '<questa_install>/vco' anyway.
>Thanks, '--no-cache-dir' was the missing thing and it is working now. I did not find this in the installation docs.

Because it's a corner case. Perhaps it's worth a blurb.

Resolving patch:
diff --git a/cocotb_build_libs.py b/cocotb_build_libs.py
--- a/cocotb_build_libs.py
+++ b/cocotb_build_libs.py
@@ -633,10 +633,10 @@ def get_ext():
     )
     ext.append(modelsim_vhpi_ext)
 
-    vsim_path = find_executable("vdbg")
+    vsim_path = find_executable("vopt")
     if vsim_path is None:
         logger.warning(
-            "Modelsim/Questa executable (vdbg) executable not found. No FLI interface will be available."
+            "Modelsim/Questa installation not found: did not find the 'vopt' executable. No FLI interface will be available."
         )
     else:
         modelsim_dir = os.path.dirname(os.path.dirname(vsim_path))
@@ -663,7 +663,7 @@ def get_ext():
 
         else:
             logger.warning(
-                "Cannot build FLI interface for Modelsim/Questa - "
+                "Cannot build FLI interface for Modelsim/Questa: "
                 "the mti.h header for '{}' was not found at '{}'.".format(
                     vsim_path, mti_path
                 )


Test patch: