caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Strange compilation problem
@ 2009-02-11  9:28 Matthieu Dubuget
  2009-02-11 12:05 ` Matthieu Dubuget
  2009-02-11 14:30 ` Matthieu Dubuget
  0 siblings, 2 replies; 7+ messages in thread
From: Matthieu Dubuget @ 2009-02-11  9:28 UTC (permalink / raw)
  To: caml-list

This command line fails during the linking stage:

> ocamlfind opt -linkpkg -package miniscan test.ml -o test.exe
> ** Fatal error: Cannot find file "libmingw32"
> File "caml_startup", line 1, characters 0-1:
> Error: Error during linking

Since this seems to be a problem with my "miniscan" findlib package,
I gather some information and by-pass it

> $ ocamlfind query miniscan
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan
 
> $ cat C:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan/META
> description = "Binding Miniscan"
> archive(byte) = "miniscan.cma"
> archive(native) = "miniscan.cmxa"
> requires = "mtsvrac,ojson,log,dsn153,okenveloppe,traite"

and this command line works, and produces a working test.exe file:

> ocamlfind opt -linkpkg -package
mtsvrac,ojson,log,dsn153,okenveloppe,traite -I
c:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan miniscan.cmxa test.ml
-o test.exe

Any idea what the problem could be? Or what I should check next?

Salutations

Matt


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange compilation problem
  2009-02-11  9:28 Strange compilation problem Matthieu Dubuget
@ 2009-02-11 12:05 ` Matthieu Dubuget
  2009-02-11 14:30 ` Matthieu Dubuget
  1 sibling, 0 replies; 7+ messages in thread
From: Matthieu Dubuget @ 2009-02-11 12:05 UTC (permalink / raw)
  To: caml-list

Here are some more infos. I increased flexlink.exe verbosity.
First, the failing log, then the working one, and at last a diff of both.

>  ocamlfind opt -o test.exe -linkpkg -package miniscan test.ml -cclib
-v -cclib -v -cclib -v
> ** Use cygpath: true
> ** Search path:
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/traite
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okenveloppe
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okfft
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/dsn153
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/log
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/tics
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/num
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/ojson
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/mtsvrac
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/traite
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okenveloppe
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okfft
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/dsn153
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/log
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/tics
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/num
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/ojson
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/mtsvrac
> C:/cygwin/home/matt/ocamlmgw/lib
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/traite
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okenveloppe
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okfft
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/dsn153
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/log
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/tics
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/num
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/ojson
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/mtsvrac
> /lib/mingw
> /lib
> /lib/w32api
> /usr/lib/gcc/i686-pc-mingw32/3.4.4
> ** Default libraries:
> crt2.o
> -lmingw32
> -lgcc
> -lmoldname
> -lmingwex
> -lmsvcrt
> -luser32
> -lkernel32
> -ladvapi32
> -lshell32
> ** open: C:/cygwin/lib/mingw/crt2.o
> ** Fatal error: Cannot find file "libmingw32"
> File "caml_startup", line 1, characters 0-1:
> Error: Error during linking

And the working one:

