Subject: bug#42761: 28.0.50; [feature/native-comp] allow customizing command line/driver options?

From: Andrea Corallo <[email-masked]>
Date: Sat, 08 Aug 2020 18:30:08 +0000

Andreas Fuchs <[email-masked]> writes:

> I'm trying out emacs with native-comp on nix (working on this branch
> here: https://github.com/NixOS/nixpkgs/pull/94637), and am stumbling
> over a problem that is pretty specific to nix, it seems: As nix
> isolates
> each package to a "store" directory, you have to set specific linker
> flags so that gcc-jit can find -lgccjit and -lgcc_ext. This is
> currently
> done via the $LIBRARY_PATH environment variable, which works but
> seems
> pretty hackish to me (least of all because it isn't a thing that's
> supported on the darwin cctools linker - there, you have to pass the
> linker path as command-line arguments).
>
> I feel like it would be much better if users could specify the gcc
> driver flags directly, via gcc_jit_context_add_driver_option
> (https://gcc.gnu.org/onlinedocs/jit/topics/contexts.html#
> c.gcc_jit_context_add_driver_option).
>
> That way, instead of overriding environment variables which might get
> reset in child processes' wrapper scripts, an emacs installation
> could
> more directly influence the compilation step.

Hi Andreas,

I don't think should be too difficult to expose the driver option.  The
downside is that gcc_jit_context_add_driver_option is not available in
all libgccjits (IIRC I added it to GCC 9).

Another option would be to set our self the LIBRARY_PATH before invoking
the compiler only in the async process.  Have you already tried using
`comp-async-env-modifier-form' for this?

Thanks

  Andrea

-- 
[email-masked]