On Thu, Sep 01, 2005 at 03:38:48PM -0700, Andrew Bruno wrote:
> Hi, 
> 
> I recently ran into the same troubles with Mac OSX.  I'm completely new to
> Inline::Java and not very comfortable with the internals but with a little
> tinkerning I was able to get it working. Not sure if this is the right way but
> attached is a patch file.
> 
> In short, I added some more defaults into Portable.pm for darwin and in
> Java/Makefile.PL I had to change the call to find(..) which passed in
> follow => 1 to follow_fast => 1 because of the symlinks. 
> 
> Then just ran:
> 
> perl perl Makefile.PL
> J2SDK=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
> make java
> make
> make test
> make install
> 
> Well, hope this might be of some help.

Thanks. The patch applied cleanly to a fresh unpack of Inline-Java-0.50;
I double checked that PERL_INLINE_JAVA_JNI and DYLD_LIBRARY_PATH were set;
ran perl Makefile.PL 
J2SDK=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK;
accepted all the defaults; and... got exactly the same error:
        dyld: Symbol not found: _JNI_CreateJavaVM

If it works for you then it I must be doing something wrong. (Are you
selecting to build JNI and have PERL_INLINE_JAVA_JNI env var set true?)

I've CC'd this to macperl-modules@perl.org in the hope that someone
there offer some clues.

Tim.

