Menu

#844 vvp -M. does not work in Windows

devel
closed-fixed
Other (110)
5
2011-05-22
2011-05-14
guardus
No

I could not get VPI with relative paths to work under Windows XP SP3. I am trying the <iverilog>/examples/hello_vpi example.

Here is the sequence I go through:

1. iverilog-vpi hello_vpi.c
Compiling hello_vpi.c...
Making hello_vpi.vpi from hello_vpi.o...

2. iverilog -ohello_vpi.vvp hello_vpi.vl

3. vvp -M. -mhello_vpi -lhello_vpi.log hello_vpi.vvp
hello_vpi.vvp: Program not runnable, 1 errors.
hello_vpi:`.\hello_vpi.vpi' failed to open using dlopen() because:
The specified module could not be found.
.
hello_vpi.vl:45: Error: System task/function $my_hello() is not defined by any module.

However, if I use a full path it works. Both the following commands work:

vvp -MC:\...\examples -mhello_vpi hello_vpi.vvp

vvp -mC:\...\examples\hello_vpi hello_vpi.vvp

I came up with a quick and dirty fix by modifying vvp/vpi_modules.cc to use the Windows GetFullPathName function to
convert every path to a full path. Patch attached.

BTW, I think there is a typo in a comment in vvp/main.cc line 269. I think "na,e" should be "name".

Discussion

  • guardus

    guardus - 2011-05-14
     
  • Cary R.

    Cary R. - 2011-05-16

    FYI make check in the vvp directory should correctly reference a library using -M. I don't want to say we shouldn't apply the patch, but someone should look at this in a bit more detail before we do. It would also be nice to know the exact compilation environment. I'm assuming MinGW, but exactly which version, etc. would be nice to know.

     
  • guardus

    guardus - 2011-05-16

    I performed some more experiments with the "make check" test and the hello_vpi
    example, and I am getting -M., -M.., and -M../../<dir> do not work, but -M../<dir>
    does work. So I don't know if I am doing something wrong or what. Hopefully
    someone can independently verify this issue.

    I am not a C programmer (just know enough to be dangerous), especially in Windows,
    and I am definitely not saying that the patch fixes the root cause of the problem, but
    hopefully this gives some clues on the problem. I am using MinGW gcc 4.5.2, which
    I believe is the latest release. I am building under MSYS 1.0.17 with just the
    standard MSYS components.

     
  • Cary R.

    Cary R. - 2011-05-17

    Another thing to try is to see if the VPI tests in the test suite run correctly (perl vpi_reg.pl). They use -M . to reference the VPI test routines. The wiki has information on how to fetch the test suite. Also what is the exact version of Icarus you are compiling? You have this marked as development, so to us this implies that you are using the latest development from git since we have not released any snapshots for the V0.10 branch.

     
  • guardus

    guardus - 2011-05-19

    Yes, I am currently using the latest 0.10 from Git. I was using the
    precompiled version from http://bleyer.org/icarus and had this same
    problem, at least with -M. . I did not try -M.., etc. (didn't think of it
    at the time). Actually, 0.9.4 not working is what prompted me to try
    compiling 0.10.

    I think the following may help explain what is going on.
    http://support.microsoft.com/kb/2264107
    This Windows update, which I have installed, allows you to
    mitigate a security vulnerability by removing the CWD from the DLL
    search path. But not sure why -M../<dir> works.

     
  • Martin Whitaker

    Martin Whitaker - 2011-05-22

    I can confirm that this behaviour is caused by applying the KB2264107 security fix. The solution used in the attached patch is the right one, but would be better applied inside the ivl_dlopen function. I will put a revised patch up on the patch tracker shortly.

     
  • Martin Whitaker

    Martin Whitaker - 2011-05-22
    • assigned_to: nobody --> martinwhitaker
     
  • Martin Whitaker

    Martin Whitaker - 2011-05-22
    • status: open --> closed-fixed
     
  • Martin Whitaker

    Martin Whitaker - 2011-05-22

    Patch submitted on patch tracker.

     

Log in to post a comment.

MongoDB Logo MongoDB