On Thu, Sep 01, 2005 at 08:15:29PM -0400, Patrick LeBoutillier wrote: > Hi guys, > > Sorry but I can't help you out here since I don't have access to a Mac OS X > machine (as a matter of fact I have never even used one...).
[obligatory recommendation elided] > I don't know about the JNI bit, but the default client/server should > be able to work. > > Tim, in your first post you were almost there, having problems only > with the tests that fork themselves to connect to a "shared" JVM. I > noticed that you sometimes ran into errors like this: > > Can't locate object method "new" via package "t10::t10" ... > > Normally these sorts of errors happen when Inline::Java died and the > cache file that contains the information about the Java class is > incomplete/empty. If you remove the Inline directory (in this case > _Inline_test), you should see the "real" error pop up again. I don't > know about the "Bad file descriptor" error though... > > Anyways if you need more info on how things work or if you come up > with a patch that I can include (maybe Andy's is ok as is?), It helped but didn't address the JNI issues. I've attached a patch to to on top of Andy's that fixes JNI for OSX. (The last hunk is messy due to fixing the indentation, but the only significant addition is OTHERLDFLAGS => '-framework JavaVM') Tim. > On 9/1/05, Andrew Bruno <[EMAIL PROTECTED]> 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. > > > > --Andy > > > > 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. > > > > > > > > > -- > ===================== > Patrick LeBoutillier > Laval, Qu?bec, Canada
diff -u -r Inline-Java-0.50.andy-patch/Java/Makefile.PL Inline-Java-0.50.tb/Java/Makefile.PL --- Inline-Java-0.50.andy-patch/Java/Makefile.PL 2005-09-02 17:17:35.000000000 +0100 +++ Inline-Java-0.50.tb/Java/Makefile.PL 2005-09-02 17:32:26.000000000 +0100 @@ -162,6 +162,7 @@ PMLIBDIRS => [File::Spec->catdir('sources', 'org', 'perl', 'inline', 'java')], INC => join(' ', @main::I), LIBS => [join(' ', @main::L) . " -ljvm"], + dynamic_lib => { OTHERLDFLAGS => Inline::Java::Portable::portable('OTHERLDFLAGS') }, # CCFLAGS => '-D_REENTRANT', ) ; } diff -u -r Inline-Java-0.50.andy-patch/Java/Portable.pm Inline-Java-0.50.tb/Java/Portable.pm --- Inline-Java-0.50.andy-patch/Java/Portable.pm 2005-09-02 17:17:35.000000000 +0100 +++ Inline-Java-0.50.tb/Java/Portable.pm 2005-09-02 17:30:57.000000000 +0100 @@ -162,6 +162,7 @@ PERL_PARSE_DUP_ENV => '-DPERL_PARSE_DUP_ENV', J2SDKBIN => 'bin', BUILD_JNI_BY_DFLT => 1, + OTHERLDFLAGS => '', } ; my $map = { @@ -226,12 +227,15 @@ darwin => { # Suggested by Ken Williams, mailing list 2004/07/07 SO_EXT => $Config{so}, + # Andrew Bruno: JVM_LIB => "libjvm.dylib", JVM_SO => "libjvm.dylib", - PRE_WHOLE_ARCHIVE => '-Wl', - POST_WHOLE_ARCHIVE => '-Wl', - GOT_SYMLINK => 1, - J2SDKBIN => 'Commands', + PRE_WHOLE_ARCHIVE => '-Wl', + POST_WHOLE_ARCHIVE => '-Wl', + GOT_SYMLINK => 1, + J2SDKBIN => 'Commands', + # Tim Bunce: + OTHERLDFLAGS => '-framework JavaVM', }, } ;