caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamlbuild
@ 2007-08-05 23:19 skaller
  2007-08-06  7:36 ` [Caml-list] ocamlbuild Adrien
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: skaller @ 2007-08-05 23:19 UTC (permalink / raw)
  To: caml-list

Does Ocamlbuild work on Windows *transparently*?

To do this, it must read filenames written with / in it,
but use filenames with \ replacing the /. I'd say this is
mandatory, so the same build control file will work on
all platforms. Then you need to document that Unix filenames
must be used, even on Windows.

Note: although *Ocaml* basenames cannot have spaces in them,
the directories that contain them can. So Ocamlbuild must be
sure to quote all filenames, in case they have spaces.
This includes allowing quotes in the input specs.
Unix file systems allow spaces in filenames too, and many
modern Desktops will have 'folders' with spaces in
(if a 'doze or fruit user gets Ubuntu in their office).

I warn this is a serious PITA if you're building Windows
*Native* code, but hosting the build on Cygwin, because
executables have to use Unix filenames but arguments have
to use Windows filenames, so you have to carefully keep
track of which tool is running what.

It helps if standard tools translate internally (eg ocamlc).
However any build script has to allow for foreign tools
(eg Felix uses Dypgen as a parser).

A serious nasty here is if you have to use silly names
on windows for the tools, eg building Felix:

	C:\Program Files (x86)\Ocaml\ocamlc

and here the spaces, parentheses and C: drive
letter are mandatory and must be handled correctly
as a native filename. On Windows, Ocaml isn't necessarily
even in the path -- because on Windows XP64 I have multiple
Ocaml versions and I need to *specify* which one to use,
no accidents from PATH please! (Well actually, we do use
the PATH but it leads to a mess).


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


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

* Re: [Caml-list] ocamlbuild
  2007-08-05 23:19 ocamlbuild skaller
@ 2007-08-06  7:36 ` Adrien
  2007-08-06  9:34   ` Adrien
  2007-08-08  4:12 ` Aleksey Nogin
  2007-08-09 18:35 ` Nicolas Pouillard
  2 siblings, 1 reply; 8+ messages in thread
From: Adrien @ 2007-08-06  7:36 UTC (permalink / raw)
  To: skaller; +Cc: caml-list

Hi,

I can't answer your question on ocamlbuild but in order to install
some modules under mingw+msys, I had to make ocamlfind work correctly
under windows and learned a few things.


 > To do this, it must read filenames written with / in it,
 > but use filenames with \ replacing the /. I'd say this is
 > mandatory, so the same build control file will work on
 > all platforms. Then you need to document that Unix filenames
 > must be used, even on Windows.

It seems mingw doesn't care that much as I've seen it use paths with
mixed forward and backward slashes.
For the paths, it handles both windows and unix paths.
In mingw, I use paths such as these : /e/GNU/ocaml/lib
But in the application I am developping (as a toy), I need real
windows paths and there is no problem. You only have to change '\' to
"\\" to avoid invalid escapes (though I prefer this to a valid
one...).

I've launched a toplevel and tried Unix.stat on some files:

# Unix.stat "E:\\DocsAndSettings\\Administrateur\\.sancho\\sancho.pref";;
- : Unix.stats =
{Unix.st_dev = 4; Unix.st_ino = 0; Unix.st_kind = Unix.S_REG;
 Unix.st_perm = 438; Unix.st_nlink = 1; Unix.st_uid = 0; Unix.st_gid = 0;
 Unix.st_rdev = 4; Unix.st_size = 5640; Unix.st_atime = 1172179361.;
 Unix.st_mtime = 1172187293.; Unix.st_ctime = 1172179361.}

# Unix.stat "E:\\DocsAndSettings\\Administrateur\\Application
Data\\K-Meleon\\registry.dat";;
- : Unix.stats =
{Unix.st_dev = 4; Unix.st_ino = 0; Unix.st_kind = Unix.S_REG;
 Unix.st_perm = 438; Unix.st_nlink = 1; Unix.st_uid = 0; Unix.st_gid = 0;
 Unix.st_rdev = 4; Unix.st_size = 1181; Unix.st_atime = 1175886880.;
 Unix.st_mtime = 1186381757.; Unix.st_ctime = 1175886880.}


> Note: although *Ocaml* basenames cannot have spaces in them,
> the directories that contain them can. So Ocamlbuild must be
> sure to quote all filenames, in case they have spaces.
> This includes allowing quotes in the input specs.
> Unix file systems allow spaces in filenames too, and many
> modern Desktops will have 'folders' with spaces in
> (if a 'doze or fruit user gets Ubuntu in their office).

When making ocamlfind work under windows, on of the problems was with
Filename.quote. In fact, not exactly but when I removed the calls to
it, the problem disappeared. I tried to quote manually and realized it
required one more quotation and I ended with several \"\".
I think it would be better if Unix.command quoted on its own.

> I warn this is a serious PITA if you're building Windows
> *Native* code, but hosting the build on Cygwin, because
> executables have to use Unix filenames but arguments have
> to use Windows filenames, so you have to carefully keep
> track of which tool is running what.

I've been a mldonkey user for years and always wanted to compile
mldonkey myself for windows.

I've started with (pure, i.e. no mingw) Cygwin and everything built
quickly. However I had a complete unix system inside my computer :
hundreds of MBs used and most important tens of thousand of files
which made everything slower. And then I got the problem with unix vs.
windows filenames and when I saw it, it was a terrible mess.

I later tried with mingw and it wasn't good at then. I tried again
with mingw a few weeks ago and everything works.
I know ocaml's documentation says mingw+msys doesn't work because of
the limited command-line length of msys but this is untrue : the
limitation comes from windows's cmd.exe which is etwa 2000 under
windows 2000 but around 8000 for XP (see the very end of this page
which is really great btw http://mldonkey.sourceforge.net/Windows )
In fact, what's so great with mingw is that you can use what has been
coded for unix while keeping the windows features (see dev-cpp which
is a C IDE on and for windows).


> A serious nasty here is if you have to use silly names
> on windows for the tools, eg building Felix:
>
>        C:\Program Files (x86)\Ocaml\ocamlc
>
> and here the spaces, parentheses and C: drive
> letter are mandatory and must be handled correctly
> as a native filename. On Windows, Ocaml isn't necessarily
> even in the path -- because on Windows XP64 I have multiple
> Ocaml versions and I need to *specify* which one to use,
> no accidents from PATH please! (Well actually, we do use
> the PATH but it leads to a mess).

Thanks to the wiki page spiralvoice made for mldonkey compilation
under windows, I created a .profile file in msys's ~ with this:
  export PATH=/e/GNU/ocaml/bin:/e/GNU/ocaml/lib:$PATH
  export CAMLLIB=/e/GNU/ocaml/lib
  export OCAMLLIB=/e/GNU/ocaml/lib
  export CAMLP4LIB=/e/GNU/ocaml/lib/camlp4

And had not problem. Adding other entries solved another problem with
ocamlfind as it relies on environment variables.
OCaml's "make install" should update them itself.


Btw, am I wrong thinking you use the MSVC port ?



As a side note, if you are concerned about spaces on windows, you can
rename "Program Files", "Documents And Settings" and move the Temp
folder.
Here I have "Programs", "DocsAndSettings" and temp is in
"LocalSettings\Temp" (though "Local Settings" still exist ans is being
used but at least by everything).
You have to edit your windows CDs with a tool such as nlite
(nliteos.com) (actually you can do it after windows installation but I
wouldn't really advise it ;) ).



---

Adrien Nader


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

* Re: [Caml-list] ocamlbuild
  2007-08-06  7:36 ` [Caml-list] ocamlbuild Adrien
