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.
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
It is normal, or I don't understand something?
I have something like a solution of this problem, all changes of the cffi/grovel/grovel.lisp file I put in my repository at http://gitorious.org/~treep/cffi/treeps-cffi
2010/7/1 Heka Treep zena.treep@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.
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
It is normal, or I don't understand something?
2010/7/1 Heka Treep zena.treep@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/