> ocamlfind opt -linkpkg -package
mtsvrac,ojson,log,dsn153,okenveloppe,traite
-I                                                                              
c:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan mini.cmxa test.ml -o
test.ex                                                                             
e -cclib -v -cclib -v
> ** Use cygpath: true
> ** Search path:
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/traite
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okenveloppe
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okfft
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/dsn153
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/log
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/tics
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/num
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/ojson
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/mtsvrac
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/traite
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okenveloppe
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okfft
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/dsn153
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/log
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/tics
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/num
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/ojson
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/mtsvrac
> C:/cygwin/home/matt/ocamlmgw/lib
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/traite
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okenveloppe
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okfft
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/dsn153
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/log
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/tics
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/num
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/ojson
> C:/cygwin/home/matt/ocamlmgw/lib/site-lib/mtsvrac
> c:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan
> /lib/mingw
> /lib
> /lib/w32api
> /usr/lib/gcc/i686-pc-mingw32/3.4.4
> ** Default libraries:
> crt2.o
> -lmingw32
> -lgcc
> -lmoldname
> -lmingwex
> -lmsvcrt
> -luser32
> -lkernel32
> -ladvapi32
> -lshell32
> ** open: C:/cygwin/lib/mingw/crt2.o
> ** open: C:/cygwin/lib/mingw/libmingw32.a
> ** open: C:/cygwin/lib/gcc/i686-pc-mingw32/3.4.4/libgcc.a
> ** open: C:/cygwin/lib/mingw/libmoldname.a
> ** open: C:/cygwin/lib/mingw/libmingwex.a
> ** open: C:/cygwin/lib/mingw/libmsvcrt.a
> ** open: C:/cygwin/lib/w32api/libuser32.a
> ** open: C:/cygwin/lib/w32api/libkernel32.a
> ** open: C:/cygwin/lib/w32api/libadvapi32.a
> ** open: C:/cygwin/lib/w32api/libshell32.a
> + gcc -mno-cygwin -mconsole  -L.
-I"C:/cygwin/home/matt/ocamlmgw/lib/site-lib/tr

(gcc command truncated)


Following is a diff output of both.


*** c:/DOCUME~1/matt/LOCALS~1/Temp/ediff3236JTj    Wed Feb 11 12:59:13 2009
--- c:/DOCUME~1/matt/LOCALS~1/Temp/ediff3236Wdp    Wed Feb 11 12:59:13 2009
***************
*** 1,7 ****
! >  ocamlfind opt -o test.exe -linkpkg -package miniscan test.ml -cclib
-v -cclib -v -cclib -v
  > ** Use cygpath: true
  > ** Search path:
- > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/traite
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okenveloppe
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okfft
--- 1,6 ----
! > ocamlfind opt -linkpkg -package
mtsvrac,ojson,log,dsn153,okenveloppe,traite
-I                                                                              
c:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan mini.cmxa test.ml -o
test.exe -cclib -v -cclib -v
  > ** Use cygpath: true
  > ** Search path:
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/traite
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okenveloppe
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okfft
***************
*** 11,17 ****
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/num
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/ojson
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/mtsvrac
- > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/traite
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okenveloppe
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okfft
--- 10,15 ----
***************
*** 22,28 ****
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/ojson
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/mtsvrac
  > C:/cygwin/home/matt/ocamlmgw/lib
- > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/traite
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okenveloppe
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/okfft
--- 20,25 ----
***************
*** 32,37 ****
--- 29,35 ----
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/num
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/ojson
  > C:/cygwin/home/matt/ocamlmgw/lib/site-lib/mtsvrac
+ > c:/cygwin/home/matt/ocamlmgw/lib/site-lib/miniscan
  > /lib/mingw
  > /lib
  > /lib/w32api
***************
*** 48,52 ****
  > -ladvapi32
  > -lshell32
  > ** open: C:/cygwin/lib/mingw/crt2.o
! > ** Fatal error: Cannot find file "libmingw32"
! > File "caml_startup", line 1, characters 0-1:
--- 46,58 ----
  > -ladvapi32
  > -lshell32
  > ** open: C:/cygwin/lib/mingw/crt2.o
! > ** open: C:/cygwin/lib/mingw/libmingw32.a
! > ** open: C:/cygwin/lib/gcc/i686-pc-mingw32/3.4.4/libgcc.a
! > ** open: C:/cygwin/lib/mingw/libmoldname.a
! > ** open: C:/cygwin/lib/mingw/libmingwex.a
! > ** open: C:/cygwin/lib/mingw/libmsvcrt.a
! > ** open: C:/cygwin/lib/w32api/libuser32.a
! > ** open: C:/cygwin/lib/w32api/libkernel32.a
! > ** open: C:/cygwin/lib/w32api/libadvapi32.a
! > ** open: C:/cygwin/lib/w32api/libshell32.a
! > + gcc -mno-cygwin -mconsole  -L.
-I"C:/cygwin/home/matt/ocamlmgw/lib/site-lib/tr

Thanks

Salutations

