-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
run VUnit from WSL with Modelsim installed in windows #658
Comments
Ref #539 |
I was trying to get vunit with modelsim working under WSL and ran into the same issues. Note this is vunit installed under WSL calling modelsim installed under windows. Doing some "printf" debugging, I found that the modelsim executables don't seem to be able to handle the absolute path names as WSL mounts, which is how vunit seems to handle the file names for libraries, etc., but is able to handle relative path names. e.g. my
I was able to make progress by hacking at Unfortunately, I ran into another roadblock when vunit is trying to compile the vunit_lib files (starting with the
Even though its path is relative, I think, because it's installed in my home directory under WSL and not the "normal" Windows filesystem, that my Windows modelsim can't find the file. Would be interested to hear any solutions and maybe my above explorations will help others. |
It seems that several of you are hitting issues when trying to use VUnit in a WSL1 or WSL2 terminal, along with a Windows version of ModelSim. My first suggestion would be for you to try the Linux version of ModelSim instead. That should avoid issues with path types. A similar problem exists with MSYS2/MINGW. In that case, there are mechanisms for converting paths from linux to windows format, and the other way round. In fact, it can be done implicitly and/or explicitly. It would be interesting to investigate whether WSL includes any similar mechanism. Otherwise, VUnit might need to be patched for handling linux paths internally, but converting them before calling an external windows simulator. Overall, I wonder why are you using WSL, if the simulator is installed on Windows. Is it for avoiding installing Python on Windows?
My feeling is that this use case goes beyond WSL's intended usage. You installed VUnit inside a virtual machine, you mounted an external directory inside the virtual machine and you are asking a binary from that directory to access the home of the virtual machine. Theoretically, it should work, because the "environment" when you execute the binary should be the virtual machine. It does definitely work if I use a docker container instead of WSL. However, in Docker it's easier to understand what's going on, because the binaries/executables need to be linux binaries. Yet, who knows the details of how Microsoft implemented the "transparent binding". Windows binaries are not executed inside the virtual machine, but on the host; and some translation layer needs to exist for dealing with file system, signals, etc. @sbedt, I would suggest trying to isolate the problem: /mnt/c/modeltech_pe_10.6/win32pe/vcom -quiet -2008 -work my_lib ~/my_file.vhd Then, try a similar command with any other windows tool, to ensure that the problem is not specific about ModelSim. |
So I'm testing this out and I'm not seeing the above issues after creating symlinks for vcom and vlib. For reference, I'm using modelsim DLX 2019.4 and WSL kernel: PS P:\> wsl --status
Default Distribution: Ubuntu-20.04
Default Version: 2
Windows Subsystem for Linux was last updated on 5/31/2022
The Windows Subsystem for Linux kernel can be manually updated with 'wsl --update', but automatic updates cannot occur due to your system settings.
To receive automatic kernel updates, please enable the Windows Update setting: 'Receive updates for other Microsoft products when you update Windows'.
For more information please visit https://aka.ms/wsl2kernel.
Kernel version: 5.10.102.1 However, I get a different error: === Command used: ===
/mnt/c/Modelsim/modelsim_dlx64_2019.4/win64pe/vcom -quiet -modelsimini /mnt/blah/vunit_out/modelsim/modelsim.ini -2008 -work COMMON /mnt/ssd/gnicholls/blah/src/blah.vhd
=== Command output: ===
** Error: (vcom-1598) Library "std" not found.
** Note: VHDL Compiler exiting It appears that
I'm trying to figure out what |
I attempted to create symbolic links in the install dirs and found that running those exe's on windows didn't work and led to confusing errors. I found microsoft/WSL#2003 (comment) but that doesn't appear to work since VUnit uses the full path instead of adding the path and calling the exe by name only. I changed to using an alias which appears to work but I don't really like that solution. @LarsAsplund @umarcor what are your thoughts about adding the tool path to python's path and calling Popen/subprocess with the exe by name only? Currently, VUnit does IMO, I think this is actually a bug. I find it weird that VUnit would use [29436] D:\tmp\tox_example\.tox$ 'c:\users\glen.nicholls\appdata\local\programs\python\python37\python.exe' -m virtualenv --no-download --python 'c:\users\glen.nicholls\appdata\local\programs\python\python37\python.exe' |
@GlenNicholls if modelsim is not using the |
I believe I now have a working setup of WSL + modelsim installed on Windows - for both VHDL & Verilog + VUnit flows. Here are the hacks/fixes that I did so far: file: vsim_simulator_mixin.py
def __init__(self, prefix, persistent, sim_cfg_file_name):
if (prefix is None):
prefix = "" Somehow this prefix is None in my case and that led to weird errors. Maybe @LarsAsplund can throw more light on the intended prefix value. Also I hacked the vsim to be vsim.exe inside that same file, but am sure I can add a OS check - something like: platform.release() and add .exe only for WSL. Is this of interest as PR @LarsAsplund ? Regards |
My fixes are at: master...ajeethakv:vunit:wsl_mti (https://github.com/ajeethakv/vunit/tree/wsl_mti) Regards |
I have VUnit installed in WSL2 and Modelsim intel edition in windows 10.
I set VUNIT_SIMULATOR and VUNIT_MODELSIM_PATH in etc/enviroment and etc/profile and ~/.bashrc to:
VUNIT_SIMULATOR="modelsim"
VUNIT_MODELSIM_PATH="/mnt/c/intelFPGA_pro/19.2/modelsim_ase/win32aloem/"
I have been trying to run it but it complains that it could not find vcom nor vlib.
FileNotFoundError: [Errno 2] No such file or directory: /mnt/c/intelFPGA_pro/19.2/modelsim_ase/win32aloem/vcom': '/mnt/c/intelFPGA_pro/19.2/modelsim_ase/win32aloem/vcom'
it seems that WSL2 cannot pick the extension, @eine advised me to create symlink for that and then this error has been fixed but now when I run: python run.py it gives this error:
The text was updated successfully, but these errors were encountered: