4

I need to compile the libffi library to use it in a Visual Studio 2013 project.

I am using libffi 3.0.13, downloaded from their original page

I have been struggling to make it work, following the instructions given in README, or trying to come up with something myself, but ended up failing pretty fast.

I tried:

  • using the Mingw environment to configure the libffi. But that is done for 'gcc' and 'make'. If I compile with gcc, it probably won't link with VS project correctly (right?). Besides, I don't have make (I would install it gladly, if gcc compilation would suffice)

  • using the ../configure CC="../msvcc.sh -m64" command as suggested in README, but my mingw does not know what cl is.

  • Tried providing the full path to cl.exe, but the compiler failed the configure tests. The log shows:

configure:3673: ../msvcc.sh    conftest.c  >&5
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\cl.exe -MD -nologo -W3 conftest.c
conftest.c
LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'
  • Tried using the Visual Studio shell, but then the configure program is unknown
CygnusX1
  • 20,968
  • 5
  • 65
  • 109

1 Answers1

2

first, forgive my poor english! I solved this problem just now!

  1. find your msvcc.sh
  2. modify it, find this postion:
else
    args="$md $args"
    echo "$cl $args"
    eval "\"$cl\" $args"
    result=$?
fi

I add some flags:

else
    args="$md $args"
    echo "********"
    args=" $args -ID:/soft/Microsoft\ Visual\ Studio\ 12.0/VC/include/ -link -LIBPATH:D:/soft/Microsoft\ Visual\ Studio\ 12.0/VC/lib/ -LIBPATH:C:/Program\ Files\ \(x86\)/Microsoft\ SDKs/Windows/v7.1A/Lib/"
    echo "********"
    echo "$cl $args"
    eval "\"$cl\" $args"
    result=$?
fi
  1. change "D:/soft/Microsoft\ Visual\ Studio\ 12.0" these things to your path!
  2. in cygwin: ./configure CC=E:/project/3rd_parth/libffi/libffi-3.0.13/msvcc.sh(also change the path)
  3. done!

Hope it is not too late!

cptbtptp
  • 29
  • 2