Matt


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange compilation problem
  2009-02-11  9:28 Strange compilation problem Matthieu Dubuget
  2009-02-11 12:05 ` Matthieu Dubuget
@ 2009-02-11 14:30 ` Matthieu Dubuget
       [not found]   ` <BB046CA812535C45BD0029AA9D04BA7905ECDCCB@KL-SRV57.lmsintl.com>
  1 sibling, 1 reply; 7+ messages in thread
From: Matthieu Dubuget @ 2009-02-11 14:30 UTC (permalink / raw)
  Cc: caml-list

Progressing… slowly.

There is clearly a problem in my configuration or in flexlink, or both?

If I copy:

libadvapi32.a  libmingw32.a  libmoldname.a
libkernel32.a  libmingwex.a  libshell32.a

in my present working directory, the link stage works.

ocamlfind opt -linkpkg -package miniscan test.ml -o test.exe



Now trying to understand the problem. It seems like it is the endless unix/window
path style problem...






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Re: Strange compilation problem
       [not found]   ` <BB046CA812535C45BD0029AA9D04BA7905ECDCCB@KL-SRV57.lmsintl.com>
@ 2009-02-11 14:51     ` Matthieu Dubuget
       [not found]       ` <BB046CA812535C45BD0029AA9D04BA7905ECDCD6@KL-SRV57.lmsintl.com>
  2009-02-11 16:30     ` [Caml-list] Re: Strange compilation problem -> solved Matthieu Dubuget
  1 sibling, 1 reply; 7+ messages in thread
From: Matthieu Dubuget @ 2009-02-11 14:51 UTC (permalink / raw)
  To: caml-list

Christoph Bauer a écrit :
> Hi,
>
> I had also similar problems:
> http://caml.inria.fr/mantis/view.php?id=4645
>
> Make sure, that you use the latest flexlink.
>   

Thanks for the answer.

I do have the very last flexdll (0.14). I downloaded the binary version.

And I'm inside the subversion version of flexlink.exe in order to understand
where the problem comes from. Since I'm not able to use
ocamldebug, I go with printf ;-)
> One of the problems was with white spaces in the path to libmingw32.a
> if i remember correctly
>   
Something else, in my case…

Salutations


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Re: Strange compilation problem (flexlink trying to deal with windows and cygwin shell limitations)
       [not found]       ` <BB046CA812535C45BD0029AA9D04BA7905ECDCD6@KL-SRV57.lmsintl.com>
