Re: strange message and failure with libgccjit (16, Debian/Trixie/AMD64)
David Malcolm via Gcc-help <[email protected]> Tue, 12 May 2026 18:16:32 -0400
| Newsgroups | gmane.comp.gcc.help,gmane.comp.gcc.jit |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 2026-05-12 at 23:54 +0200, Basile STARYNKEVITCH wrote: > Hello all, >=20 >=20 > I am getting strange message with libgccjit. >=20 > You could look at the code in commit 76fa0e724496 of > https://github.com/RefPerSys/RefPerSys=C2=A0(a GPL licensed inference > engine > in C++, work in progress). >=20 > 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=20 libgccjit.so: error: argument to =E2=80=98-O=E2=80=99 should be a non-negat= ive integer, =E2=80=98g=E2=80=99, =E2=80=98s=E2=80=99, =E2=80=98z=E2=80=99 or =E2=80=98f= ast=E2=80=99 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. >=20 > The code is in file gccjit_rps.cc >=20 > (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) >=20 > 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