@ 2007-08-06  9:34   ` Adrien
  2007-08-06 12:14     ` David Allsopp
  2007-08-06 16:19     ` Christophe TROESTLER
  0 siblings, 2 replies; 8+ messages in thread
From: Adrien @ 2007-08-06  9:34 UTC (permalink / raw)
  To: skaller; +Cc: caml-list

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

I was debugguing a regular-expression and noticed that \" in a string
remained as-is and this somehow seems linked to my quotation problem :
  # let a="\"";;
  val a : string = "\""

  # let a="\034";;
  val a : string = "\""

Is it expected behaviour? :o
I can't get such a quote in any string.

(self-compiled ocaml 3.09.3 under mingw+msys)

[-- Attachment #2: Type: text/html, Size: 529 bytes --]

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

* RE: [Caml-list] ocamlbuild
  2007-08-06  9:34   ` Adrien
@ 2007-08-06 12:14     ` David Allsopp
  2007-08-06 16:19     ` Christophe TROESTLER
  1 sibling, 0 replies; 8+ messages in thread
From: David Allsopp @ 2007-08-06 12:14 UTC (permalink / raw)
  To: caml-list

> I was debugguing a regular-expression and noticed that \" in a string
> remained as-is and this somehow seems linked to my quotation problem :
>  # let a="\"";;
>  val a : string = "\""

