[Rd] r-base: FTBFS: Add "${boot_path}/zero" for OpenJDK zero build

zhangdandan zh@ngd@nd@n @end|ng |rom |oong@on@cn
Thu Apr 17 05:40:51 CEST 2025


Source: r-base
Version: 4.5.0-1
Severity: normal
Tags: FTBFS patch
User: debian-loongarch using lists.debian.org
Usertags: loong64

Hi maintainers,

Compiling the rjava 1.0-11-1 failed for loong64 in the Debian Package 
Auto-Building environment.
The build error log(build error on 10 architectures)  is as follows,
```
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/lib/jvm/default-java/bin/java'
archiver    : '/usr/lib/jvm/default-java/bin/jar'
compiler    : '/usr/lib/jvm/default-java/bin/javac'
header prep.: ''
cpp flags   : ''
java libs   : ''
configure: error: One or more Java configuration variables are not set.
```
The full log of rjava can be found at
https://buildd.debian.org/status/package.php?p=rjava&suite=sid
https://buildd.debian.org/status/fetch.php?pkg=rjava&arch=loong64&ver=1.0-11-2&stamp=1744704288&raw=0

After analysis, the reason is that libjvm.so is not found when compiling 
rjava(depend r-base).
For loong64 or other architectures(build zero in openjdk-21), libjvm.so 
was supported in /usr/lib/jvm/default-java/lib/zero/ [1][2], not 
/usr/lib/jvm/default-java/lib/server/.
So we need to add "${boot_path}/zero" for OpenJDK zero build in r-base 
source package.

Please consider the patch I attached for r-base.
I have built r-base successfully in my local ENV.
The result of my local test command `R CMD javareconf`, JNI linker flags 
can be found normally for OpenJDK zero build:
```
# R CMD javareconf
Java interpreter : /usr/lib/jvm/default-java/bin/java
Java version     : 21.0.6
Java home path   : /usr/lib/jvm/default-java
Java compiler    : /usr/lib/jvm/default-java/bin/javac
Java headers gen.:
Java archive tool: /usr/lib/jvm/default-java/bin/jar

trying to compile and link a JNI program
detected JNI cpp flags    : -I$(JAVA_HOME)/include 
-I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L$(JAVA_HOME)/lib/zero -ljvm
......
JAVA_HOME        : /usr/lib/jvm/default-java
Java library path: $(JAVA_HOME)/lib/zero
JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/zero -ljvm
Updating Java configuration in /usr/lib/R
Done.
```

Based on my local r-base (r-base-core_4.5.0-1+loong64.1_loong64.deb), 
rjava is built successfully.
```
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/lib/jvm/default-java/bin/java'
archiver    : '/usr/lib/jvm/default-java/bin/jar'
compiler    : '/usr/lib/jvm/default-java/bin/javac'
header prep.: ''
cpp flags   : '-I/usr/lib/jvm/default-java/include 
-I/usr/lib/jvm/default-java/include/linux'
java libs   : '-L/usr/lib/jvm/default-java/lib/zero -ljvm'
checking whether Java run-time works... yes
......
    dh_builddeb -O--buildsystem=R
dpkg-deb: building package 'r-cran-rjava' in 
'../r-cran-rjava_1.0-11-1_loong64.deb'.
dpkg-deb: building package 'r-cran-rjava-dbgsym' in 
'../r-cran-rjava-dbgsym_1.0-11-1_loong64.deb'.
  dpkg-genbuildinfo -O../rjava_1.0-11-1_loong64.buildinfo
  dpkg-genchanges -O../rjava_1.0-11-1_loong64.changes
```

BTW, I do not find the link how to contribute patch(submit pull request) 
via GITHUB to R source code upstream(https://contributor.r-project.org/).
So I submitted this patch to debian r-base source package first and Cc 
upstream's r-devel using r-project.org..
Could you add the patch "Add "${boot_path}/zero" for OpenJDK zero build" 
in the next upload?
Your opinions are welcome.

[1]: https://github.com/openjdk/jdk/pull/5440
[2]: https://github.com/openjdk/jdk/pull/4787

Thanks,
Dandan Zhang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: r-base-add-the-path-of-libjvm.so-for-zero-build.patch
Type: text/x-patch
Size: 899 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20250417/a2e467f2/attachment.bin>


More information about the R-devel mailing list