public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Jeff Law <law@redhat.com>
Cc: jit@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/5] gcc: configure and Makefile changes needed by jit
Date: Wed, 15 Oct 2014 21:46:00 -0000	[thread overview]
Message-ID: <1413408568.9513.151.camel@surprise> (raw)
In-Reply-To: <543EDE61.6090801@redhat.com>

On Wed, 2014-10-15 at 14:51 -0600, Jeff Law wrote:
> On 10/15/14 12:25, David Malcolm wrote:
> > On Wed, 2014-10-15 at 11:36 -0600, Jeff Law wrote:
> >> On 10/13/14 11:45, David Malcolm wrote:
> >>> gcc/ChangeLog:
> >>> 	* configure.ac (gcc_version): Expose this value for use via
> >>> 	AC_SUBST, since the jit code needs it within the new file
> >>> 	libgccjit.pc.in.
> >>> 	(doc_build_sys): New variable, set to "sphinx" if
> >>> 	sphinx is installed, falling back to "texinfo" otherwise.
> >>> 	(gcc-driver-name.h): Generate a gcc-driver-name.h file containing
> >>> 	GCC_DRIVER_NAME for the benefit of jit/jit-playback.c.
> >>> 	* configure: Regenerate.
> >>> 	* Makefile.in (doc_build_sys): New.
> >>> 	(bindir): New.
> >>> 	(pkgconfigdir): New.
> >>> 	(installdirs): Add creation of $(DESTDIR)$(pkgconfigdir).
> >>> 	(site.exp): When constructing site.exp, add a line to set "bindir".
> >> Mostly OK.  Though a couple questions.
> >>
> >> Why do we need pkgconfig and why do you need a bindir in site.exp?
> >
> > I chose to provide a libgccjit.pc file in the install, so that client
> > code has the option of compiling and linking against the library like
> > this:
> >
> > $ gcc jit-hello-world.c $(pkg-config libgccjit --cflags)
> > $ gcc jit-hello-world.o $(pkg-config libgccjit --libs)
> WIthout a general consensus to add pkg-config, I'd rather not go this 
> direction.  Right now I'd much rather see us adding the appropriate 
> flags automatically.

