[cffi-devel] Problem with cffi-grovel on windows/cygwin(mingw mode)
Reini Urban
rurban at x-ray.at
Sun Aug 8 10:15:48 UTC 2010
2010/7/1 Heka Treep <zena.treep at gmail.com>:
> Hi, some problem I have with this:
>
> (defsystem
> ...
> (cffi-grovel:wrapper-file "...")
> ...
>
> generates a call:
>
> gcc -m32 -fPIC -o *.dll *.c -shared
>
> but cygwin want at least flag `-mno-cygwin'. It would be possible to
> define this flag in some variable, but the flag is added to the end of
> the list of arguments - and it just not work.
cygwin does not want, neither support -mno-cygwin anymore.
It was used for the old mingw cross-compiler, never for cygwin.
-fPIC is also invalid for mingw/cygwin.
> I try this format:
>
> gcc cpu-flags cc-flags platform-library-flags* -o output-file input-file
>
> by reimplement `cc-compile-and-link' function:
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (in-package :cffi-grovel)
>
> (defun cc-compile-and-link (input-file output-file &key library)
> (apply #'invoke (or (getenv "CC") *cc*)
> *cpu-word-size-flags*
> `(,@*cc-flags*
> ,@(when library *platform-library-flags*)
> "-o"
> ,(native-namestring output-file)
> ,(native-namestring input-file))))
>
> (setf *cc* "C:/dev/cygwin/bin/gcc-3.exe") ;; its my
> (setf *cc-flags* '()) ;; remove -fPIC
> (setf *cpu-word-size-flags* "") ;; and this too
> (setf *platform-library-flags* '("-mno-cygwin" "-shared")) ;; added
> -mno-cygwin in begin
Using your native compiler, and not using a cross-compiler will help.
strawberry perl for example includes the gcc mingw compiler and most
dependencies.
http://strawberryperl.com/
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/
More information about the cffi-devel
mailing list