Forum Discussion

AlexBarry's avatar
AlexBarry
Icon for New Contributor rankNew Contributor
4 years ago
Solved

Questa Sim on Windows - linking to external LIB

I have been trying to use Questa (from Quartus Lite 21.1) on Windows to link to the Winsock2 library, without success. I have a minimal test case attached. I can't get it to load into the simulator. I compile with the command:

vlog -sv -dpiheader dpiheader.h test.v test.c

That succeeds. Then, I try to start the simulator using the command:

vsim -c DPI_test

That fails with an error:

# ** Fatal: (vsim-3828) Could not link 'vsim_auto_compile.dll': cmd = 'D:/intelFPGA_lite/21.1/questa_fse\gcc-7.4.0-mingw64vc15\bin\g++.exe -shared -o "C:/Users/barralem/AppData/Local/Temp\barralem@BHI4TNR6H2_dpi_32868\win64_gcc-7.4.0\vsim_auto_compile.dll" C:/work/embedded/test/work\_dpi\auto_compile@\win64_gcc-7.4.0\test.o -Wl,-Bsymbolic -L"D:/intelFPGA_lite/21.1/questa_fse/win64" -lmtipli'
# (vsim-50) A call to system(D:/intelFPGA_lite/21.1/questa_fse\gcc-7.4.0-mingw64vc15\bin\g++.exe -shared -o "C:/Users/barralem/AppData/Local/Temp\barralem@BHI4TNR6H2_dpi_32868\win64_gcc-7.4.0\vsim_auto_compile.dll" C:/work/embedded/test/work\_dpi\auto_compile@\win64_gcc-7.4.0\test.o -Wl,-Bsymbolic -L"D:/intelFPGA_lite/21.1/questa_fse/win64" -lmtipli) returned error code '1'.
# No such file or directory. (errno = ENOENT)
#

I have tried removing the "#pragma comment(lib, "ws2_32.lib")" line, with no change. I have also tried specifying the library on the command line with -sclib. I have tried copying the LIB to the project directory, with no help.

  • I believe we have figured it out. We needed to add the -64 parameter, and -ldflags to pass parameters to gcc. This appears to work:

    vsim -c DPI_test -ldflags "-lws2_32" -64

5 Replies

  • ShengN_altera's avatar
    ShengN_altera
    Icon for Super Contributor rankSuper Contributor

    Seems like some compatibility issue there. Winsock library is 32-bit version but questa gcc is 64-bit version. Try to use modelsim instead of questa in order to match bit version.

  • AlexBarry's avatar
    AlexBarry
    Icon for New Contributor rankNew Contributor

    I believe we have figured it out. We needed to add the -64 parameter, and -ldflags to pass parameters to gcc. This appears to work:

    vsim -c DPI_test -ldflags "-lws2_32" -64

    • ShengN_altera's avatar
      ShengN_altera
      Icon for Super Contributor rankSuper Contributor

      Good to know that. It'll be great if you can mark it as solution for better future reference.

    • Njoroge's avatar
      Njoroge
      Icon for Occasional Contributor rankOccasional Contributor

      How exactly do you do this? Where do you add this?

      • RichardT_altera's avatar
        RichardT_altera
        Icon for Super Contributor rankSuper Contributor

        I am not OP so my understanding may not be fully accurate. However, based on the information provided, the vsim command is invoked after the OP compiled the design using vlog. These command appears to be part of the Questa simulation flow.
        I would recommend checking the simulation setup scripts, such as:

        -msim_setup.tcl
        -compile.do

        These scripts usually define how the vlog and vsim commands are invoked, and should help identify where exactly this command is coming from in the flow.

        FYI, Altera only support 64-bit Questasim (And, only 64-bit Questa Altera FPGA Edition). 64-bit Questasim can only link with 64-bit winsock library and 32-bit questasim can only link with 32-bit winsock library. This is just how windows applications and even linux applications work.

        Regards,
        Richard Tan