How could we do that automatically?  The reason I wanted to use
pkg-config here is not for us, it's for the users of the jit library,
e.g. GNU Octave, my "coconut" jit for CPython etc.  I don't want to
require clients of this code to use the GNU autotools (for example, the
Python bindings don't).

How do *they* select the correct include paths and linker flags for
building against libgccjit?  It's easy if the relevant files got put
into /usr/include and /usr/lib, but there could be multiple versions
installed in different prefixes for different development stacks.
pkg-config solves this by having the user set up PKG_CONFIG_PATH to pick
up the relevant .pc files for each library.

[well, it's also for *me* when I'm using the library, in that I've made
use of the pkg-config approach quite a bit since adding the support]


> > relying on pkg-config to automatically supply the relevant flags for the
> > correct paths (for those people who want to use pkg-config).
> But I think that is a completely independent discussion and if we go 
> that direction we should make it pervasive in GCC and not just for the 
> JIT bits.

I think that the jit is a special case here: I don't know of any other
shared libraries built from the gcc codebase that are intended to run on
the host, and are for use by 3rd-party libraries/binaries.  (though to
be fair, the jit rather blurs the host/build line).

But if this is going to block acceptance of the branch I can drop it;
client code can always just manually specify the -I and -l/-L
accordingly.

> > As for the "bindir" in site.exp, Joseph asked me when the library
> > invokes a driver to convert from .s to .so to:
> >
> > On Tue, 2014-09-23 at 23:27 +0000, Joseph S. Myers wrote:
> >> * use the $(target_noncanonical)-gcc-$(version) name for the
> >> driver rather than plain "gcc", to maximise the chance that it
> >> is actually the same compiler the JIT library was built for (I
> >> realise you may not actually depend on it being the same
> >> compiler, but that does seem best; in principle in future it
> >> should be possible to load multiple copies of the JIT library
> >> to JIT for different targets, so that code for an offload
> >> accelerator can go through the JIT).
> > ( https://gcc.gnu.org/ml/jit/2014-q3/msg00033.html )
> >
> > This full name is used when *installing* the driver, but doesn't exist
> > within the build directory.
> > Hence when running the library, the installation bindir needs to be in
> > the PATH.  In particular, (in
> > https://gcc.gnu.org/ml/jit/2014-q4/msg00005.html ) when running the jit
> > testsuite we rely on the driver having been installed, and in jit.exp we
> > need to temporarily prepend the installation bindir onto the front of
> > PATH when running test programs linked against libgccjit.so.  Hence we
> > need to know what bindir is from expect, hence we add it to site.exp.
> So if I'm reading all this correctly, what's being implied is that 
> testing is done using the installed bits rather than the in-build-tree 
> bits?  We really need this to run without having been installed.

One approach here might be to do make a copy of the driver binary with
the final name within the *build* dir (e.g.
"x86_64-unknown-linux-gnu-gcc-5.0.0").

Another might be the "run the driver code in-process" approach I dabbled
with here:
  https://gcc.gnu.org/ml/jit/2014-q3/msg00049.html
though that's some way from working, and is more invasive (no-one
replied to that email)

  reply	other threads:[~2014-10-15 21:33 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-13 17:39 [PATCH 0/5] Merger of jit branch (v2) David Malcolm
2014-10-13 17:39 ` [PATCH 1/5] libiberty: Expose choose_tmpdir, and fix constness of return type David Malcolm
2014-10-15 17:34   ` Jeff Law
2014-10-15 19:10     ` David Malcolm
2014-10-15 19:22       ` DJ Delorie
2014-10-13 17:39 ` [PATCH 3/5] timevar.h: Add an auto_timevar class David Malcolm
2014-10-14  9:14   ` Richard Biener
2014-10-14 15:58     ` David Malcolm
2014-10-15  8:09       ` Richard Biener
2014-10-13 17:39 ` [PATCH 2/5] gcc: configure and Makefile changes needed by jit David Malcolm
2014-10-15 17:37   ` Jeff Law
2014-10-15 18:48     ` David Malcolm
2014-10-15 19:00       ` Joseph S. Myers
2014-10-15 21:01       ` Jeff Law
2014-10-15 21:46         ` David Malcolm [this message]
2014-10-17 16:20           ` [PATCH] Avoid the need to install when running the jit testsuite David Malcolm
2014-10-17 17:58             ` Joseph S. Myers
2014-10-20 17:59       ` [jit] Drop libgccjit.pc David Malcolm
2014-10-20 20:12         ` Basile Starynkevitch
2014-10-20 20:30           ` Matthias Klose
2014-10-20 20:44           ` David Malcolm
2014-10-13 18:38 ` [PATCH 4/5] State cleanups David Malcolm
2014-10-16 22:08   ` [PATCH 4/5] State cleanups -- also note for MPX work Jeff Law
2014-10-17  2:12     ` David Malcolm
2014-10-17 17:04       ` Jeff Law
2014-10-14 15:14 ` Patches 5-10 of jit merger (was: Re: [PATCH 0/5] Merger of jit branch (v2)) David Malcolm
2014-10-14 15:17   ` [PATCH 05/10] JIT-related changes outside of jit subdir David Malcolm
2014-10-15 17:46     ` Jeff Law
2014-10-17 21:52     ` Joseph S. Myers
2014-10-20 19:59       ` [jit] Add Sphinx to install.texi David Malcolm
2014-10-21  0:01         ` Joseph S. Myers
2014-10-21 16:20         ` Gerald Pfeifer
2014-10-21 19:30           ` David Malcolm
2014-10-30  3:08             ` [jit] Tweaks " David Malcolm
2014-10-14 15:22   ` [PATCH 06/10] Heart of the JIT implementation (was: Re: [PATCH 0/5] Merger of jit branch (v2)) David Malcolm
2014-10-17 21:54     ` Joseph S. Myers
2014-10-20 18:58       ` [jit] Error-handling within gcc::jit::dump David Malcolm
2014-10-21  0:01         ` Joseph S. Myers
2014-10-30 19:29       ` [PATCH 06/10] Heart of the JIT implementation (was: Re: [PATCH 0/5] Merger of jit branch (v2)) David Malcolm
2014-10-31  5:16         ` Joseph S. Myers
2014-10-31  6:30           ` [PATCH 06/10] Heart of the JIT implementation Jeff Law
2014-10-14 15:24   ` [PATCH 07/10] Testsuite for the JIT (Re: Patches 5-10 of jit merger (was: Re: [PATCH 0/5] Merger of jit branch (v2))) David Malcolm
2014-10-15 17:50     ` [PATCH 07/10] Testsuite for the JIT (Re: Patches 5-10 of jit merger Jeff Law
2014-10-15 20:04       ` Mike Stump
2014-10-14 15:39   ` [PATCH 10/10] ChangeLog files (Re: Patches 5-10 of jit merger (was: Re: [PATCH 0/5] Merger of jit branch (v2))) David Malcolm
2014-10-15 17:55     ` [PATCH 10/10] ChangeLog files (Re: Patches 5-10 of jit merger Jeff Law
2014-10-15 17:02   ` [PATCH 08/10] Documentation for the JIT library (Re: Patches 5-10 of jit merger) David Malcolm
2014-10-15 20:51     ` Jeff Law
2014-10-21 19:02       ` [jit] Update the docs David Malcolm
2014-10-15 17:03   ` [PATCH 09/10] Prebuilt texinfo documentation for the JIT library (Re: Patches 5-10 of jit merger) David Malcolm
2014-10-15 17:52     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1413408568.9513.151.camel@surprise \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jit@gcc.gnu.org \
    --cc=law@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).