trouble compiling mtasc

View: New views
5 Messages — Rating Filter:   Alert me  

trouble compiling mtasc

by Patrice Dumas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I am trying to compile mtasc on fedora development, with
ocaml-3.10.2-2.fc10.i386
ocaml-findlib-1.2.1-3.fc10.i386
ocaml-extlib-devel-1.5.1-3.fc10.i386
ocaml-camlp4-devel-3.10.2-2.fc10.i386

I tried with the cvs versions from 4 Jun 2008 and 5 Feb 2007, I get the
mtasc/ swflib/ extc/ directories from cvs and I delete ocaml/extc/zlib/.

After what looks like succesful compilation in extc/ and swflib/, I get the
following errors (in ocaml/mtasc):

$ ocamlfind ocamlopt -c -pp camlp4 parser.ml
File "parser.ml", line 19, characters 0-4:
Parse error: entry [implem] is empty

and
$ ocamlfind ocamlopt -package extlib -c -I .. -I ../extc -I ../swflib typer.ml class.ml plugin.ml genSwf.ml main.ml
File "typer.ml", line 986, characters 57-71:
Unbound value Parser.warning

And then the last command fails with
Cannot find file main.cmx
which I think is a consequence of previous failures.

I have used debian patches in my build, and took example on the debian
build. I attach the patches (one is rebased), though they are not all
relevant for this issue, and here are the commands that lead to this:

cp ocaml/mtasc/doc/Makefile .
make C=ocamlopt O=cmx A=cmxa CU= CP=camlp4

I am a complete ocaml newbie, so I may be doing something completly
stupid. Any clue about what is happening?

--
Pat

