strange message and failure with libgccjit (16, Debian/Trixie/AMD64)
David Malcolm
dmalcolm@redhat.com
Tue May 12 22:16:32 GMT 2026
On Tue, 2026-05-12 at 23:54 +0200, Basile STARYNKEVITCH wrote:
> Hello all,
>
>
> I am getting strange message with libgccjit.
>
> You could look at the code in commit 76fa0e724496 of
> https://github.com/RefPerSys/RefPerSys (a GPL licensed inference
> engine
> in C++, work in progress).
>
> The issue is described in https://github.com/RefPerSys/RefPerSys
You didn't give the issue number, but I'm assuming you're referring to
https://github.com/RefPerSys/RefPerSys/issues/36
The log shows
libgccjit.so: error: argument to ‘-O’ should be a non-negative integer,
‘g’, ‘s’, ‘z’ or ‘fast’
Looks like:
gcc_jit_context_add_command_line_option(ctxt, "-O1 -g -fPIC -Wall");
is wrong; rather than one call you should call it 4 times, once for
each option:
gcc_jit_context_add_command_line_option(ctxt, "-O1");
gcc_jit_context_add_command_line_option(ctxt, "-g");
etc.
Does that fix the problem?
With one call, it's like passing the string "-O1 -g -fPIC -Wall" as one
full argument, which would explain the error about "-O", since "1 -g -
fPIC -Wall" is not a non-negative integer etc.
>
> The code is in file gccjit_rps.cc
>
> (I expect to find my bug in a few days, but the libgccjit errors
> seems
> cryptic, for a very simple gccjit-ed function described in comments
> in
> that gccjit_rps.cc file)
>
> I am actually interested in any open source example (other than the
> GCC
> documentation) using libgccjit. (simpler than GNU emacs 31)
As well as Emacs, you could look at rustc_codegen_gcc, though that's in
Rust. There are some projects listed on
https://gcc.gnu.org/wiki/JIT
Hope this is helpful
Dave
More information about the Jit
mailing list