This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help with intel mic target building


Hi!

On Thu, 25 Feb 2016 20:55:17 +0100, I wrote:
> On Tue, 23 Feb 2016 13:22:18 +0100, Martin LiÅka <mliska@suse.cz> wrote:
> > I'm got one another question:
> > looks TEST-gcc fails for many of these errors:
> > 
> > spawn -ignore SIGHUP /home/marxin/Programming/build-offload-light/build-gcc/gcc/xgcc -B/home/marxin/Programming/build-offload-light/build-gcc/gcc/ /home/marxin/Programming/build-offload-light/source-gcc/libgomp/testsuite/libgomp.c/examples-4/array_sections-3.c -B/home/marxin/Programming/build-offload-light/build-gcc/x86_64-pc-linux-gnu/./libgomp/ -B/home/marxin/Programming/build-offload-light/build-gcc/x86_64-pc-linux-gnu/./libgomp/.libs -I/home/marxin/Programming/build-offload-light/build-gcc/x86_64-pc-linux-gnu/./libgomp -I/home/marxin/Programming/build-offload-light/source-gcc/libgomp/testsuite/../../include -I/home/marxin/Programming/build-offload-light/source-gcc/libgomp/testsuite/.. -fmessage-length=0 -fno-diagnostics-show-caret -fdiagnostics-color=never -B/home/marxin/Programming/build-offload-light/install/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-pc-linux-gnu/6.0.0 -B/home/marxin/Programming/build-offload-light/install/offload-x86_64-intelmicemul-linux-gnu/bin
> >   
> > -fopenmp -O2 -L/home/marxin/Programming/build-offload-light/build-gcc/x86_64-pc-linux-gnu/./libgomp/.libs -lm -o ./array_sections-3.exe
> 
> That matches the command line that I'm seeing in libgomp.log.
> 
> > lto-wrapper: fatal error: problem with building target image for x86_64-intelmicemul-linux-gnu
> > 
> > 
> > 
> > compilation terminated.
> > 
> > /usr/lib64/gcc/x86_64-suse-linux/5/../../../../x86_64-suse-linux/bin/ld: lto-wrapper failed
> > 
> > collect2: error: ld returned 1 exit status
> > 
> > compiler exited with status 1
> > output is:
> > lto-wrapper: fatal error: problem with building target image for x86_64-intelmicemul-linux-gnu
> 
> > 
> > 
> > Running one manually in strace shows that mkoffload cannot be found:
> > [pid 206095] stat("/home/marxin/Programming/build-offload-light/build-gcc/gcc//accel/x86_64-intelmicemul-linux-gnu/mkoffload", 0x7ffda24478d0) = -1 ENOENT (No such file or directory)
> > [pid 206095] stat("/home/marxin/Programming/build-offload-light/build-gcc/x86_64-pc-linux-gnu/./libgomp//accel/x86_64-intelmicemul-linux-gnu/mkoffload", 0x7ffda24478d0) = -1 ENOENT (No such file or directory)
> > [pid 206095] stat("/home/marxin/Programming/build-offload-light/build-gcc/x86_64-pc-linux-gnu/./libgomp/.libs//accel/x86_64-intelmicemul-linux-gnu/mkoffload", 0x7ffda24478d0) = -1 ENOENT (No such file or directory)
> > [pid 206095] stat("/home/marxin/Programming/build-offload-light/install/offload-x86_64-intelmicemul-linux-gnu/bin//accel/x86_64-intelmicemul-linux-gnu/mkoffload", 0x7ffda24478d0) = -1 ENOENT (No such file or directory)
> > [pid 206095] write(2, "lto-wrapper: fatal error: problem with building target image for x86_64-intelmicemul-linux-gnu\n\n", 96) = 96
> > [pid 206095] write(2, "compilation terminated.\n", 24) = 24
> > [pid 206095] exit_group(1)              = ?
> > 
> > Where $find install/ -name mkoffload
> > install/offload-x86_64-intelmicemul-linux-gnu/lib/gcc/x86_64-pc-linux-gnu/6.0.0/accel/x86_64-intelmicemul-linux-gnu/mkoffload
> 
>     $ find install/ -name mkoffload
>     install/offload-nvptx-none/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/accel/nvptx-none/mkoffload
>     install/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/accel/x86_64-intelmicemul-linux-gnu/mkoffload
> 
> So, libexec vs. lib.
> 
> > Is it something related to my site script?
> 
> I'd assume so, yes, because it contains:
> 
>     # If user did not specify libexecdir, set the correct target:
>     # Nor FHS nor openSUSE allow prefix/libexec. Let's default to prefix/lib.
>     
>     if test "$libexecdir" = '${exec_prefix}/libexec' ; then
>             libexecdir='${exec_prefix}/lib'
>     fi
> 
> However, I'll have to try to figure out why GCC then isn't able to locate
> the file.  Actually, I think I can already see the problem: you got a
> -B/home/marxin/Programming/build-offload-light/install/offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-pc-linux-gnu/6.0.0
> search path in libgomp.log, but would need a "s%libexec%lib%" for that to
> locate your mkoffload.  These -B search paths are generated in
> libgomp/plugin/configfrag.ac, which, basically, assumes that your
> offloading compilers are configured with "standard" paths.  Will need to
> think about how to make that more flexible.  (Ilya CCed, who contributed
> this code, together with Andrey Turetskiy.)

The code in question, libgomp/plugin/configfrag.ac:

    [...]
    if test x"$enable_offload_targets" != x; then
      for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
        tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
        tgt=`echo $tgt | sed 's/=.*//'`
    [...]
          offload_additional_options="$offload_additional_options -B$tgt_dir/libexec/gcc/\$(target_alias)/\$(gcc_version) -B$tgt_dir/bin"
          offload_additional_lib_paths="$offload_additional_lib_paths:$tgt_dir/lib64:$tgt_dir/lib:$tgt_dir/lib32"
    [...]

(I never quite liked this hard-coding -- but it worked well enough.)  ;-)

With the x86_64-intelmicemul-linux-gnu offload compiler installed with
--prefix=$PWD/install/offload-x86_64-intelmicemul-linux-gnu, and the
target compiler configured with
--enable-offload-targets=x86_64-intelmicemul-linux-gnu=$PWD/install/offload-x86_64-intelmicemul-linux-gnu,
we could cook up something along these lines:

    $ install/offload-x86_64-intelmicemul-linux-gnu/bin/x86_64-pc-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc -print-prog-name=mkoffload 
    [...]/install/offload-x86_64-intelmicemul-linux-gnu/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.0.0/accel/x86_64-intelmicemul-linux-gnu/mkoffload
    $ install/offload-x86_64-intelmicemul-linux-gnu/bin/x86_64-pc-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc -print-multi-os-directory
    ../lib64
    $ install/offload-x86_64-intelmicemul-linux-gnu/bin/x86_64-pc-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc -print-multi-os-directory -m32
    ../lib32

That is, we'd need the path to the offload compiler's "gcc" binary, and
by querying that one, can deduce everything needed for the -B search
paths.  Currently, we support the syntax
--enable-offload-targets=[tgt]=[tgt_dir]; we'd need something new for
--enable-offload-targets=[tgt]=[tgt's gcc], because we also can't assume
that the offload compiler's "gcc" binary will always be available in
[tgt_dir]/bin/, because that can also be overridden on the configure
command line.  Actually, we could just support
--enable-offload-targets=[tgt]=[path], and if [path] points to a
directory, we continue to use the current -B scheme, but if [path] points
to an executable, that has to be [tgt]'s "gcc" binary.  OK?  I'll try to
come up with a patch.


GrÃÃe
 Thomas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]