diff mbox

[kyukhin/gomp4-offload] DESTDIR issues

Message ID 20140917133144.GF17454@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Sept. 17, 2014, 1:31 p.m. UTC
Hi!

It seems building of the host compiler requires the offloading compiler
to be installed directly in the prefix, which is something really
undesirable e.g. for distro builds where things are installed with
non-empty $(DESTDIR).
Right now it seems that for building all that is needed is
main_target_image.h.

Either we can do something like the following patch, i.e. look
at -I$(DESTDIR)/$(target_dir)/include first and fall back to
-I$(target_dir)/include, which fixed the build for me, but unfortunately
it violates GNU conventions:
https://www.gnu.org/prep/standards/html_node/DESTDIR.html
"DESTDIR should be supported only in the install* and uninstall* targets, as
those are the only targets where it is useful."
while this patch uses it during build.

Another option would be to have two different modes of building
--enable-offload-targets= compilers, one where you really have
all the offloading target compilers installed (with empty DESTDIR, or
initially with non-empty DESTDIR, then somehow (package manager, etc.)
copied to the right prefix), and another one where for each offloading
target you'd additionally specify the build directory containing
non-installed tree (dunno, could be e.g.
--enable-offload-targets=x86_64-intelmic-linux-gnu=/some/path,ptx-none=/some/other/path
format?) and let the host compiler's build look into the other build trees
for what it needs during building and/or testing (for building 
main_target_image.h should be supposedly all that is needed, for testing
perhaps more).

Thoughts on this?

2014-09-17  Jakub Jelinek  <jakub@redhat.com>

	* plugin/Makefile.am (libgomp_plugin_mic_la_CPPFLAGS): Use
	$(DESTDIR)$(target_dir)/include path before
	trying $(target_dir)/include.
	* plugin/Makefile.in: Regenerated.


	Jakub

Comments

Paolo Bonzini Sept. 17, 2014, 2:04 p.m. UTC | #1
Il 17/09/2014 15:31, Jakub Jelinek ha scritto:
> It seems building of the host compiler requires the offloading compiler
> to be installed directly in the prefix, which is something really
> undesirable e.g. for distro builds where things are installed with
> non-empty $(DESTDIR).

Is the offloading compiler built together with GCC or previously?  If
the latter, what's the difference between the offloading compiler and
say gmp?  Setting the LD_LIBRARY_PATH would be the responsibility of
whoever builds GCC; it would be the same here for the COMPILER_PATH.

> Either we can do something like the following patch, i.e. look
> at -I$(DESTDIR)/$(target_dir)/include first and fall back to
> -I$(target_dir)/include, which fixed the build for me, but unfortunately
> it violates GNU conventions:
> https://www.gnu.org/prep/standards/html_node/DESTDIR.html
> "DESTDIR should be supported only in the install* and uninstall* targets, as
> those are the only targets where it is useful."
> while this patch uses it during build.

I agree with the coding standards.  The right way to do it could be a
configure option, if it's really not possible to leave it to whoever
builds GCC.

Paolo
Jakub Jelinek Sept. 17, 2014, 2:09 p.m. UTC | #2
On Wed, Sep 17, 2014 at 04:04:25PM +0200, Paolo Bonzini wrote:
> Il 17/09/2014 15:31, Jakub Jelinek ha scritto:
> > It seems building of the host compiler requires the offloading compiler
> > to be installed directly in the prefix, which is something really
> > undesirable e.g. for distro builds where things are installed with
> > non-empty $(DESTDIR).
> 
> Is the offloading compiler built together with GCC or previously?  If
> the latter, what's the difference between the offloading compiler and
> say gmp?  Setting the LD_LIBRARY_PATH would be the responsibility of
> whoever builds GCC; it would be the same here for the COMPILER_PATH.

Right now previously, but (usually) from the very same sources, so I think
it will be usually (but not always?) desirable to build them together, perhaps
not in a single toplevel configure and single toplevel make.

	Jakub
Paolo Bonzini Sept. 17, 2014, 4 p.m. UTC | #3
Il 17/09/2014 16:09, Jakub Jelinek ha scritto:
>> > Is the offloading compiler built together with GCC or previously?  If
>> > the latter, what's the difference between the offloading compiler and
>> > say gmp?  Setting the LD_LIBRARY_PATH would be the responsibility of
>> > whoever builds GCC; it would be the same here for the COMPILER_PATH.
> Right now previously, but (usually) from the very same sources, so I think
> it will be usually (but not always?) desirable to build them together, perhaps
> not in a single toplevel configure and single toplevel make.

If it's from the same sources, that probably rules out a single toplevel
configure/make.  Is it a problem if a newer GCC is compiled with older
headers from the offloading compiler?

In any case, I would go with a configure option.

Paolo
Ilya Verbin Sept. 18, 2014, 10:59 a.m. UTC | #4
Ok, the approach with additional --enable-offload-targets arguments seems to be
more appropriate, so I will fix offloading infrastructure pach #1.

Thanks,
  -- Ilya
diff mbox

Patch

--- liboffloadmic/plugin/Makefile.am	2014-09-16 18:16:17.961415565 +0200
+++ liboffloadmic/plugin/Makefile.am	2014-09-17 14:40:26.990566860 +0200
@@ -47,7 +47,7 @@  target_dir = $(libdir)/gcc/$(accel_targe
 if PLUGIN_HOST
   toolexeclib_LTLIBRARIES = libgomp-plugin-mic.la
   libgomp_plugin_mic_la_SOURCES = libgomp-plugin-mic.cpp
-  libgomp_plugin_mic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -DMIC_LIB_PATH=\"$(target_dir)\" -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir) -I$(target_dir)/include
+  libgomp_plugin_mic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -DMIC_LIB_PATH=\"$(target_dir)\" -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir) -I$(DESTDIR)$(target_dir)/include -I$(target_dir)/include
   libgomp_plugin_mic_la_LDFLAGS = -L$(liboffload_dir)/.libs -loffloadmic -version-info 1:0:0
 else # PLUGIN_TARGET
   plugin_includedir = $(libsubincludedir)
--- liboffloadmic/plugin/Makefile.in	2014-09-16 18:16:17.961415565 +0200
+++ liboffloadmic/plugin/Makefile.in	2014-09-17 14:54:50.555096069 +0200
@@ -277,7 +277,7 @@  libsubincludedir = $(libdir)/gcc/$(targe
 target_dir = $(libdir)/gcc/$(accel_target)/$(gcc_version)
 @PLUGIN_HOST_TRUE@toolexeclib_LTLIBRARIES = libgomp-plugin-mic.la
 @PLUGIN_HOST_TRUE@libgomp_plugin_mic_la_SOURCES = libgomp-plugin-mic.cpp
-@PLUGIN_HOST_TRUE@libgomp_plugin_mic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -DMIC_LIB_PATH=\"$(target_dir)\" -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir) -I$(target_dir)/include
+@PLUGIN_HOST_TRUE@libgomp_plugin_mic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -DMIC_LIB_PATH=\"$(target_dir)\" -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir) -I$(DESTDIR)$(target_dir)/include -I$(target_dir)/include
 @PLUGIN_HOST_TRUE@libgomp_plugin_mic_la_LDFLAGS = -L$(liboffload_dir)/.libs -loffloadmic -version-info 1:0:0
 @PLUGIN_HOST_FALSE@plugin_includedir = $(libsubincludedir)
 @PLUGIN_HOST_FALSE@plugin_include_HEADERS = main_target_image.h