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

From: Andreas Fuchs <[email-masked]>
Date: Fri, 7 Aug 2020 22:51:47 -0400

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.

Thanks,
Andreas.

In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60
Version 10.15.6 (Build 19G73))
Repository revision: 80d7f710f2fab902e46aa3fddb8e1c1795420af3
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1894
System Description: Mac OS X 10.15.6

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
'configure
--prefix=/nix/store/2j5mwh18mqpri4k1v0j05gkklyp79rvr-emacs-gcc-20200802.0
--disable-build-details --with-modules --with-ns
--disable-ns-self-contained --with-nativecomp
CFLAGS=-DMAC_OS_X_VERSION_MAX_ALLOWED=101200'

Configured features:
JPEG TIFF PNG RSVG GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS NS MODULES NATIVE_COMP THREADS JSON PDUMPER

Important settings:
value of $LC_ALL: en_US.UTF-8
value of $LC_COLLATE: C
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date
subr-x cl-loaddefs cl-lib seq byte-opt gv bytecomp byte-compile cconv
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face pcase macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 53347 6820)
(symbols 48 6006 0)
(strings 32 15710 2115)
(string-bytes 1 557531)
(vectors 16 9810)
(vector-slots 8 193576 7914)
(floats 8 20 24)
(intervals 56 194 3)
(buffers 992 12))

--
Andreas Fuchs, (http://|im:asf@|mailto:asf@)boinkor.net, antifuchs