On Wed, 29 Oct 2014 16:52:13 +0000, Jurica Stanojkovic wrote:

> I have tried to build libinline-java-perl_0.53-3 from Debian on mips.
> Package FTBFS on mips.
> 
> But same package (libinline-java-perl_0.53-3) can be built from same source 
> manually with following commands:
>   perl Makefile.PL J2SDK=/usr/
>   make
>   make test
> 
> If built manually all tests pass on mips.
> 
> Can someone please help with this issue?

Interesting finding, thank you!

What J2SDK does is choosing the Java version to use.
And probably it should be something like J2SDK=/usr/lib/jvm/...

And with or without it, /usr/bin/javac -> /etc/alternatives/javac ->
/usr/lib/jvm/java-7-openjdk-$arch/bin/javac is called. If we'd want
to change this we'd need to set JAVA_HOME presumably.

Some tests, with your example of J2SDK=/usr/:


1) amd64 without the variable, tests pass:

Welcome to the Inline::Java installation procedure.

Using /usr/lib/jvm/default-java as J2SDK directory.

Default J2SDK for Inline::Java will be '/usr/lib/jvm/default-java'.
See module documentation for information on how to use a different J2SDK
or change this default value.
[..]
Building with:
  /usr/lib/jvm/default-java/include/jni.h
  /usr/lib/jvm/default-java/include/jni_md.h
  /usr/lib/jvm/default-java/jre/lib/amd64/server/libjvm.so


2) amd64 with the variable, tests pass:

Welcome to the Inline::Java installation procedure.

Default J2SDK for Inline::Java will be '/usr/'.
See module documentation for information on how to use a different J2SDK
or change this default value.
[..]
Building with:
  /usr/lib/jvm/java-1.7.0-openjdk-amd64/include/jni.h
  /usr/lib/jvm/java-1.7.0-openjdk-amd64/include/jni_md.h
  /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server/libjvm.so

1) and 2) shouldn't be different since /usr/lib/jvm/default-java is a
symlink to java-1.7.0-openjdk-amd64.


3) mips without the variable:

Welcome to the Inline::Java installation procedure.

Using /usr/lib/jvm/default-java as J2SDK directory.

Default J2SDK for Inline::Java will be '/usr/lib/jvm/default-java'.
See module documentation for information on how to use a different J2SDK
or change this default value.
[..]
Building with:
  /usr/lib/jvm/default-java/include/jni.h
  /usr/lib/jvm/default-java/include/jni_md.h
  /usr/lib/jvm/default-java/jre/lib/mips/server/libjvm.so

We don't even get to tests, since the build fails earlier:

/usr/bin/perl /usr/share/perl/5.20.1/ExtUtils/xsubpp  -typemap 
/usr/share/perl/5.20/ExtUtils/typemap -typemap typemap  JNI.xs > JNI.xsc && mv 
JNI.xsc JNI.c
cc -c  -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include 
-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe 
-fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -g -O2 -fstack-protector-strong -Wformat 
-Werror=format-security -Wall -D_FORTIFY_SOURCE=2   -DVERSION=\"0.53\" 
-DXS_VERSION=\"0.53\" -fPIC "-I/usr/lib/mips-linux-gnu/perl/5.20/CORE"   JNI.c
JNI.xs: In function 'check_exception_from_perl':
JNI.xs:51:3: error: format not a string literal and no format arguments 
[-Werror=format-security]
   croak(msg) ;
   ^
JNI.c: In function 'XS_Inline__Java__JNI_new':
JNI.c:291:9: warning: unused variable 'CLASS' [-Wunused-variable]
  char * CLASS = (char *)SvPV_nolen(ST(0))
         ^
JNI.c: In function 'XS_Inline__Java__JNI_shutdown':
JNI.c:417:13: warning: cast to pointer from integer of different size 
[-Wint-to-pointer-cast]
      this = (InlineJavaJNIVM *)SvIV((SV*)SvRV(ST(0))) ;
             ^
JNI.c: In function 'XS_Inline__Java__JNI_DESTROY':
JNI.c:443:13: warning: cast to pointer from integer of different size 
[-Wint-to-pointer-cast]
      this = (InlineJavaJNIVM *)SvIV((SV*)SvRV(ST(0))) ;
             ^
JNI.c: In function 'XS_Inline__Java__JNI_create_ijs':
JNI.c:474:13: warning: cast to pointer from integer of different size 
[-Wint-to-pointer-cast]
      this = (InlineJavaJNIVM *)SvIV((SV*)SvRV(ST(0))) ;
             ^
JNI.c: In function 'XS_Inline__Java__JNI_process_command':
JNI.c:514:13: warning: cast to pointer from integer of different size 
[-Wint-to-pointer-cast]
      this = (InlineJavaJNIVM *)SvIV((SV*)SvRV(ST(0))) ;
             ^