> On Thu, Sep 01, 2005 at 10:49:41PM +0100, Tim Bunce wrote:
> > On Tue, Aug 30, 2005 at 05:18:45PM -0500, [EMAIL PROTECTED] wrote:
> > >  
> > > > From: Tim Bunce [mailto:[EMAIL PROTECTED] 
> > > > 
> > > > Can't locate file 'libjvm.bundle' anywhere under 
> > > > '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home'
> > > > Writing Makefile for Inline::Java
> > > 
> > > [...]
> > > 
> > > > make[1]: Makefile: No such file or directory
> > > > make[1]: *** No rule to make target `Makefile'.  Stop.
> > > > make: *** [subdirs] Error 2
> > > > 
> > > > Any ideas?
> > > 
> > > Ordinarily a Makefile will be created in both the top-level directory
> > > and the Java/ directory.  I think it bombed out when trying to create
> > > one or the other.
> > 
> > The make failed because the Java/Makefile.PL exits 'successfully' but
> > without creating a Makefile after printing the "Can't locate ..." warning.
> > 
> > > Looking on my office Mac (OS X 10.4.2), I see three libjvm files, none
> > > of which is "libjvm.bundle":
> > > 
> > > /System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Libraries/libjvm.dylib
> > > /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/libjvm.dylib
> > > /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/libjvm_compat.dylib
> > > 
> > > So I think:
> > > 
> > >   a) Perhaps it should be looking for "libjvm.$Config{so}" instead of 
> > > "libjvm.$Config{dlext}".
> > > 
> > >   b) It probably *still* won't find it, so either it needs to be able to
> > > look in other directories besides those under $J2SDK, or you'll have to
> > > create a symlink from somewhere under $J2SDK to
> > > /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Libraries/
> > >  or something.
> > > 
> > > Note that I'm not speaking from the point of view of someone who's
> > > actually got this working - I'm just speculating, since last time I
> > > tried this I was on 10.3, and I never got it working that time either.
> > 
> > Now I come to look again I've made some progress with your help. Thanks!
> > 
> > I've added a symlink in .../Home/lib/libjvm.dylib -> 
> > ../../Libraries/libjvm.dylib
> > (libjvm.dylib is itself a symlink to libhotspot.dylib) and added
> >     JVM_LIB  => "libjvm.$Config{so}",
> >     JVM_SO   => "libjvm.$Config{so}",
> > into the darwin section of Java/Portable.pm
> > 
> > The linker command line now looks like:
> > 
> >  
> > LD_RUN_PATH="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/lib"
> >  env MACOSX_DEPLOYMENT_TARGET=10.3 cc  -bundle -undefined dynamic_lookup
> >  -L/usr/local/lib -L/opt/local/lib JNI.o  -o 
> > ../blib/arch/auto/Inline/Java/JNI/JNI.dylib
> >  -L/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/lib 
> > -ljvm   
> > 
> > and otool -L blib/arch/auto/Inline/Java/JNI/JNI.dylib says:
> > 
> >   blib/arch/auto/Inline/Java/JNI/JNI.dylib:
> >         
> > /System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Libraries/libhotspot.dylib
> >  (compatibility version 1.0.0, current version 1.0.0)
> >         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
> > version 88.0.0)
> > 
> > but the tests still fail with:
> > 
> > t/01_init..............dyld: NSLinkModule() error dyld: Symbol not found: 
> > _JNI_CreateJavaVM
> >   Referenced from: 
> > /Users/timbo/.cpan/sources/authors/id/P/PA/PATL/Inline-Java-0.50/blib/arch/auto/Inline/Java/JNI/JNI.bundle
> >   Expected in: dynamic lookup
> > 
> > I don't have sufficient OSX Foo to know what to try next.
> > Is the _JNI_CreateJavaVM entrypoint in some other library?
> > (grep -l -a -r _JNI_CreateJavaVM ... only finds it in that one.)
> > 
> > Any ideas?
> > 
> > Tim.

> diff -ru Inline-Java-0.50/Java/JVM.pm Inline-Java-0.50-patched/Java/JVM.pm
> --- Inline-Java-0.50/Java/JVM.pm      2005-06-19 06:59:04.000000000 -0700
> +++ Inline-Java-0.50-patched/Java/JVM.pm      2005-08-30 15:31:04.000000000 
> -0700
> @@ -109,7 +109,7 @@
>                       }
>               }
>  
> -             my $java = File::Spec->catfile($o->get_java_config('J2SDK'), 
> 'bin',
> +             my $java = File::Spec->catfile($o->get_java_config('J2SDK'), 
> Inline::Java::Portable::portable("J2SDKBIN"),
>                       ($this->{debugger} ? "jdb" : "java") . 
>                       Inline::Java::Portable::portable("EXE_EXTENSION")) ;
>  
> diff -ru Inline-Java-0.50/Java/Makefile.PL 
> Inline-Java-0.50-patched/Java/Makefile.PL
> --- Inline-Java-0.50/Java/Makefile.PL 2005-02-05 08:53:31.000000000 -0800
> +++ Inline-Java-0.50-patched/Java/Makefile.PL 2005-08-30 15:31:54.000000000 
> -0700
> @@ -71,7 +71,7 @@
>       find(
>               {
>                       wanted => \&search,
> -                     ($symlink ? (follow => 1, follow_skip => 2) : ()),
> +                     ($symlink ? (follow_fast => 1, follow_skip => 2) : ()),
>               },
>               $jdk_dir) ;
>  
> diff -ru Inline-Java-0.50/Java/PerlInterpreter/t/02_perl_interpreter.t 
> Inline-Java-0.50-patched/Java/PerlInterpreter/t/02_perl_interpreter.t
> --- Inline-Java-0.50/Java/PerlInterpreter/t/02_perl_interpreter.t     
> 2004-06-01 19:39:02.000000000 -0700
> +++ Inline-Java-0.50-patched/Java/PerlInterpreter/t/02_perl_interpreter.t     
> 2005-08-30 15:32:26.000000000 -0700
> @@ -42,7 +42,7 @@
>  
>       my $java = File::Spec->catfile(
>               Inline::Java::get_default_j2sdk(),
> -             'bin', 'java' . 
> Inline::Java::Portable::portable("EXE_EXTENSION")) ;
> +             Inline::Java::Portable::portable("J2SDKBIN"), 'java' . 
> Inline::Java::Portable::portable("EXE_EXTENSION")) ;
>  
>       my $debug = $ENV{PERL_INLINE_JAVA_DEBUG} || 0 ;
>       my $cmd = Inline::Java::Portable::portable("SUB_FIX_CMD_QUOTES", 
> "\"$java\" " . 
> diff -ru Inline-Java-0.50/Java/Portable.pm 
> Inline-Java-0.50-patched/Java/Portable.pm
> --- Inline-Java-0.50/Java/Portable.pm 2005-06-19 06:59:04.000000000 -0700
> +++ Inline-Java-0.50-patched/Java/Portable.pm 2005-08-30 15:33:59.000000000 
> -0700
> @@ -160,6 +160,7 @@
>               PRE_WHOLE_ARCHIVE       =>  '-Wl,--whole-archive',
>               POST_WHOLE_ARCHIVE      =>  '-Wl,--no-whole-archive',
>               PERL_PARSE_DUP_ENV      =>  '-DPERL_PARSE_DUP_ENV',
> +        J2SDKBIN             =>  'bin',
>               BUILD_JNI_BY_DFLT       =>  1,
>       } ;
>  
> @@ -225,6 +226,12 @@
>               darwin => {
>                       # Suggested by Ken Williams, mailing list 2004/07/07
>                       SO_EXT                          =>      $Config{so},
> +                     JVM_LIB                         =>      "libjvm.dylib",
> +                     JVM_SO                          =>      "libjvm.dylib",
> +                     PRE_WHOLE_ARCHIVE       =>  '-Wl',
> +                     POST_WHOLE_ARCHIVE      =>  '-Wl',
> +                 GOT_SYMLINK                 =>      1,
> +            J2SDKBIN         =>  'Commands',
>               },
>       } ;
>  
> diff -ru Inline-Java-0.50/Java.pm Inline-Java-0.50-patched/Java.pm
> --- Inline-Java-0.50/Java.pm  2005-06-19 06:58:10.000000000 -0700
> +++ Inline-Java-0.50-patched/Java.pm  2005-08-30 15:34:41.000000000 -0700
> @@ -357,7 +357,7 @@
>               close(Inline::Java::JAVA) ;
>  
>               # ... and compile it.
> -             my $javac = File::Spec->catfile($o->get_java_config('J2SDK'), 
> 'bin', 
> +             my $javac = File::Spec->catfile($o->get_java_config('J2SDK'), 
> Inline::Java::Portable::portable("J2SDKBIN"), 
>               "javac" . Inline::Java::Portable::portable("EXE_EXTENSION")) ;
>               my $redir = Inline::Java::Portable::portable("IO_REDIR") ;
>  
> diff -ru Inline-Java-0.50/Makefile.PL Inline-Java-0.50-patched/Makefile.PL
> --- Inline-Java-0.50/Makefile.PL      2005-06-19 10:17:35.000000000 -0700
> +++ Inline-Java-0.50-patched/Makefile.PL      2005-08-30 15:36:39.000000000 
> -0700
> @@ -47,9 +47,10 @@
>  
>  # Check directory
>  my $ext = Inline::Java::Portable::portable('EXE_EXTENSION') ;
> +my $jdkbin = Inline::Java::Portable::portable('J2SDKBIN') ;
>  foreach my $f ('javac', 'jar', 'java'){
> -     if (! -x File::Spec->catfile($jdk_dir, 'bin', $f . $ext)){
> -             my $bf = File::Spec->catfile('bin', $f . $ext) ;
> +     if (! -x File::Spec->catfile($jdk_dir, $jdkbin, $f . $ext)){
> +             my $bf = File::Spec->catfile($jdkbin, $f . $ext) ;
>               print "Can't locate file '$bf' anywhere under '$jdk_dir'\n" ;
>       }
>  }
> @@ -86,8 +87,8 @@
>  
>  
>  # We will now add the building of our Java files to the Makefile.
> -my $javac = File::Spec->catfile($jdk_dir, 'bin', 'javac' . $ext) ;
> -my $jar = File::Spec->catfile($jdk_dir, 'bin', 'jar' . $ext) ;               
>        
> +my $javac = File::Spec->catfile($jdk_dir, 
> Inline::Java::Portable::portable('J2SDKBIN'), 'javac' . $ext) ;
> +my $jar = File::Spec->catfile($jdk_dir, 
> Inline::Java::Portable::portable('J2SDKBIN'), 'jar' . $ext) ;
>  my $src_dir = File::Spec->catdir('Java', 'sources', 'org', 'perl', 'inline', 
> 'java') ;
>  my $src = File::Spec->catfile($src_dir, '*.java') ;
>  my $obj_dir = File::Spec->catdir('Java', 'classes') ;

Reply via email to