What you're seeing here is the pretty-printer in the toploop which passes
string values through String.escaped:

	# let a = "\"";;
	val a : string = "\""
	# String.length a;;
	- : int = 1
	# Printf.printf "%s\n" a;;
	"
	- : unit = ()

I had the same problem with findlib compiling under the MinGW port and had
to remove Filename.quote in the same way...


David


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

* Re: [Caml-list] ocamlbuild
  2007-08-06  9:34   ` Adrien
  2007-08-06 12:14     ` David Allsopp
@ 2007-08-06 16:19     ` Christophe TROESTLER
  1 sibling, 0 replies; 8+ messages in thread
From: Christophe TROESTLER @ 2007-08-06 16:19 UTC (permalink / raw)
  To: camaradetux; +Cc: skaller, caml-list

On Mon, 6 Aug 2007 11:34:01 +0200, Adrien wrote:
> 
> I was debugguing a regular-expression and noticed that \" in a string
> remained as-is and this somehow seems linked to my quotation problem :
>   # let a="\"";;
>   val a : string = "\""
> 
>   # let a="\034";;
>   val a : string = "\""
> 
> Is it expected behaviour? :o

Yes.  Your misunderstanding seems to come from the fact that it is
displayed as \" because it is quoted, this the usual quoting rules
apply.  But

# "\"".[0];;
- : char = '"'

ChriS


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

* Re: [Caml-list] ocamlbuild
  2007-08-05 23:19 ocamlbuild skaller
  2007-08-06  7:36 ` [Caml-list] ocamlbuild Adrien
@ 2007-08-08  4:12 ` Aleksey Nogin
  2007-08-09 18:35 ` Nicolas Pouillard
  2 siblings, 0 replies; 8+ messages in thread
From: Aleksey Nogin @ 2007-08-08  4:12 UTC (permalink / raw)
  To: skaller, Caml List

On 05.08.2007 16:19, skaller wrote:

> To do this, it must read filenames written with / in it,
> but use filenames with \ replacing the /. I'd say this is
> mandatory, so the same build control file will work on
> all platforms. Then you need to document that Unix filenames
> must be used, even on Windows.
> 
> Note: although *Ocaml* basenames cannot have spaces in them,
> the directories that contain them can. So Ocamlbuild must be
> sure to quote all filenames, in case they have spaces.
> This includes allowing quotes in the input specs.
> Unix file systems allow spaces in filenames too, and many
> modern Desktops will have 'folders' with spaces in
> (if a 'doze or fruit user gets Ubuntu in their office).

I do not know if ocamlbuild addresses these, but I know that OMake does ;-).

Aleksey


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

