Bug #19174
closedYJIT configure "checking whether rustc works for YJIT... no" in rustc 1.65.0 on x86_64
Description
On the latest master branch 11871e49c4fe493d6b958046969bc863f7fb6627
on Fedora 36,
$ uname -m
x86_64
$ which rustc
/bin/rustc
$ rustc --version
rustc 1.65.0 (Fedora 1.65.0-1.fc37)
I am seeing the "checking whether rustc works for YJIT... no".
$ ./autogen.sh
$ ./configure --enable-yjit 2>&1 | tee configure.log
...
checking for rustc... rustc
checking whether rustc works for YJIT... no
...
* YJIT support: yes
...
Seeing the code https://github.com/ruby/ruby/blob/11871e49c4fe493d6b958046969bc863f7fb6627/configure.ac#L3744-L3760, it is to check if the rustc is >= 1.58.0. And the used rustc is 1.65.0.
dnl check if rustc is recent enough to build YJIT (rustc >= 1.58.0)
I suspect that the checking logic might be something wrong. I checked why the checking logic fails with the modification below.
$ git diff
diff --git a/configure.ac b/configure.ac
index 79167a9c67..33a1b9540d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3753,7 +3753,7 @@ AS_IF([test "$RUSTC" != "no"],
dnl Fails in case rustc target doesn't match ruby target.
dnl Can happen on Rosetta, for example.
AS_IF([echo "#[cfg(target_arch = \"$YJIT_TARGET_ARCH\")]\n fn main() { let x = 1; format!(\"{x}\"); }" |
- $RUSTC - --emit asm=/dev/null 2>/dev/null],
+ $RUSTC - --emit asm=/dev/null],
[YJIT_RUSTC_OK=yes]
)
AC_MSG_RESULT($YJIT_RUSTC_OK)
$ ./autogen.sh
$ ./configure --enable-yjit 2>&1 | tee configure_debug.log
...
checking for rustc... rustc
checking whether rustc works for YJIT... error: unknown start of token: \
--> <anon>:1:31
|
1 | #[cfg(target_arch = "x86_64")]\n fn main() { let x = 1; format!("{x}"); }
| ^
error: expected one of `!` or `::`, found keyword `fn`
--> <anon>:1:34
|
1 | #[cfg(target_arch = "x86_64")]\n fn main() { let x = 1; format!("{x}"); }
| ^^ expected one of `!` or `::`
error: aborting due to 2 previous errors
no
...
* YJIT support: yes
...
Is it intended behavior? Actually after running the configure
, the make
works.
Updated by alanwu (Alan Wu) about 1 year ago
That check is intended for automatically enabling YJIT when we can find a suitable rustc.
When we get --enable-yjit explicitly we listen to that and don't use the result of the check, which is what you're seeing. So it's fine.
That said, it looks like I messed up and assumed that "\n" gives a newline with echo
. Apparently not in all shells!
Updated by alanwu (Alan Wu) about 1 year ago
- Status changed from Open to Closed
Applied in changeset git|1015e69d37b8e75145a3d21e4bd54fa538d1fa68.
YJIT: echo "\n" is not portable
It's unspecified by POSIX. zsh and dash give a newline and
bash doesn't substitute it. Attributes don't have to be
followed by a newline anyway, so just remove it.
[Bug #19174]