Issue #17817 has been reported by jaruga (Jun Aruga).

----------------------------------------
Bug #17817: --jit outputs ./tmp/_ruby_mjit_*.h: No such file or directory on with TMP_DIR
https://bugs.ruby-lang.org/issues/17817

* Author: jaruga (Jun Aruga)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
On the master branch: `3c8a67e8a5f51f337cf95b4038ed97bf8ca8b696`, I see the `ruby --jit` prints `fatal error: ./tmp/_ruby_mjit_hp1287695u0.h: No such file or directory` only if `TMP` is set. Is it a bug?

The ruby is built from the source code by `./configure --prefix=... --enable-shared`. I would attach the full log file.

The issue is like #14457 . Thank you.

```
$ ~/local/ruby-master-3c8a67e/bin/ruby -v
ruby 3.1.0dev (2021-04-21T11:45:23Z master 3c8a67e8a5) [x86_64-linux]
```

```
$ ~/local/ruby-master-3c8a67e/bin/ruby --disable-gems --jit-verbose=2 --jit-save-temps --jit-min-calls=1 --jit-wait -e '1.times { puts "Hello" }'
MJIT: CC defaults to /usr/bin/gcc
MJIT: tmp_dir is /tmp
Creating precompiled header
Starting process: /usr/bin/gcc /usr/bin/gcc -w -Wfatal-errors -fPIC -shared -w -pipe -O3 -fno-fast-math -nodefaultlibs -nostdlib -o /tmp/_ruby_mjit_hp1287652u0.h.gch /home/jaruga/local/ruby-master-3c8a67e/include/ruby-3.1.0/x86_64-linux/rb_mjit_min_header-3.1.0.h
start compilation: block in <main>@-e:1 -> /tmp/_ruby_mjit_p1287652u0.c
Starting process: /usr/bin/gcc /usr/bin/gcc -w -Wfatal-errors -fPIC -shared -w -pipe -O3 -fno-fast-math -o /tmp/_ruby_mjit_p1287652u0.o /tmp/_ruby_mjit_p1287652u0.c -c -nostartfiles -nodefaultlibs -nostdlib
Starting process: /usr/bin/gcc /usr/bin/gcc -shared -Wfatal-errors -fPIC -shared -w -pipe -O3 -fno-fast-math -o /tmp/_ruby_mjit_p1287652u0.so /tmp/_ruby_mjit_p1287652u0.o -lgcc -Wl,--compress-debug-sections=zlib -nostartfiles -nodefaultlibs -nostdlib
JIT success (63.2ms): block in <main>@-e:1 -> /tmp/_ruby_mjit_p1287652u0.c
Hello
Stopping worker thread
Successful MJIT finish
```

```
$ TMP=./tmp ~/local/ruby-master-3c8a67e/bin/ruby --disable-gems --jit-verbose=2 --jit-save-temps --jit-min-calls=1 --jit-wait -e '1.times { puts "Hello" }'
MJIT: CC defaults to /usr/bin/gcc
MJIT: tmp_dir is ./tmp
Creating precompiled header
Starting process: /usr/bin/gcc /usr/bin/gcc -w -Wfatal-errors -fPIC -shared -w -pipe -O3 -fno-fast-math -nodefaultlibs -nostdlib -o ./tmp/_ruby_mjit_hp1287695u0.h.gch /home/jaruga/local/ruby-master-3c8a67e/include/ruby-3.1.0/x86_64-linux/rb_mjit_min_header-3.1.0.h
start compilation: block in <main>@-e:1 -> ./tmp/_ruby_mjit_p1287695u0.c
Starting process: /usr/bin/gcc /usr/bin/gcc -w -Wfatal-errors -fPIC -shared -w -pipe -O3 -fno-fast-math -o ./tmp/_ruby_mjit_p1287695u0.o ./tmp/_ruby_mjit_p1287695u0.c -c -nostartfiles -nodefaultlibs -nostdlib
./tmp/_ruby_mjit_p1287695u0.c:1:10: fatal error: ./tmp/_ruby_mjit_hp1287695u0.h: No such file or directory
    1 | #include "./tmp/_ruby_mjit_hp1287695u0.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
compile_c_to_so: failed to compile .c to .o: 1
Failed to generate so: ./tmp/_ruby_mjit_p1287695u0.so
Hello
Stopping worker thread
Successful MJIT finish
```



---Files--------------------------------
ruby-3-jit-tmp-no-such-file-or-directory.log (31.2 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>