You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在RISCV Chroot环境构建OpenJDK时遇/dev/fd/63不存在错误

在RISCV Chroot环境构建OpenJDK RISCV时make images报错/dev/fd/63不存在的解决方法

问题描述

已在RISCV chroot环境中克隆OpenJDK RISCV端口源码,成功执行bash configure,但运行make images时出现如下错误:

root@ryze:/openjdk/riscv-port# make images
Building target 'images' in configuration 'linux-riscv64-server-release'
/usr/bin/bash: line 2: /dev/fd/63: No such file or directory

ERROR: Build failed for target 'images' in configuration 'linux-riscv64-server-release' (exit code 1)

No indication of failed target found.
HELP: Try searching the build log for '] Error'.
HELP: Run 'make doctor' to diagnose build problems.

make[1]: *** [/openjdk/riscv-port/make/Init.gmk:320: main] Error 1
make: *** [/openjdk/riscv-port/make/Init.gmk:186: images] Error 2

解决步骤

1. 确保Chroot环境挂载Proc文件系统

/dev/fd是指向/proc/self/fd的符号链接,Chroot环境默认不会自动挂载Proc等虚拟文件系统,这是导致错误的最常见原因:

  • 退出当前Chroot环境,执行以下命令挂载Proc到Chroot目录的/proc路径:
    mount -t proc proc /path/to/your/chroot/directory/proc
    
  • 同时建议挂载devpts和sysfs以保证完整的系统环境:
    mount -t devpts devpts /path/to/your/chroot/directory/dev/pts
    mount -t sysfs sysfs /path/to/your/chroot/directory/sys
    
  • 重新进入Chroot环境,执行ls /dev/fd确认该路径存在。

2. 检查并更新Bash版本

部分旧版本Bash对通过/dev/fd传递脚本的支持存在问题:

  • 在Chroot环境内执行bash --version查看版本,若版本低于4.0,尝试更新Bash:
    apt update && apt install bash -y # Debian/Ubuntu系发行版
    # 其他发行版使用对应包管理命令
    

3. 验证构建依赖完整性

虽然configure已成功,但仍可能存在隐性依赖缺失:

  • 执行make doctor(错误日志中建议的命令),根据输出补充缺失的依赖包。
  • 确保安装了build-essential、libfreetype6-dev、libx11-dev等OpenJDK构建的常见依赖。

4. 调整Configure参数重试

若上述步骤无效,尝试在Configure时添加禁用部分特性的参数:

bash configure --disable-javac-server --with-boot-jdk=/path/to/riscv-boot-jdk

(需确保已提供适配RISCV架构的Boot JDK,若未准备需先构建或获取对应版本)

内容的提问来源于stack exchange,提问作者Ajay Chuttar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 14:37:02