In file included from /usr/lib/mips-linux-gnu/perl/5.20/CORE/perl.h:5089:0,
                 from JNI.xs:2:
JNI.c: In function 'XS_Inline__Java__JNI_DESTROY':
/usr/lib/mips-linux-gnu/perl/5.20/CORE/embed.h:483:22: warning: 'this' may be 
used uninitialized in this function [-Wmaybe-uninitialized]
 #define safesysfree  Perl_safesysfree
                      ^
JNI.c:440:20: note: 'this' was declared here
  InlineJavaJNIVM * this;
                    ^
JNI.c: In function 'XS_Inline__Java__JNI_shutdown':
JNI.xs:250:2: warning: 'this' may be used uninitialized in this function 
[-Wmaybe-uninitialized]
  shutdown_JVM(this) ;
  ^
JNI.c:414:20: note: 'this' was declared here
  InlineJavaJNIVM * this;
                    ^
JNI.c: In function 'XS_Inline__Java__JNI_process_command':
JNI.xs:295:9: warning: 'this' may be used uninitialized in this function 
[-Wmaybe-uninitialized]
  resp = (*(env))->CallObjectMethod(env, this->ijs, this->process_command_mid, 
cmd) ;
         ^
JNI.c:500:20: note: 'this' was declared here
  InlineJavaJNIVM * this;
                    ^
JNI.c: In function 'XS_Inline__Java__JNI_create_ijs':
JNI.xs:273:14: warning: 'this' may be used uninitialized in this function 
[-Wmaybe-uninitialized]
  this->ijs = (*(env))->CallStaticObjectMethod(env, this->ijs_class, 
this->jni_main_mid, this->debug, this->native_doubles) ;
              ^
JNI.c:467:20: note: 'this' was declared here
  InlineJavaJNIVM * this;
                    ^
cc1: some warnings being treated as errors
Makefile:413: recipe for target 'JNI.o' failed
make[2]: *** [JNI.o] Error 1


Hm, no idea why this "JNI.xs:51:3: error:" only appears on mips?!


4) mips with the variable:

Welcome to the Inline::Java installation procedure.

Default J2SDK for Inline::Java will be '/usr/'.
See module documentation for information on how to use a different J2SDK
or change this default value.
[..]
Building with:
  /usr/lib/jvm/java-7-openjdk-mips/include/jni.h
  /usr/lib/jvm/java-7-openjdk-mips/include/jni_md.h
  /usr/lib/jvm/java-1.7.0-openjdk-mips/jre/lib/mips/server/libjvm.so


And then the build fails with the same error.

But again, /usr/lib/jvm/default-java is a symlink to
java-7-openjdk-mips, so setting J2SDK or not shouldn't make a
difference.


5) mips without the variable, and with a patch for JNI.xs:

Yay, no more build errors :)
But the tests fail.


6) mips with the variable, and with a patch for JNI.xs:

Tests still fail, even the first one.

Also interesting: lintian (on amd64) says:
W: libinline-java-perl: incompatible-java-bytecode-format Java7 version (Class 
format: 51)


Conclusions:
- not sure :)
- but setting J2SDK=/usr doesn't (unsurprisingly) change anything
  in a mips sid chroot where the one and only Java is openjdk-7
- next time please provide a bit more information, like
  environment/java version, and log excerpts


Cheers,
gregor


Footnotes:
i) J2SDK in debian/rules:

#v+
--- a/debian/rules
+++ b/debian/rules
@@ -29,6 +29,9 @@ DEB_UPSTREAM_PACKAGE = Inline-Java
 DEB_UPSTREAM_URL = http://www.cpan.org/modules/by-module/Inline
 DEB_UPSTREAM_TARBALL_MD5 = 23f96c2ac4915302c3647c0abc92916f

+# pass J2SDK=/usr/ to perl Makefile.PL, cf. #754755
+DEB_MAKEMAKER_INVOKE += J2SDK=/usr/
+
 # Needed both by upstream build and at runtime
 deps = libinline-perl, default-jdk | java-compiler
#v-

ii) patch for Java/JNI.xs:
#v+
--- a/Java/JNI.xs
+++ b/Java/JNI.xs
@@ -48,7 +48,7 @@
    if ((*(env))->ExceptionCheck(env)){
        (*(env))->ExceptionDescribe(env) ;
        (*(env))->ExceptionClear(env) ;
-       croak(msg) ;
+       croak("%s", msg) ;
    }
 }
 
#v-
-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: David Bowie: Tvc 15

Attachment: signature.asc
Description: Digital Signature

Reply via email to