@ 2009-02-11 15:15         ` Matthieu Dubuget
  0 siblings, 0 replies; 7+ messages in thread
From: Matthieu Dubuget @ 2009-02-11 15:15 UTC (permalink / raw)
  To: caml-list

Christoph Bauer a écrit :
> I added -L$(cygpath -m /usr/lib/w32api) somewhere in the command lin while linking.
> Does this help? (Maybe as -cclib  -L$(cygpath -m /usr/lib/w32api))
>
> Regards,
>
> Christoph Bauer
>   

No :-/

But I think I understood the problem. flexlink tries a lot of paths.
And if the file is not found, a cygpath conversion is tried before
a second search.

This cygpath conversion is done through a file redirection.

> let get_output cmd =
>   let fn = Filename.temp_file "flexdll" "" in
>   if (Sys.command (cmd ^ " > " ^ fn) < 0)
>   then failwith ("Cannot run " ^ cmd);
>     let r = read_file fn in
>       Sys.remove fn;
>       r

In my case fn is void, and cmd is… long.

String.length cmd gives 8406 ie > 8k

I'm pretty sure that I could have my app. compiled
by using a site-lib directory near the root of the filesystem.

Salutations

Matt



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Re: Strange compilation problem -> solved
       [not found]   ` <BB046CA812535C45BD0029AA9D04BA7905ECDCCB@KL-SRV57.lmsintl.com>
  2009-02-11 14:51     ` [Caml-list] " Matthieu Dubuget
@ 2009-02-11 16:30     ` Matthieu Dubuget
  2009-02-11 17:19       ` Alain Frisch
  1 sibling, 1 reply; 7+ messages in thread
From: Matthieu Dubuget @ 2009-02-11 16:30 UTC (permalink / raw)
  To: caml-list; +Cc: Alain Frisch

[-- Attachment #1: Type: text/plain, Size: 687 bytes --]

Here is a patch against subversion version  of flexlink that solves my
problem.

Salutations

P.S. Alain, j'ai eu un problème d’édition de liens avec flexlink, qui
s’est avéré être
à ma portée (voir la liste de diffusion caml) ; d’autant plus que la
solution était
déjà en partie dans les sources de flexlink ;-)

Voici de quoi je suis parti.

Path: .
URL: svn://frisch.fr/flexdll/trunk
Repository Root: svn://frisch.fr/flexdll
Repository UUID: 673e9a06-3c3d-0410-add4-e21af864612f
Revision: 153
Node Kind: directory
Schedule: normal
Last Changed Author: frisch
Last Changed Rev: 153
Last Changed Date: 2009-01-28 17:17:06 +0100 (Wed, 28 Jan 2009)

[-- Attachment #2: long_path.patch --]
[-- Type: text/x-diff, Size: 1208 bytes --]

Index: reloc.ml
===================================================================
--- reloc.ml	(revision 153)
+++ reloc.ml	(working copy)
@@ -58,13 +58,25 @@
   close_in ic;
   List.rev !r
 
+
 let get_output cmd =
   let fn = Filename.temp_file "flexdll" "" in
-  if (Sys.command (cmd ^ " > " ^ fn) < 0)
-  then failwith ("Cannot run " ^ cmd);
-  let r = read_file fn in
-  Sys.remove fn;
-  r
+  let cmd' = cmd ^ " > " ^ (Filename.quote fn) in
+    if String.length cmd' < 8182 then
+      begin
+	if (Sys.command cmd' < 0)
+	then failwith ("Cannot run " ^ cmd);
+      end
+    else
+      begin
+	let (cfn, oc) = Filename.open_temp_file "longcmd" ".sh" in
+	  output_string oc cmd'; close_out oc;
+	  if Sys.command (Printf.sprintf "bash %s" cfn) < 0 
+	  then failwith ("Cannot run " ^ cmd)
+      end;
+    let r = read_file fn in
+      Sys.remove fn; 
+      r
 
 let get_output1 cmd =
   List.hd (get_output cmd)
@@ -142,7 +154,7 @@
 (* Looking for files *)
 
 let cygpath l =
-  get_output (Printf.sprintf "cygpath -m %s" (String.concat " " l))
+  get_output (Printf.sprintf "cygpath -m %s" (String.concat " " (List.map Filename.quote l)))
 
 let gcclib () =
   let extra = match !toolchain with

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] Re: Strange compilation problem -> solved
  2009-02-11 16:30     ` [Caml-list] Re: Strange compilation problem -> solved Matthieu Dubuget
@ 2009-02-11 17:19       ` Alain Frisch
  0 siblings, 0 replies; 7+ messages in thread
From: Alain Frisch @ 2009-02-11 17:19 UTC (permalink / raw)
  To: matthieu.dubuget; +Cc: caml-list

Matthieu Dubuget wrote:
> Here is a patch against subversion version  of flexlink that solves my
> problem.

Thanks Matthieu!  The patch has been applied to flexlink's SVN repository.

-- Alain


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-02-11 17:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-11  9:28 Strange compilation problem Matthieu Dubuget
2009-02-11 12:05 ` Matthieu Dubuget
2009-02-11 14:30 ` Matthieu Dubuget
     [not found]   ` <BB046CA812535C45BD0029AA9D04BA7905ECDCCB@KL-SRV57.lmsintl.com>
2009-02-11 14:51     ` [Caml-list] " Matthieu Dubuget
     [not found]       ` <BB046CA812535C45BD0029AA9D04BA7905ECDCD6@KL-SRV57.lmsintl.com>
2009-02-11 15:15         ` [Caml-list] Re: Strange compilation problem (flexlink trying to deal with windows and cygwin shell limitations) Matthieu Dubuget
2009-02-11 16:30     ` [Caml-list] Re: Strange compilation problem -> solved Matthieu Dubuget
2009-02-11 17:19       ` Alain Frisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).