[Win32utils-devel] ffi and msvc

Heesob Park phasis at gmail.com
Mon Jan 9 10:31:45 EST 2012


Hi,


2012/1/9 Daniel Berger <djberg96 at gmail.com>

> Hi,
>
> > I forked ffi and made "just work" version of mingw and mswin32.
> >
> > You can download it from https://github.com/phasis68/ffi
>
> Fantastic!
>
> I cloned the repo locally and tried to install it using "rake
> gem:install". BTW, that takes a few minutes and requires the rake-compiler
> and rdoc gems for anyone else who wants to try it.
>
> Anyway, it eventually failed with:
>
> AbstractMemory.c
> AbstractMemory.c(34) : fatal error C1083: Cannot open include file:
> 'stdint.h': No such file or directory
> NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual
> Studio 9.0\VC\BIN\cl.EXE"' : re
> turn code '0x2'
> Stop.
>
> This is with MSVC++ 9 on Windows Vista.
>
> Here's some more detail
>
> ...
> mkdir -p pkg
> cd pkg/ffi-1.0.11
>  Successfully built RubyGem
>  Name: ffi
>  Version: 1.0.11
>  File: ffi-1.0.11.gem
> mv ffi-1.0.11.gem ../ffi-1.0.11.gem
> cd -
>  gem.bat install --local pkg/ffi-1.0.11
> Building native extensions.  This could take a while...
> ERROR:  Error installing pkg/ffi-1.0.11:
>        ERROR: Failed to build gem native extension.
>
>        c:/rubyvc9/bin/ruby.exe extconf.rb
> checking for rb_thread_blocking_region()... no
> checking for ruby_thread_has_gvl_p()... no
> checking for ruby_native_thread_p()... no
> checking for rb_thread_call_with_gvl()... no
> creating extconf.h
> creating Makefile
>
> nmake
>
> Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
> Copyright (C) Microsoft Corporation.  All rights reserved.
>
>        c:\rubyvc9\bin\ruby -e "puts 'EXPORTS', 'Init_ffi_c'"  >
> ffi_c-i386-mswin32_90.def
>
> Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
> Copyright (C) Microsoft Corporation.  All rights reserved.
>
>        1 file(s) copied.
>        1 file(s) copied.
>        cl.exe -EP -nologo -Zi -D_MD -W3 -DWIN32 -DWINNT -D_WIN32
> -D_WINDOWS -D_WINNT -D_WIN32_WINNT
> =0x0501 -D_WIN32_IE=0x0600 -D_X86_=1 -DNDEBUG -MD -O2 -Ob2 -Oy- -I . -I
> .\include -I .\src\x86 .\src
> \x86\win32.S >.\src\x86\win32.asm
> win32.S
>        cl.exe -c -nologo -Zi -D_MD -W3 -DWIN32 -DWINNT -D_WIN32 -D_WINDOWS
> -D_WINNT -D_WIN32_WINNT=
> 0x0501 -D_WIN32_IE=0x0600 -D_X86_=1 -DNDEBUG -MD -O2 -Ob2 -Oy- -I . -I
> .\include -I .\src\x86 -Fo.\s
> rc\closures.obj -Fd.\.libs\ffi-3-src .\src\closures.c
> closures.c
>        cl.exe -c -nologo -Zi -D_MD -W3 -DWIN32 -DWINNT -D_WIN32 -D_WINDOWS
> -D_WINNT -D_WIN32_WINNT=
> 0x0501 -D_WIN32_IE=0x0600 -D_X86_=1 -DNDEBUG -MD -O2 -Ob2 -Oy- -I . -I
> .\include -I .\src\x86 -Fo.\s
> rc\debug.obj -Fd.\.libs\ffi-3-src .\src\debug.c
> debug.c
>        cl.exe -c -nologo -Zi -D_MD -W3 -DWIN32 -DWINNT -D_WIN32 -D_WINDOWS
> -D_WINNT -D_WIN32_WINNT=
> 0x0501 -D_WIN32_IE=0x0600 -D_X86_=1 -DNDEBUG -MD -O2 -Ob2 -Oy- -I . -I
> .\include -I .\src\x86 -Fo.\s
> rc\java_raw_api.obj -Fd.\.libs\ffi-3-src .\src\java_raw_api.c
> java_raw_api.c
>        cl.exe -c -nologo -Zi -D_MD -W3 -DWIN32 -DWINNT -D_WIN32 -D_WINDOWS
> -D_WINNT -D_WIN32_WINNT=
> 0x0501 -D_WIN32_IE=0x0600 -D_X86_=1 -DNDEBUG -MD -O2 -Ob2 -Oy- -I . -I
> .\include -I .\src\x86 -Fo.\s
> rc\prep_cif.obj -Fd.\.libs\ffi-3-src .\src\prep_cif.c
> prep_cif.c
>        cl.exe -c -nologo -Zi -D_MD -W3 -DWIN32 -DWINNT -D_WIN32 -D_WINDOWS
> -D_WINNT -D_WIN32_WINNT=
> 0x0501 -D_WIN32_IE=0x0600 -D_X86_=1 -DNDEBUG -MD -O2 -Ob2 -Oy- -I . -I
> .\include -I .\src\x86 -Fo.\s
> rc\raw_api.obj -Fd.\.libs\ffi-3-src .\src\raw_api.c
> raw_api.c
>        cl.exe -c -nologo -Zi -D_MD -W3 -DWIN32 -DWINNT -D_WIN32 -D_WINDOWS
> -D_WINNT -D_WIN32_WINNT=
> 0x0501 -D_WIN32_IE=0x0600 -D_X86_=1 -DNDEBUG -MD -O2 -Ob2 -Oy- -I . -I
> .\include -I .\src\x86 -Fo.\s
> rc\types.obj -Fd.\.libs\ffi-3-src .\src\types.c
> types.c
>        cl.exe -c -nologo -Zi -D_MD -W3 -DWIN32 -DWINNT -D_WIN32 -D_WINDOWS
> -D_WINNT -D_WIN32_WINNT=
> 0x0501 -D_WIN32_IE=0x0600 -D_X86_=1 -DNDEBUG -MD -O2 -Ob2 -Oy- -I . -I
> .\include -I .\src\x86 -Fo.\s
> rc\x86\ffi.obj -Fd.\.libs\ffi-3-src .\src\x86\ffi.c
> ffi.c
>        ml.exe -c -coff -W3 -Cx -Zm -Di386 -DQUIET -D?QUIET /Fo
> .\src\x86\win32.obj .\src\x86\win32.
> asm
>  Assembling: .\src\x86\win32.asm
> .\src\x86\win32.asm(842) : warning A6004:procedure argument or local not
> referenced : FORCEFRAME
> .\src\x86\win32.asm(995) : warning A6004:procedure argument or local not
> referenced : FORCEFRAME
> Microsoft (R) Macro Assembler Version 9.00.21022.08
> Copyright (C) Microsoft Corporation.  All rights reserved.
>
>        "link.exe" /LIB /NOLOGO /MACHINE:X86
> /out:.\.libs\libffi_convenience.lib @C:\Users\djberge\A
> ppData\Local\Temp\nm5C70.tmp
>        cl -W3 -nologo -I. -I. -Ic:/rubyvc9/lib/ruby/1.8/i386-mswin32_90
> -I. -Ic:\rubyvc9\lib\ruby\g
> ems\1.8\gems\ffi-1.0.11\ext\ffi_c/libffi/include
> -Ic:\rubyvc9\lib\ruby\gems\1.8\gems\ffi-1.0.11\ext\
> ffi_c/libffi/src/x86 -MD   -O2b2xty- -DRUBY_EXTCONF_H=\"extconf.h\"
> -D_CRT_SECURE_NO_DEPRECATE -D_CR
> T_NONSTDC_NO_DEPRECATE -c -TcAbstractMemory.c
> AbstractMemory.c
> AbstractMemory.c(34) : fatal error C1083: Cannot open include file:
> 'stdint.h': No such file or dire
> ctory
> NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual
> Studio 9.0\VC\BIN\cl.EXE"' : re
> turn code '0x2'
> Stop.
>
>
> Gem files will remain installed in
> c:/rubyvc9/lib/ruby/gems/1.8/gems/ffi-1.0.11 for inspection.
> Results logged to
> c:/rubyvc9/lib/ruby/gems/1.8/gems/ffi-1.0.11/ext/ffi_c/gem_make.out
> rake aborted!
> Command failed with status (1): [ gem.bat install --local
> pkg/ffi-1.0.11...]
>
> Tasks: TOP => gem:install
> (See full trace by running task with --trace)
>
> What have I done wrong?
>
>
My test compiler is MSVC++ 10 and it has stdint.h
It seems MSVC++ 9 don't have stdint.h

Could you try replacing

#if defined(_MSC_VER) && !defined(INT8_MIN)
#  include <stdint.h>
#endif

to

#if (_MSC_VER >= 16) && !defined(INT8_MIN)
#  include <stdint.h>
#endif
?

BTW, I commited some msvc 64bit fixes just a minute ago.
Now, ffi works 32bit and 64bit of msvc.

Regards,
Park Heesob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/win32utils-devel/attachments/20120110/66a97118/attachment-0001.html>


More information about the win32utils-devel mailing list