【问题标题】:Build OpenJDK 9 in CentOS5在 CentOS5 中构建 OpenJDK 9
【发布时间】:2019-01-30 01:17:05
【问题描述】:

我试图在 Centos 5 中构建 OpenJDK 9。我使用过

sh ./configure --disable-warnings-as-errors
make all

我收到以下错误。

Building target 'all' in configuration 'linux-x86_64-normal-server-release'
/root/jdk9/build/linux-x86_64-normal-server- 
release/support/native/java.base/libjava/io_util_md.o: In function 
`handleSetLength':
/root/jdk9/jdk/src/java.base/unix/native/libjava/io_util_md.c:228: 
undefined reference to `fallocate64'
collect2: ld returned 1 exit status
/usr/bin/objcopy: '/root/jdk9/build/linux-x86_64-normal-server- 
release/support/modules_libs/java.base/libjava.so': No such file
gmake[3]: *** [/root/jdk9/build/linux-x86_64-normal-server- 
release/support/modules_libs/java.base/libjava.so] Error 1
gmake[2]: *** [java.base-libs] Error 2

ERROR: Build failed for target 'all' in configuration 'linux-x86_64-normal- 
server-release' (exit code 2)

=== Output from failing command(s) repeated here ===
* For target support_native_java.base_libjava_BUILD_LIBJAVA_link:
/root/jdk9/build/linux-x86_64-normal-server- 
release/support/native/java.base/libjava/io_util_md.o: In function 
`handleSetLength':
/root/jdk9/jdk/src/java.base/unix/native/libjava/io_util_md.c:228: 
undefined reference to `fallocate64'
collect2: ld returned 1 exit status

* All command lines available in /root/jdk9/build/linux-x86_64-normal- 
server-release/make-support/failure-logs.
=== End of repeated output ===

No indication of failed target found.
Hint: Try searching the build log for '] Error'.
Hint: See common/doc/building.html#troubleshooting for assistance.

make[1]: *** [main] Error 2
make: *** [all] Error 2

我还尝试了其他 make 目标,例如 make images 和 make install。但仍然得到同样的错误。我的 GCC 版本是我手动安装的 gcc (GCC) 4.4.7,因为默认情况下 Centos 5 有一个旧版本。

【问题讨论】:

  • Centos5 于 2007 年 4 月 12 日发布 - 是时候更新了吗?
  • 是的,很遗憾,出于商业原因,我们仍然必须支持它。
  • 我的最终目标是在 CentOS5 上构建 jdk11。所以我通过注释掉对 fallocate64 的引用来解决这个问题。然后我使用jdk9构建jdk10,然后构建jdk11。我使用 GCC 4.8.2、Beanutils 2.18 和来自 people.centos.org/tru/devtools-2/5/x86_64/RPMS 的其他依赖项在 CentOS5 上构建 OpenJDK 11。

标签: java makefile redhat-openjdk


【解决方案1】:
  1. 构建 JDK 至少需要 GCC 5.0(请参阅 Building the JDK: CC)。

  2. 这似乎是 glibc 版本中的一个问题(请参阅redhat-issueutil-linux)。因此,将您的 glibc 更新到最新版本可能会解决它。

  3. 如果您不想更新系统的 glibc,这里还有另一种选择:

通过查看fallocate 的手册页,我们发现描述中提到posix_fallocate(3) 是它的可移植的、POSIX.1 指定的版本,以防mode 参数具有默认值(0 )。这同样适用于fallocate64。 由于上述错误的所有出现都已使用默认的mode 值,您可以将它们替换为posix_fallocate64()(而不是像您在另一条评论中提到的那样将它们注释掉)。

表示的手册页说:

此默认行为 [fallocatemode=0] 非常类似于 posix_fallocate(3) 库函数的行为,旨在 作为优化实现该功能的一种方法。

【讨论】:

    猜你喜欢
    • 2018-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-13
    • 2014-02-10
    相关资源
    最近更新 更多