From: "ivoanjo (Ivo Anjo)" Date: 2021-12-03T15:04:03+00:00 Subject: [ruby-core:106467] [Ruby master Bug#18073] test/ruby/test_jit.rb: "error: invalid use of '__builtin_va_arg_pack ()'" on Ruby 2.7.4 on gcc 4.8.5 Issue #18073 has been updated by ivoanjo (Ivo Anjo). I run into a similar issue; in my case, I was running the Semaphore CI Ruby image for 2.7.5 and when trying to run with JIT I get the same failures ``` semaphore@semaphore-vm:~$ ruby -v ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux] semaphore@semaphore-vm:~$ gcc -v 2>&1 | grep "gcc version" gcc version 4.8.5 (Ubuntu 4.8.5-4ubuntu8) semaphore@semaphore-vm:~$ ruby --jit --jit-warnings --jit-debug --jit-verbose=2 -e 'def foo; end; while true; foo; end' MJIT: CC defaults to /usr/bin/gcc MJIT: tmp_dir is /tmp Creating precompiled header Starting process: /usr/bin/gcc /usr/bin/gcc -std=gnu99 -w -Wfatal-errors -fPIC -shared -w -pipe -ggdb3 -nodefaultlibs -nostdlib -o /tmp/_ruby_mjit_hp4368u0.h.gch /home/semaphore/.rbenv/versions/2.7.5/include/ruby-2.7.0/x86_64-linux/rb_mjit_min_header-2.7.5.h start compilation: foo@-e:1 -> /tmp/_ruby_mjit_p4368u1.c Starting process: /usr/bin/gcc /usr/bin/gcc -std=gnu99 -w -Wfatal-errors -fPIC -shared -w -pipe -ggdb3 -o /tmp/_ruby_mjit_p4368u1.o /tmp/_ruby_mjit_p4368u1.c -c -nostartfiles -nodefaultlibs -nostdlib /home/semaphore/.rbenv/versions/2.7.5/include/ruby-2.7.0/x86_64-linux/rb_mjit_min_header-2.7.5.h: In function 'sprintf': /home/semaphore/.rbenv/versions/2.7.5/include/ruby-2.7.0/x86_64-linux/rb_mjit_min_header-2.7.5.h:406:3: error: invalid use of '__builtin_va_arg_pack ()' return __builtin___sprintf_chk (__s, 2 - 1, ^ compilation terminated due to -Wfatal-errors. compile_c_to_o: compile error: 1 Failed to generate so: /tmp/_ruby_mjit_p4368u1.so start compilation: block in already_loaded?@/home/semaphore/.rbenv/versions/2.7.5/lib/ruby/site_ruby/2.7.0/rubygems.rb:1290 -> /tmp/_ruby_mjit_p4368u0.c Starting process: /usr/bin/gcc /usr/bin/gcc -std=gnu99 -w -Wfatal-errors -fPIC -shared -w -pipe -ggdb3 -o /tmp/_ruby_mjit_p4368u0.o /tmp/_ruby_mjit_p4368u0.c -c -nostartfiles -nodefaultlibs -nostdlib /home/semaphore/.rbenv/versions/2.7.5/include/ruby-2.7.0/x86_64-linux/rb_mjit_min_header-2.7.5.h: In function 'sprintf': /home/semaphore/.rbenv/versions/2.7.5/include/ruby-2.7.0/x86_64-linux/rb_mjit_min_header-2.7.5.h:406:3: error: invalid use of '__builtin_va_arg_pack ()' return __builtin___sprintf_chk (__s, 2 - 1, ^ compilation terminated due to -Wfatal-errors. compile_c_to_o: compile error: 1 Failed to generate so: /tmp/_ruby_mjit_p4368u0.so ``` Would it make sense to perhaps validate that the mjit header is compilable after generating it? ---------------------------------------- Bug #18073: test/ruby/test_jit.rb: "error: invalid use of '__builtin_va_arg_pack ()'" on Ruby 2.7.4 on gcc 4.8.5 https://bugs.ruby-lang.org/issues/18073#change-95124 * Author: jaruga (Jun Aruga) * Status: Open * Priority: Normal * Backport: 2.6: UNKNOWN, 2.7: REQUIRED, 3.0: DONTNEED ---------------------------------------- I hit the following JIT test failures causing the following error on v2_7_4 tag (Ruby 2.7.4) with gcc 4.8.5 on RHEL 7. The tests work on Ruby 2.7.3 and also works on Ruby 3.0.2. ``` /mnt/git/ruby/ruby/.ext/include/x86_64-linux/rb_mjit_min_header-2.7.4.h: In function 'sprintf': /mnt/git/ruby/ruby/.ext/include/x86_64-linux/rb_mjit_min_header-2.7.4.h:442:3: error: invalid use of '__builtin_va_arg_pack ()' return __builtin___sprintf_chk (__s, 2 - 1, ^ ``` ``` $ which gcc /usr/bin/gcc $ gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) Copyright (C) 2015 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. $ git branch * (detached from v2_7_4) ... $ autoconf $ ./configure --enable-shared 2>&1 | tee configure.log $ make 2>&1 | tee make.log ``` Here is one of the failures. I would attach the full long files on this ticket. ``` $ make test-all TESTS="-v test/ruby/test_jit.rb" 2>&1 | tee make_test-all_test_jit.log ... 30) Failure: TestJIT#test_compile_insn_local [/mnt/git/ruby/ruby/test/ruby/test_jit.rb:62]: Expected 1 times of JIT success, but succeeded 0 times. script: """ p proc { foo = 1 foo }.call """ stderr: """ /mnt/git/ruby/ruby/.ext/include/x86_64-linux/rb_mjit_min_header-2.7.4.h: In function 'sprintf': /mnt/git/ruby/ruby/.ext/include/x86_64-linux/rb_mjit_min_header-2.7.4.h:442:3: error: invalid use of '__builtin_va_arg_pack ()' return __builtin___sprintf_chk (__s, 2 - 1, ^ compilation terminated due to -Wfatal-errors. Successful MJIT finish """ .. <1> expected but was <0>. ... Finished tests in 29.837252s, 3.1504 tests/s, 15.7186 assertions/s. 94 tests, 469 assertions, 87 failures, 0 errors, 4 skips ... ``` ---Files-------------------------------- configure.log (27.6 KB) make.log (102 KB) make_test-all_test_jit.log (77 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: