ruby: fix yjit for target and host build
Since ruby 3.3.0, yjit was converted into rust code. During build, ruby will try try to use the whatever rustc is available in $PATH, including the one provided by the OS. Variations in that rustc can generate something between a perfect funcional build with yjit enabled and a broken build like this (from github actions): 2024-10-16T05:06:05.9863422Z linking static-library libruby-static.a 2024-10-16T05:06:06.0625182Z LLVM ERROR: Invalid encoding 2024-10-16T05:06:06.1531894Z make[4]: *** [Makefile:318: libruby-static.a] Aborted (core dumped) Ruby 3.3.5 still only supports yjit for x86_64 and aarch64. Even for those targets, ruby build does not support cross-compiling. This commit adds rust as a dependency for those supported archs, even when cross-compiling, to let it work when host and target arch matches. We don't need yjit for host build and we can disable it. Closes #25151, #25052 Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
This commit is contained in:
parent
857efd12c3
commit
23f08217ac
|
@ -25,7 +25,15 @@ PKG_LICENSE:=BSD-2-Clause
|
|||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_CPE_ID:=cpe:/a:ruby-lang:ruby
|
||||
|
||||
PKG_BUILD_DEPENDS:=ruby/host
|
||||
|
||||
# YJIT may not be suitable for certain applications. It
|
||||
# currently only supports macOS, Linux and BSD on x86-64 and
|
||||
# arm64/aarch64 CPUs.
|
||||
# Ruby 3.3.5 (latest) still does not support cross-compiling. It
|
||||
# will only work when target matches the host arch. Anyway, we
|
||||
# will provide a working rustc for those supported archs to let
|
||||
# it work when they match.
|
||||
PKG_BUILD_DEPENDS:=ruby/host RUBY_ENABLE_YJIT:rust/host
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
@ -38,6 +46,7 @@ HOST_CONFIGURE_ARGS += \
|
|||
--disable-install-doc \
|
||||
--disable-install-rdoc \
|
||||
--disable-install-capi \
|
||||
--disable-yjit \
|
||||
--without-gmp \
|
||||
--with-static-linked-ext \
|
||||
--with-out-ext=-test-/*,bigdecimal,cgi/escape,continuation,coverage,etc,fcntl,fiddle,io/console,json,json/generator,json/parser,mathn/complex,mathn/rational,nkf,objspace,pty,racc/cparse,rbconfig/sizeof,readline,rubyvm,syslog,win32,win32ole,win32/resolv
|
||||
|
@ -71,6 +80,12 @@ CONFIGURE_ARGS += --disable-jit-support
|
|||
# Host JIT does work but it is not worth it
|
||||
HOST_CONFIGURE_ARGS += --disable-jit-support
|
||||
|
||||
ifndef CONFIG_RUBY_ENABLE_YJIT
|
||||
# it is only worth it to enable yjit for target package
|
||||
CONFIGURE_ARGS += --disable-yjit
|
||||
endif
|
||||
|
||||
|
||||
# Apple ld generates warning if LD_FLAGS var includes path to lib that is not
|
||||
# exist (e.g. -L$(STAGING_DIR)/host/lib). configure script fails if ld generates
|
||||
# any output
|
||||
|
@ -152,6 +167,17 @@ define RubyDependency
|
|||
endef
|
||||
|
||||
define Package/ruby/config
|
||||
config RUBY_ENABLE_YJIT
|
||||
bool "Enable YJIT"
|
||||
depends on PACKAGE_ruby
|
||||
depends on x86_64||aarch64
|
||||
default y if x86_64||aarch64
|
||||
help
|
||||
YJIT is a lightweight, minimalistic Ruby JIT built
|
||||
inside CRuby. It lazily compiles code using a Basic Block Versioning (BBV)
|
||||
architecture. YJIT is currently supported for macOS, Linux and BSD on x86-64
|
||||
and arm64/aarch64 CPUs.
|
||||
|
||||
comment "Standard Library"
|
||||
depends on PACKAGE_ruby
|
||||
|
||||
|
|
Loading…
Reference in New Issue