diff -up mtasc-cvs04062008/ocaml/mtasc/std/System/capabilities.as.flashlite_compat mtasc-cvs04062008/ocaml/mtasc/std/System/capabilities.as
--- mtasc-cvs04062008/ocaml/mtasc/std/System/capabilities.as.flashlite_compat 2008-06-05 00:30:11.000000000 +0200
+++ mtasc-cvs04062008/ocaml/mtasc/std/System/capabilities.as 2008-06-05 00:30:19.000000000 +0200
@@ -1,7 +1,7 @@
 intrinsic class System.capabilities
 {
  static var hasAudio:Boolean;
- static var hasMP3:Boolean;
+ //static var hasMP3:Boolean;
  static var hasAudioEncoder:Boolean;
  static var hasVideoEncoder:Boolean;
  static var screenResolutionX:Number;
@@ -17,7 +17,7 @@ intrinsic class System.capabilities
  static var os:String;
  static var serverString:String;
  static var version:String;
- static var hasPrinting:Boolean;
+ //static var hasPrinting:Boolean;
  static var playerType:String;
  static var hasStreamingAudio:Boolean;
  static var hasScreenBroadcast:Boolean;

01_exe_in_usage.patch
Paul Wise <pabs@...>
Only show .exe in the usage on Win32
Index: ocaml/mtasc/main.ml
===================================================================
--- ocaml/mtasc/main.ml.orig 2007-05-23 19:01:25.000000000 +1000
+++ ocaml/mtasc/main.ml 2007-05-23 19:01:43.000000000 +1000
@@ -112,7 +112,8 @@
  if do_exit then exit 1
 ;;
 try
- let usage = "Motion-Twin ActionScript2 Compiler 1.13 - (c)2004-2007 Motion-Twin\n Usage : mtasc.exe [options] <files...>\n Options :" in
+ let exe_ext = match Sys.os_type with "Win32" | "Cygwin" -> ".exe" | _ -> "" in
+ let usage = "Motion-Twin ActionScript2 Compiler 1.13 - (c)2004-2007 Motion-Twin\n Usage : mtasc" ^ exe_ext ^ " [options] <files...>\n Options :" in
  let base_path = normalize_path (try Extc.executable_path() with _ -> ".") in
  let files = ref [] in
  let time = Sys.time() in

02_makefile_kludges.patch
Paul Wise <pabs@...>
Kludge the Makefile so it is useful for Debian
--- ocaml/mtasc/doc/Makefile.orig
+++ ocaml/mtasc/doc/Makefile
@@ -1,14 +1,24 @@
 DESTDIR=
 PREFIX=/usr/local
-ZLIB=/usr/lib/libz.so
+ZLIB=-lz
+C=ocamlopt
+O=cmx
+A=cmxa
+CU=
+CP=camlp4o
+#C=ocamlc
+#O=cmo
+#A=cma
+#CU=-custom
+#CP=camlp4
 
 build:
- ( cd ocaml/extc ; ocamlc extc_stubs.c ;\
- ocamlfind ocamlopt -package extlib -a -o extc.cmxa -cclib ../extc/extc_stubs.o -cclib $(ZLIB) extc.mli extc.ml )
- cd ocaml/swflib ; ocamlfind ocamlopt -package extlib -a -o swflib.cmxa -I .. -I ../extc swf.ml swfZip.ml actionScript.ml swfParser.ml
- ( cd ocaml/mtasc ; ocamllex lexer.mll ; ocamlopt -c expr.ml lexer.ml ; ocamlopt -c -pp camlp4o parser.ml ;\
- ocamlfind ocamlopt -package extlib -c -I .. -I ../extc -I ../swflib typer.ml class.ml plugin.ml genSwf.ml main.ml ;\
- ocamlfind ocamlopt -package extlib -linkpkg -o mtasc -cclib $(ZLIB) extLib.cmxa ../extc/extc.cmxa ../swflib/swflib.cmxa expr.cmx lexer.cmx parser.cmx typer.cmx class.cmx plugin.cmx genSwf.cmx main.cmx )
+ ( cd ocaml/extc ; $(C) extc_stubs.c ;\
+ ocamlfind $(C) -package extlib -a -o extc.$(A) -cclib ../extc/extc_stubs.o -cclib $(ZLIB) extc.mli extc.ml )
+ cd ocaml/swflib ; ocamlfind $(C) -package extlib -a -o swflib.$(A) -I .. -I ../extc as3.mli as3code.ml as3parse.ml swf.ml swfZip.ml actionScript.ml swfParser.ml
+ ( cd ocaml/mtasc ; ocamllex lexer.mll ; ocamlfind $(C) -c expr.ml lexer.ml ; ocamlfind $(C) -c -pp $(CP) parser.ml ;\
+ ocamlfind $(C) -package extlib -c -I .. -I ../extc -I ../swflib typer.ml class.ml plugin.ml genSwf.ml main.ml ;\
+ ocamlfind $(C) -package extlib -linkpkg $(CU) -o mtasc -cclib $(ZLIB) ../extc/extc.$(A) ../swflib/swflib.$(A) expr.$(O) lexer.$(O) parser.$(O) typer.$(O) class.$(O) plugin.$(O) genSwf.$(O) main.$(O) )
 
 clean:
  rm -f ocaml/*/*.cma ocaml/*/*.cmi ocaml/*/*.cmo ocaml/*/*.cmx
@@ -16,9 +26,9 @@
  rm -f ocaml/mtasc/lexer.ml ocaml/mtasc/mtasc
 
 install:
- mkdir -p $(DESTDIR)$(PREFIX)/bin/ $(DESTDIR)$(PREFIX)/share/
+ mkdir -p $(DESTDIR)$(PREFIX)/bin/ $(DESTDIR)$(PREFIX)/share/mtasc/
  cp ocaml/mtasc/mtasc $(DESTDIR)$(PREFIX)/bin/
- cp -r ocaml/mtasc/std $(DESTDIR)$(PREFIX)/share/
- cp -r ocaml/mtasc/std8 $(DESTDIR)$(PREFIX)/share/
+ cp -r ocaml/mtasc/std $(DESTDIR)$(PREFIX)/share/mtasc/
+ cp -r ocaml/mtasc/std8 $(DESTDIR)$(PREFIX)/share/mtasc/
 
 .PHONY: build install clean

04_include_dirs.patch
Paul Wise <pabs@...>
Add a couple of paths to the default classpath
Keep the default path, needed during the test build
Fix detection of the executable path
Index: ocaml/mtasc/main.ml
===================================================================
--- ocaml/mtasc/main.ml.orig 2007-05-26 20:13:29.000000000 +1000
+++ ocaml/mtasc/main.ml 2007-05-26 20:13:29.000000000 +1000
@@ -117,7 +117,9 @@
  let base_path = normalize_path (try Extc.executable_path() with _ -> ".") in
  let files = ref [] in
  let time = Sys.time() in
- Plugin.class_path := [base_path;"";"/"];
+ let prefix = "/usr/share/mtasc/" in
+ let local = "/usr/local/share/mtasc/" in
+ Plugin.class_path := [base_path;local;prefix;"";"/"];
  let args_spec = [
  ("-pack",Arg.String (fun path -> files := read_package path @ !files),"<path> : compile all files in target package");
  ("-cp",Arg.String (fun path -> Plugin.class_path := parse_class_path base_path path @ !Plugin.class_path),"<paths> : add classpath");
@@ -133,8 +135,8 @@
  ),": use precompiled mx package");
  ] @ !Plugin.options in
  Arg.parse args_spec (fun file -> files := file :: !files) usage;
