-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add libgccjit #87157
Add libgccjit #87157
Conversation
libgccjit is a library but is used as a compiler. So it references a bunch of compiler things in $out. To avoid a cycle, we need to put everything in $out, so referenced to $lib need to be replaced with ${!outputLib}.
This option can be used to set the “jit” language which enable the libgccjit functionality. Also adds a “libgccjit” attr which is gcc built with just jit enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic! I've managed to compile a gccemacs
locally now, starting to play with it a bit.
Why do we need this line, though? It'd be nice if we could remove that bit, but doing so results in a broken jitter, similar to what I was seeing in my earlier efforts.
LIBRARY_PATH = "${lib.getLib stdenv.cc.libc}/lib";
|
||
substituteInPlace libgfortran/configure \ | ||
--replace "-install_name \\\$rpath/\\\$soname" "-install_name $lib/lib/\\\$soname" | ||
--replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, this trick of using ${!outputLib}
to do indirect bash referencing to the output lib var that may either exist or just forward to $out
was the trick I was missing when I was hacking at this. Pretty neat!
libgccjit needs to know where libc & other runtime libs are. Normally we do this by inserting the flags through cc-wrapper's gcc. But libgccjit doesn't invoke gcc at all, so we need another way to do this. We could get rid of it if we could somehow wrap the library and setting that environment variable, but that's not quite possible in the same way we can do in a binary. This is basically the same situation as libclang is in: see #43366. |
I now have a working Since this is a no-op cleanup on regular stdenv and just adds the new pkg, I think this is ready to be merged, but I'll defer to @FRidh and/or @jonringer if there's a good time to start Hydra churning away rebuilding-the-world on Resolves #75288 |
Thanks for this PR! Is there any reason libgccjit was pinned to gcc9, or was it just the current version at the time? |
libgccjit is a special "language" frontend of gcc which can compile programs. It can be embedded and used as a library, similar to llvm.
This can be used to build gccemacs. For instance:
which can be built with
nix-build
.