Skip Menu |
 

This queue is for tickets about the Inline-Java CPAN distribution.

Report information
The Basics
Id: 119307
Status: resolved
Priority: 0/
Queue: Inline-Java

People
Owner: Nobody in particular
Requestors: MPERRY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.58
Fixed in: (no value)



Subject: perl Makefile.PL reports "/usr/bin/dlltool: Can't open def file: jvm.def"
I'm trying to build Inline::Java 0.58 on Cygwin with Perl 5.22. When I run "perl Makefile.PL" part of the output says: /usr/bin/dlltool: Can't open def file: jvm.def Error attempting to create '/cygdrive/c/PROGRA~2/Java/jdk1.8.0_112/lib/libjvm.dll.a' I'm also worried about it saying that it's attempting to write a file to /cygdrive/c/PROGRA~2/Java/jdk1.8.0_112 as that's a protected directory and it won't have permission to write to there (nor should it). Here is the full output: mperry@mperry-PC:~/Inline-Java-0.58$ echo $JAVA_HOME /cygdrive/c/PROGRA~2/Java/jdk1.8.0_112 mperry@mperry-PC:~/Inline-Java-0.58$ perl Makefile.PL Welcome to the Inline::Java installation procedure. Using /cygdrive/c/PROGRA~2/Java/jdk1.8.0_112 as J2SDK directory. Default J2SDK for Inline::Java will be '/cygdrive/c/PROGRA~2/Java/jdk1.8.0_112'. See module documentation for information on how to use a different J2SDK or change this default value. Checking if your kit is complete... Looks good Inline::Java can use a JNI extension that allows the Java Virtual Machine (JVM) to be dynamically linked with Perl instead of running as a separate process. The use of this extension is optional, and building it still allows Inline::Java to run the JVM in the default (separate process) fashion. Note: You need a C compiler to build the extension. Do you wish to build the JNI extension? [y] Building JNI extension. 1) /cygdrive/c/PROGRA~2/Java/jdk1.8.0_112/jre/bin/server 2) /cygdrive/c/PROGRA~2/Java/jdk1.8.0_112/jre/bin/client Please select from the above list which 'jvm.dll' to use: [2] Creating '/cygdrive/c/PROGRA~2/Java/jdk1.8.0_112/lib/libjvm.dll.a' for cygwin. /usr/bin/dlltool: Can't open def file: jvm.def Error attempting to create '/cygdrive/c/PROGRA~2/Java/jdk1.8.0_112/lib/libjvm.dll.a' Building with: /cygdrive/c/PROGRA~2/Java/jdk1.8.0_112/include/jni.h /cygdrive/c/PROGRA~2/Java/jdk1.8.0_112/include/win32/jni_md.h /cygdrive/c/PROGRA~2/Java/jdk1.8.0_112/lib/jvm.lib /cygdrive/c/PROGRA~2/Java/jdk1.8.0_112/jre/bin/client/jvm.dll Note: In order for Inline::Java to use the JNI extension, you will need to use the JNI configuration option or set the PERL_INLINE_JAVA_JNI environment variable to a true value. You will also need to add the following directories to your PATH environment variable: /cygdrive/c/PROGRA~2/Java/jdk1.8.0_112/jre/bin/client /cygdrive/c/PROGRA~2/Java/jdk1.8.0_112/jre/bin See README.JNI for more information. The PerlInterpreter extension allows Inline::Java to be loaded directly from Java using an embedded Perl interpreter. It is still EXPERIMENTAL and may not build or work properly on all platforms. See documentation for more details. Do you wish to build the PerlInterpreter extension? [n] Warning (mostly harmless): No library found for -ljvm Generating a Unix-style Makefile Writing Makefile for Inline::Java::JNI Writing MYMETA.yml and MYMETA.json Generating a Unix-style Makefile Writing Makefile for Inline::Java Writing MYMETA.yml and MYMETA.json You can continue the installation with the following commands: % make % make test % make install
Download (untitled) / with headers
text/plain 119b
I confess to near-total ignorance of the Cygwin platform. Is this still a problem? If so, what happens on "make test"?
Download (untitled) / with headers
text/plain 965b
On Tue Apr 03 14:28:47 2018, ETJ wrote: Show quoted text
> I confess to near-total ignorance of the Cygwin platform. > > Is this still a problem? If so, what happens on "make test"?
Cygwin is a Linux-like environment that runs on Windows. I will do my best to answer any questions you have about it. I retested with Perl 5.24 and Inline::Java 0.65. It still fails with the same errors. I've attached a text file with the output of running "perl Makefile.PL" and "make test". I noticed two issues. 1. "perl Makefile.PL" outputs "/usr/bin/dlltool: Can't open def file: jvm.def". I can't find a jvm.def file. Line 118 of Java/Makefile.PL references that file in a block that's only run on Cygwin. It looks like it was removed in this commit: https://github.com/ingydotnet/Inline-Java/commit/c2a4516ee917814de79643c4019d1b3456cb13ec 2. The same line in Java/Makefile.PL also is attempting to write to the JDK's directory. It fails because the directory is owned by the superuser.
Subject: make-output.txt
Download make-output.txt
text/plain 8.7k
mperry@mperry-PC:~/Inline-Java-0.65$ perl Makefile.PL Welcome to the Inline::Java installation procedure. Using /cygdrive/c/PROGRA~1/Java/jdk-9.0.4 as J2SDK directory. Default J2SDK for Inline::Java will be '/cygdrive/c/PROGRA~1/Java/jdk-9.0.4'. See module documentation for information on how to use a different J2SDK or change this default value. Checking if your kit is complete... Looks good Building JNI extension. Creating '/cygdrive/c/PROGRA~1/Java/jdk-9.0.4/lib/libjvm.dll.a' for cygwin. /usr/bin/dlltool: Can't open def file: jvm.def Error attempting to create '/cygdrive/c/PROGRA~1/Java/jdk-9.0.4/lib/libjvm.dll.a' Building with: /cygdrive/c/PROGRA~1/Java/jdk-9.0.4/include/jni.h /cygdrive/c/PROGRA~1/Java/jdk-9.0.4/include/win32/jni_md.h /cygdrive/c/PROGRA~1/Java/jdk-9.0.4/lib/jvm.lib /cygdrive/c/PROGRA~1/Java/jdk-9.0.4/bin/server/jvm.dll Note: In order for Inline::Java to use the JNI extension, you will need to use the JNI configuration option or set the PERL_INLINE_JAVA_JNI environment variable to a true value. You will also need to add the following directories to your PATH environment variable: /cygdrive/c/PROGRA~1/Java/jdk-9.0.4/bin/server See README.JNI for more information. The PerlInterpreter extension allows Inline::Java to be loaded directly from Java using an embedded Perl interpreter. It is still EXPERIMENTAL and may not build or work properly on all platforms. See documentation for more details. Do you wish to build the PerlInterpreter extension? [n] n Warning (mostly harmless): No library found for -ljvm Writing MYMETA.yml and MYMETA.json Generating a Unix-style Makefile Writing Makefile for Inline::Java Writing MYMETA.yml and MYMETA.json mperry@mperry-PC:~/Inline-Java-0.65$ make test "/cygdrive/c/PROGRA~1/Java/jdk-9.0.4/bin/javac.exe" -deprecation -g -d Java/classes Java/sources/org/perl/inline/java/InlineJavaArray.java Java/sources/org/perl/inline/java/InlineJavaCallback.java Java/sources/org/perl/inline/java/InlineJavaCallbackQueue.java Java/sources/org/perl/inline/java/InlineJavaCastException.java Java/sources/org/perl/inline/java/InlineJavaClass.java Java/sources/org/perl/inline/java/InlineJavaException.java Java/sources/org/perl/inline/java/InlineJavaHandle.java Java/sources/org/perl/inline/java/InlineJavaInvocationTargetException.java Java/sources/org/perl/inline/java/InlineJavaPerlCaller.java Java/sources/org/perl/inline/java/InlineJavaPerlException.java Java/sources/org/perl/inline/java/InlineJavaPerlInterpreter.java Java/sources/org/perl/inline/java/InlineJavaPerlNatives.java Java/sources/org/perl/inline/java/InlineJavaPerlObject.java Java/sources/org/perl/inline/java/InlineJavaProtocol.java Java/sources/org/perl/inline/java/InlineJavaServer.java Java/sources/org/perl/inline/java/InlineJavaServerThread.java Java/sources/org/perl/inline/java/InlineJavaThrown.java Java/sources/org/perl/inline/java/InlineJavaUserClassLink.java Java/sources/org/perl/inline/java/InlineJavaUserClassLoader.java Java/sources/org/perl/inline/java/InlineJavaUtils.java make[1]: Entering directory '/home/mperry/Inline-Java-0.65/Java' cp JNI.pm ../blib/lib/Inline/Java/JNI.pm cp sources/org/perl/inline/java/InlineJavaClass.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaClass.java cp sources/org/perl/inline/java/InlineJavaProtocol.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaProtocol.java cp sources/org/perl/inline/java/InlineJavaCastException.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaCastException.java cp sources/org/perl/inline/java/InlineJavaCallbackQueue.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaCallbackQueue.java cp sources/org/perl/inline/java/InlineJavaUtils.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaUtils.java cp sources/org/perl/inline/java/InlineJavaThrown.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaThrown.java cp sources/org/perl/inline/java/InlineJavaServerThread.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaServerThread.java cp sources/org/perl/inline/java/InlineJavaCallback.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaCallback.java cp sources/org/perl/inline/java/InlineJavaPerlObject.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaPerlObject.java cp sources/org/perl/inline/java/InlineJavaServer.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaServer.java cp sources/org/perl/inline/java/InlineJavaPerlNatives.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaPerlNatives.java cp sources/org/perl/inline/java/InlineJavaException.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaException.java cp sources/org/perl/inline/java/InlineJavaPerlInterpreter.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaPerlInterpreter.java cp sources/org/perl/inline/java/InlineJavaUserClassLink.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaUserClassLink.java cp sources/org/perl/inline/java/InlineJavaHandle.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaHandle.java cp sources/org/perl/inline/java/InlineJavaArray.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaArray.java cp sources/org/perl/inline/java/InlineJavaInvocationTargetException.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaInvocationTargetException.java cp sources/org/perl/inline/java/InlineJavaPerlException.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaPerlException.java cp sources/org/perl/inline/java/InlineJavaPerlCaller.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaPerlCaller.java cp sources/org/perl/inline/java/InlineJavaUserClassLoader.java ../blib/lib/Inline/Java/sources/org/perl/inline/java/InlineJavaUserClassLoader.java "/cygdrive/c/PROGRA~1/Java/jdk-9.0.4/bin/jar.exe" cf lib/Inline/Java/InlineJavaServer.jar -C Java/classes org -C Java/classes InlineJava.properties "/home/mperry/perl5/perlbrew/perls/perl-5.24.0/bin/perl.exe" "/home/mperry/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/ExtUtils/xsubpp" -typemap '/home/mperry/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/ExtUtils/typemap' -typemap '/home/mperry/Inline-Java-0.65/Java/typemap' JNI.xs > JNI.xsc "/cygdrive/c/PROGRA~1/Java/jdk-9.0.4/bin/jar.exe" cf lib/Inline/Java/InlineJavaUser.jar -C Java/classes InlineJavaUserClassLink.class Running Mkbootstrap for JNI () chmod 644 "JNI.bs" mv JNI.xsc JNI.c gcc -c -I/cygdrive/c/PROGRA~1/Java/jdk-9.0.4/include -I/cygdrive/c/PROGRA~1/Java/jdk-9.0.4/include/win32 -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_FORTIFY_SOURCE=2 -DUSEIMPORTLIB -O3 -DVERSION=\"0.53_90\" -DXS_VERSION=\"0.53_90\" "-I/home/mperry/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/cygwin-thread-multi/CORE" JNI.c "/home/mperry/perl5/perlbrew/perls/perl-5.24.0/bin/perl.exe" -MExtUtils::Command::MM -e 'cp_nonempty' -- JNI.bs ../blib/arch/auto/Inline/Java/JNI/JNI.bs 644 cp lib/Inline/Java/InlineJavaUser.jar blib/lib/Inline/Java/InlineJavaUser.jar cp lib/Inline/Java/Array.pm blib/lib/Inline/Java/Array.pm cp lib/Inline/Java/Class.pm blib/lib/Inline/Java/Class.pm cp lib/Inline/Java/Callback.pm blib/lib/Inline/Java/Callback.pm cp lib/Inline/Java/Protocol.pm blib/lib/Inline/Java/Protocol.pm cp lib/Inline/Java/default_j2sdk.pl blib/lib/Inline/Java/default_j2sdk.pl cp lib/Inline/Java/Object.pm blib/lib/Inline/Java/Object.pm cp lib/Inline/Java.pod blib/lib/Inline/Java.pod cp lib/Inline/Java.pm blib/lib/Inline/Java.pm cp lib/Inline/Java/Portable.pm blib/lib/Inline/Java/Portable.pm cp lib/Inline/Java/Server.pm blib/lib/Inline/Java/Server.pm cp lib/Inline/Java/InlineJavaServer.jar blib/lib/Inline/Java/InlineJavaServer.jar cp lib/Inline/Java/Handle.pm blib/lib/Inline/Java/Handle.pm cp lib/Inline/Java/Callback.pod blib/lib/Inline/Java/Callback.pod rm -f ../blib/arch/auto/Inline/Java/JNI/JNI.dll cp lib/Inline/Java/JVM.pm blib/lib/Inline/Java/JVM.pm g++ --shared -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -L/usr/local/lib -fstack-protector-strong JNI.o -o ../blib/arch/auto/Inline/Java/JNI/JNI.dll \ /home/mperry/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/cygwin-thread-multi/CORE/cygperl5_24_0.dll \ JNI.o:JNI.c:(.text+0xe1d): undefined reference to `__imp_JNI_GetCreatedJavaVMs' JNI.o:JNI.c:(.text+0xe1d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_JNI_GetCreatedJavaVMs' JNI.o:JNI.c:(.text+0x1022): undefined reference to `__imp_JNI_CreateJavaVM' JNI.o:JNI.c:(.text+0x1022): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_JNI_CreateJavaVM' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:477: ../blib/arch/auto/Inline/Java/JNI/JNI.dll] Error 1 make[1]: Leaving directory '/home/mperry/Inline-Java-0.65/Java' make: *** [Makefile:511: subdirs] Error 2
Download (untitled) / with headers
text/plain 259b
I've figured out what was wrong. I've attached a patch, and I'll send you a pull request on GitHub. I've restored the jvm.def file that was removed. Then I have Makefile.PL create the jvm.dll file in the current directory and link with it during compilation.
Subject: rt119307.patch
Download rt119307.patch
text/x-diff 1.4k
diff -Naur Inline-Java-0.65-old/Java/jvm.def Inline-Java-0.65/Java/jvm.def --- Inline-Java-0.65-old/Java/jvm.def 1969-12-31 16:00:00.000000000 -0800 +++ Inline-Java-0.65/Java/jvm.def 2018-04-04 17:10:53.509828900 -0700 @@ -0,0 +1,4 @@ +EXPORTS +JNI_CreateJavaVM@12 +JNI_GetDefaultJavaVMInitArgs@4 +JNI_GetCreatedJavaVMs@12 diff -Naur Inline-Java-0.65-old/Java/Makefile.PL Inline-Java-0.65/Java/Makefile.PL --- Inline-Java-0.65-old/Java/Makefile.PL 2018-02-09 22:05:13.000000000 -0800 +++ Inline-Java-0.65/Java/Makefile.PL 2018-04-04 17:15:46.212570500 -0700 @@ -113,10 +113,10 @@ # Cygwin: create gcc-compatible library wrapper for jvm.dll if ($^O eq 'cygwin') { - my $dll = File::Spec->catfile($jdk_dir, 'lib', 'libjvm.dll.a') ; + my $dll = File::Spec->catfile(Cwd::cwd, 'libjvm.dll.a') ; print "Creating '$dll' for cygwin.\n\n" ; system("/usr/bin/dlltool --input-def jvm.def --kill-at --dllname jvm.dll --output-lib '$dll'") - and print "Error attempting to create '$jdk_dir/lib/libjvm.dll.a'\n" ; + and print "Error attempting to create '$dll'\n" ; } print "Building with:\n" ; @@ -137,6 +137,9 @@ ($files->{'jni.h'}->{selected}, $files->{'jni_md.h'}->{selected}) ; @main::L = map { Inline::Java::Portable::portable('SUB_FIX_MAKE_QUOTES', "-L$_") } ($files->{$jvm_lib}->{selected}) ; + if ($^O eq 'cygwin') { + push @main::L, Inline::Java::Portable::portable('SUB_FIX_MAKE_QUOTES', '-L' . Cwd::cwd); + } my $DIR = [] ; if (! defined($build_perl_interpreter)){
Download (untitled) / with headers
text/plain 131b
(For posterity - Matt figured a way to do without the .def file, which I preferred as more future-proof) Released as 0.66. Thanks!


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.