欢迎光临
我们一直在努力

OpenWRT编译提示Ruby cannot load such file -- optparse (LoadError)

有不少人提了这个问题

$ make package/feeds/packages/ruby/compile V=s
make[2]: Entering directory '/data/X86/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/data/X86/openwrt/scripts/config'
time: target/linux/prereq#0.07#0.01#0.08
Checking 'rsync'... ok.
make[1]: Entering directory '/data/X86/openwrt'
make[2]: Entering directory '/data/X86/openwrt/package/libs/toolchain'
echo "libc" >> /data/X86/openwrt/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "libgcc" >> /data/X86/openwrt/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "libatomic" >> /data/X86/openwrt/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "libstdcpp" >> /data/X86/openwrt/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "libpthread" >> /data/X86/openwrt/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "librt" >> /data/X86/openwrt/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
make[2]: Leaving directory '/data/X86/openwrt/package/libs/toolchain'
time: package/libs/toolchain/compile#0.08#0.01#0.10
make[2]: Entering directory '/data/X86/openwrt/feeds/packages/libs/libffi'
echo "libffi" >> /data/X86/openwrt/staging_dir/target-x86_64_musl/pkginfo/libffi.default.install
make[2]: Leaving directory '/data/X86/openwrt/feeds/packages/libs/libffi'
time: package/feeds/packages/libffi/compile#0.11#0.00#0.11
make[2]: Entering directory '/data/X86/openwrt/feeds/packages/lang/ruby'
CFLAGS="-O2 -I/data/X86/openwrt/staging_dir/host/include -I/data/X86/openwrt/staging_dir/hostpkg/include -I/data/X86/openwrt/staging_dir/target-x86_64_musl/host/include" CPPFLAGS="-I/data/X86/openwrt/staging_dir/host/include -I/data/X86/openwrt/staging_dir/hostpkg/include -I/data/X86/openwrt/staging_dir/target-x86_64_musl/host/include" CXXFLAGS="" LDFLAGS="-L/data/X86/openwrt/staging_dir/host/lib -L/data/X86/openwrt/staging_dir/hostpkg/lib -L/data/X86/openwrt/staging_dir/target-x86_64_musl/host/lib" make -j1 -C /data/X86/openwrt/build_dir/hostpkg/ruby-3.1.3  
make[3]: Entering directory '/data/X86/openwrt/build_dir/hostpkg/ruby-3.1.3'
	BASERUBY = /data/X86/openwrt/staging_dir/hostpkg/bin/ruby --disable=gems
	CC = gcc
	LD = ld
	LDSHARED = gcc -shared
	CFLAGS = -O2 -I/data/X86/openwrt/staging_dir/host/include -I/data/X86/openwrt/staging_dir/hostpkg/include -I/data/X86/openwrt/staging_dir/target-x86_64_musl/host/include 
	XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -fPIE -I. -I.ext/include/x86_64-linux-gnu -I./include -I. -I./enc/unicode/13.0.0
	CPPFLAGS = -I/data/X86/openwrt/staging_dir/host/include -I/data/X86/openwrt/staging_dir/hostpkg/include -I/data/X86/openwrt/staging_dir/target-x86_64_musl/host/include   
	DLDFLAGS = -L/data/X86/openwrt/staging_dir/host/lib -L/data/X86/openwrt/staging_dir/hostpkg/lib -L/data/X86/openwrt/staging_dir/target-x86_64_musl/host/lib -Wl,--compress-debug-sections=zlib -fstack-protector-strong -pie  
	SOLIBS = -lz -lpthread -lrt -lrt -ldl -lcrypt -lm 
	LANG = C
	LC_ALL = C
	LC_CTYPE = 
	MFLAGS = -w -j1
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

./tool/file2lastrev.rb:6:in `require': cannot load such file -- optparse (LoadError)
	from ./tool/file2lastrev.rb:6:in `<main>'
make[3]: *** [uncommon.mk:1203: revision.tmp] Error 1
make[3]: Leaving directory '/data/X86/openwrt/build_dir/hostpkg/ruby-3.1.3'
make[2]: *** [Makefile:1156: /data/X86/openwrt/build_dir/hostpkg/ruby-3.1.3/.built] Error 2
make[2]: Leaving directory '/data/X86/openwrt/feeds/packages/lang/ruby'
time: package/feeds/packages/ruby/host-compile#0.25#0.02#0.26
    ERROR: package/feeds/packages/ruby [host] failed to build.
make[1]: *** [package/Makefile:114: package/feeds/packages/ruby/host/compile] Error 1
make[1]: Leaving directory '/data/X86/openwrt'
make: *** [/data/X86/openwrt/include/toplevel.mk:231: package/feeds/packages/ruby/compile] Error 2

1、先make menuconfig,进入Languages->Ruby->ruby-optparse选上

2、干掉残留物

rm -rf staging_dir/hostpkg/lib/ruby
rm -rf staging_dir/hostpkg/include/ruby-*
rm staging_dir/hostpkg/lib/pkgconfig/ruby-*
rm staging_dir/hostpkg/bin/ruby
rm -rf build_dir/hostpkg/ruby-*

3、重新编译

make package/feeds/packages/ruby/host/compile V=s
make package/feeds/packages/ruby/compile V=s

赞(0) 打赏
转载请注明来源:IT技术资讯 » OpenWRT编译提示Ruby cannot load such file -- optparse (LoadError)

评论 抢沙发

评论前必须登录!

 

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