- Plugin.class_path := (base_path ^ "std/") :: !Plugin.class_path;
- if !GenSwf.version = Some 8 then Plugin.class_path := (base_path ^ "std8/") :: !Plugin.class_path;
+ Plugin.class_path := (base_path ^ "std/") :: (local ^ "std/") :: (prefix ^ "std/") :: !Plugin.class_path;
+ if !GenSwf.version = Some 8 then Plugin.class_path := (base_path ^ "std8/") :: (local ^ "std8/") :: (prefix ^ "std8/") :: !Plugin.class_path;
  Hashtbl.remove Lexer.keywords "add";
  Parser.warning := (fun msg pos -> report ~do_exit:false (msg,pos) "Warning" (fun msg -> msg));
  if !files = [] then begin
Index: ocaml/extc/extc_stubs.c
===================================================================
--- ocaml/extc/extc_stubs.c.orig 2007-05-26 20:13:28.000000000 +1000
+++ ocaml/extc/extc_stubs.c 2007-05-26 20:13:29.000000000 +1000
@@ -137,14 +137,16 @@
  failwith("executable_path");
  return caml_copy_string(path);
 #else
- const char *p = getenv("_");
- if( p != NULL )
- return caml_copy_string(p);
  {
  char path[200];
  int length = readlink("/proc/self/exe", path, sizeof(path));
- if( length < 0 || length >= 200 )
- failwith("executable_path");
+ if( length < 0 || length >= 200 ){
+ const char *p = getenv("_");
+ if( p != NULL )
+ return caml_copy_string(p);
+ else
+ failwith("executable_path");
+ }
     path[length] = '\0';
  return caml_copy_string(path);
  }

--
MTASC : no more coffee break while compiling

Re: trouble compiling mtasc

by Nicolas Cannasse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Patrice Dumas a écrit :

> Hello,
>
> I am trying to compile mtasc on fedora development, with
> ocaml-3.10.2-2.fc10.i386
> ocaml-findlib-1.2.1-3.fc10.i386
> ocaml-extlib-devel-1.5.1-3.fc10.i386
> ocaml-camlp4-devel-3.10.2-2.fc10.i386
>
> I tried with the cvs versions from 4 Jun 2008 and 5 Feb 2007, I get the
> mtasc/ swflib/ extc/ directories from cvs and I delete ocaml/extc/zlib/.
>
> After what looks like succesful compilation in extc/ and swflib/, I get the
> following errors (in ocaml/mtasc):
>
> $ ocamlfind ocamlopt -c -pp camlp4 parser.ml
> File "parser.ml", line 19, characters 0-4:
> Parse error: entry [implem] is empty

What about simply running without ocamlfind ?

ocamlopt -c -pp camlp4 parser.ml

Also, check that you have a recent OCaml installation ( ~3.08+ )

Nicolas

--
MTASC : no more coffee break while compiling

Re: trouble compiling mtasc

by Patrice Dumas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jun 05, 2008 at 11:12:07AM +0200, Nicolas Cannasse wrote:
>
> What about simply running without ocamlfind ?
>
> ocamlopt -c -pp camlp4 parser.ml

Gives the same:
$ ocamlopt -c -pp camlp4 parser.ml
File "parser.ml", line 19, characters 0-4:
Parse error: entry [implem] is empty
Preprocessor error

> Also, check that you have a recent OCaml installation ( ~3.08+ )

I have ocaml-3.10.2.

--
Pat

--
MTASC : no more coffee break while compiling

Re: trouble compiling mtasc

by Nicolas Cannasse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Patrice Dumas a écrit :

> On Thu, Jun 05, 2008 at 11:12:07AM +0200, Nicolas Cannasse wrote:
>> What about simply running without ocamlfind ?
>>
>> ocamlopt -c -pp camlp4 parser.ml
>
> Gives the same:
> $ ocamlopt -c -pp camlp4 parser.ml
> File "parser.ml", line 19, characters 0-4:
> Parse error: entry [implem] is empty
> Preprocessor error
>
>> Also, check that you have a recent OCaml installation ( ~3.08+ )
>
> I have ocaml-3.10.2.

Sorry, made a mistake. You must use -pp camlp4o instead

Nicolas

--
MTASC : no more coffee break while compiling

Re: trouble compiling mtasc

by Patrice Dumas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jun 05, 2008 at 11:37:22AM +0200, Nicolas Cannasse wrote:
>
> Sorry, made a mistake. You must use -pp camlp4o instead

Indeed, I wrongly used camlp4 instead of camlpo4. It worked perfectly
after that. I made a .spec and a src.rpm for fedora here:

http://www.environnement.ens.fr/perso/dumas/fc-srpms/mtasc-1.13-0.1.cvs04062008.fc10.src.rpm
http://www.environnement.ens.fr/perso/dumas/fc-srpms/mtasc.spec

--
Pat

--
MTASC : no more coffee break while compiling