* Re: [Caml-list] ocamlbuild
  2007-08-05 23:19 ocamlbuild skaller
  2007-08-06  7:36 ` [Caml-list] ocamlbuild Adrien
  2007-08-08  4:12 ` Aleksey Nogin
@ 2007-08-09 18:35 ` Nicolas Pouillard
  2 siblings, 0 replies; 8+ messages in thread
From: Nicolas Pouillard @ 2007-08-09 18:35 UTC (permalink / raw)
  To: skaller; +Cc: O'Caml Mailing List

Excerpts from skaller's message of Mon Aug 06 01:19:37 +0200 2007:
> Does Ocamlbuild work on Windows *transparently*?

We  tried  to  do our best at the design step of ocamlbuild to avoid as much as
possible problems with windows and especially with pathname quoting.

Ocamlbuild  helps  you  to  keep  your  command structured to enforce a correct
escaping.  But  it's still up to the user that customize ocamlbuild (by writing
a  plugin;  this  is  needed  for  adding  new rules, flags...). There is still
problems with some standard rules that use some unix commands.

So,  ocamlbuild  is  still  partially supported on windows and therefore is not
ideal  solution  for  building  ocaml  code under windows. However we hope that
this kind of problems will be solved in a future version.

> To do this, it must read filenames written with / in it,
> but use filenames with \ replacing the /. I'd say this is
> mandatory, so the same build control file will work on
> all platforms. Then you need to document that Unix filenames
> must be used, even on Windows.
> 
> Note: although *Ocaml* basenames cannot have spaces in them,
> the directories that contain them can. So Ocamlbuild must be
> sure to quote all filenames, in case they have spaces.
> This includes allowing quotes in the input specs.
> Unix file systems allow spaces in filenames too, and many
> modern Desktops will have 'folders' with spaces in
> (if a 'doze or fruit user gets Ubuntu in their office).
> 
> I warn this is a serious PITA if you're building Windows
> *Native* code, but hosting the build on Cygwin, because
> executables have to use Unix filenames but arguments have
> to use Windows filenames, so you have to carefully keep
> track of which tool is running what.
> 
> It helps if standard tools translate internally (eg ocamlc).
> However any build script has to allow for foreign tools
> (eg Felix uses Dypgen as a parser).
> 
> A serious nasty here is if you have to use silly names
> on windows for the tools, eg building Felix:
> 
>     C:\Program Files (x86)\Ocaml\ocamlc
> 
> and here the spaces, parentheses and C: drive
> letter are mandatory and must be handled correctly
> as a native filename. On Windows, Ocaml isn't necessarily
> even in the path -- because on Windows XP64 I have multiple
> Ocaml versions and I need to *specify* which one to use,
> no accidents from PATH please! (Well actually, we do use
> the PATH but it leads to a mess).
> 

We're  aware  of  that.  However  if  someone have a clear specification of the
quoting  system  on  windows  (the recomended one at least) and the one used by
Cygwin I'm interested.


-- 
Nicolas Pouillard aka Ertai


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

* ocamlbuild
@ 2007-09-05  8:36 skaller
  0 siblings, 0 replies; 8+ messages in thread
From: skaller @ 2007-09-05  8:36 UTC (permalink / raw)
  To: caml-list; +Cc: Erick Tryzelaar

hi .. I've got an ocamlbuild project which is hanging
forever. Top shows 100% CPU and 2% memory. Any ideas how 
this could happen?

I have a suspicion ocamlbuild can't handle directories
properly..

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


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

end of thread, other threads:[~2007-09-05  8:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-05 23:19 ocamlbuild skaller
2007-08-06  7:36 ` [Caml-list] ocamlbuild Adrien
2007-08-06  9:34   ` Adrien
2007-08-06 12:14     ` David Allsopp
2007-08-06 16:19     ` Christophe TROESTLER
2007-08-08  4:12 ` Aleksey Nogin
2007-08-09 18:35 ` Nicolas Pouillard
2007-09-05  8:36 ocamlbuild skaller

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).