caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Stefano Zacchiroli <zack@upsilon.cc>
To: OCaml Mailing List <caml-list@inria.fr>
Cc: Xavier Leroy <xavier.leroy@inria.fr>
Subject: Re: [Caml-list] CamlJava - patch to *build* w/ recent JDK
Date: Tue, 24 Nov 2009 15:00:35 +0100	[thread overview]
Message-ID: <20091124140035.GA18201@usha.takhisis.invalid> (raw)
In-Reply-To: <20091123155537.GA10062@usha.takhisis.invalid>

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

On Mon, Nov 23, 2009 at 04:55:37PM +0100, Stefano Zacchiroli wrote:
> Has anyone successfully built/used CamlJava [1] with recent OCaml and
> the open sourced Sun's JVM (OpenJDK)?  I've tried for a while, but I'm
> stuck at the basics, i.e. making the example shipped with CamlJava work.
> 
> First of all there is some needed gymnastic to build: apparently there
> is no longer _a_ legacy libjvm.so, but several one depending on which
> JRE you choose (at least: "Cacao" and "headless"). Of course they're in
> different dirs and I'm not sure about which is the right way (or even
> criteria) to choose one.

About this, here is a patch for the build system which makes CamlJava
build against both last Sun's JDK 6 (closed source) and last Open JDK.
It mainly account for libjvm.so having been moved around and some
upstream lib/ directory reorganization.

> After having passed through that (with a dirty symlink to one of the two
> libjvm.so), the shipped example fails with an exception while
> initializing the JVM:

This, unfortunately, is still standing :-(

Cheers.


PS I hope I'm not bothering with list + author's Cc, AFAIK there is no
   BTS for CamlJava, so this is my best attempt for both being sure the
   author gets the patch and that the patch is public for consumptions
   by others

-- 
Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime

[-- Attachment #2: camljava-java6.patch --]
[-- Type: text/x-diff, Size: 2578 bytes --]

diff -Naur camljava-0.3.orig/lib/Makefile camljava-0.3/lib/Makefile
--- camljava-0.3.orig/lib/Makefile	2009-11-24 14:43:18.555035491 +0100
+++ camljava-0.3/lib/Makefile	2009-11-24 14:42:07.943485242 +0100
@@ -46,7 +46,7 @@
 	rm -f fr/inria/caml/camljava/*.class
 
 clean::
-	rm -f *.cm? *.[oa]
+	rm -f *.cm? *.[oa] *.cmxa
 
 .SUFFIXES: .ml .mli .cmo .cmi .cmx
 
diff -Naur camljava-0.3.orig/Makefile.config camljava-0.3/Makefile.config
--- camljava-0.3.orig/Makefile.config	2004-07-08 16:02:53.000000000 +0200
+++ camljava-0.3/Makefile.config	2009-11-24 14:52:27.474829525 +0100
@@ -17,7 +17,7 @@
 ## For other platforms, adjust as required and tell us about it.
 
 # Home location for the JDK.  Only used for setting other variables below. 
-JDKHOME=/usr/local/java_1.4.2
+JDKHOME=/usr/lib/jvm/java-6-sun
 
 # Where to find the JNI include files (for compiling the OCaml-JNI C stubs)
 JNIINCLUDES=-I$(JDKHOME)/include -I$(JDKHOME)/include/linux
@@ -25,11 +25,18 @@
 # The library to link with to get the JNI
 JNILIBS=-ljava
 
+# Current architecture identification string, as intended by the JDK.
+# Common values for x86 architectures are "i386" or "amd64". You can find it
+# out by looking for the "*" patch component in the following pattern:
+# $(JDKHOME)/jre/lib/*/libjava.so
+ARCH=amd64
+
 # Additional link-time options to pass to $(CC) when linking with $(JNILIBS)
-JNILIBOPTS=-L$(JDKHOME)/jre/lib/i386/ \
-        -Wl,-rpath,$(JDKHOME)/jre/lib/i386/ \
-        -Wl,-rpath,$(JDKHOME)/jre/lib/i386/client \
-        -Wl,-rpath,$(JDKHOME)/jre/lib/i386/native_threads
+JNILIBOPTS=-L$(JDKHOME)/jre/lib/$(ARCH)/ \
+        -L$(JDKHOME)/jre/lib/$(ARCH)/server \
+        -Wl,-rpath,$(JDKHOME)/jre/lib/$(ARCH)/ \
+        -Wl,-rpath,$(JDKHOME)/jre/lib/$(ARCH)/server \
+        -Wl,-rpath,$(JDKHOME)/jre/lib/$(ARCH)/native_threads
 
 # Additional options when compiling the OCaml-JNI C stubs.
 # -DJDK122_LINUX_HACK works around a nasty thread-related bug of
diff -Naur camljava-0.3.orig/test/jnitest.ml camljava-0.3/test/jnitest.ml
--- camljava-0.3.orig/test/jnitest.ml	2001-06-05 16:01:23.000000000 +0200
+++ camljava-0.3/test/jnitest.ml	2009-11-24 14:37:41.602405336 +0100
@@ -68,4 +68,6 @@
   print_newline()
 
 let _ =
-  test()
+  try
+    test()
+  with exn -> prerr_endline (Printexc.to_string exn)
diff -Naur camljava-0.3.orig/test/Makefile camljava-0.3/test/Makefile
--- camljava-0.3.orig/test/Makefile	2001-06-05 16:01:15.000000000 +0200
+++ camljava-0.3/test/Makefile	2009-11-24 14:44:01.335369289 +0100
@@ -18,3 +18,4 @@
 
 clean::
 	rm -f *.cm?
+	rm -f *.class

  reply	other threads:[~2009-11-24 14:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-23 15:55 CamlJava w/ recent OCaml (3.11.1) and Sun's JVM (OpenJDK) Stefano Zacchiroli
2009-11-24 14:00 ` Stefano Zacchiroli [this message]
2009-12-01 10:52 ` CamlJava w/ recent JVMs - solved (patches needed and included) Stefano Zacchiroli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091124140035.GA18201@usha.takhisis.invalid \
    --to=zack@upsilon.cc \
    --cc=caml-list@inria.fr \
    --cc=xavier.leroy@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).