0
votes

I downloaded the MPSS software stack version 3.5.2 source code from the intel website. I am trying to compile the xeon phi ported GCC (ported from GCC 4.7.0) from source and install it in a local subdirectory. However, I am getting the following error-

k1om-mpss-linux-gcc -dumpspecs > tmp-specs
/bin/sh: k1om-mpss-linux-gcc: command not found

My configuration is as follows-

# The below directory contains the cross compiled libs
# like assembler and linker
export PATH=$HOME/xeon-phi-gcc/bin
# The configure command
../xeon-phi-gcc/configure \
  --build=x86_64-linux \
  --host=x86_64-mpsssdk-linux \
  --target=k1om-mpss-linux \
  --prefix=$HOME/cross-gcc \
  --enable-languages=c,c++ \
  --with-sysroot=/opt/mpss/3.5.1/sysroots/k1om-mpss-linux \
  --disable-multilib
# Compiling
make

Why is the Makefile calling k1om-mpss-linux-gcc ? Shouldn't this be the cross compiled gcc binary after make completes ? How can I fix this or what am I missing ?

EDIT 1: I changed the config parameters to --build=x86_64-mpsssdk-linux --host=x86_64-mpsssdk-linux. I get the following errors now-

In file included from gtype-desc.c:30:0:
../../gcc-4.7.0+mpss3.5.2/gcc/tree.h:3179:11: warning: identifier ‘thread_local’ conflicts with C++ keyword [-Wc++-compat]
  unsigned thread_local : 1;
           ^
gtype-desc.c:8696:18: error: subscripted value is neither array nor pointer nor vector
     sizeof (x_rtl[0]),
                  ^
gtype-desc.c:8815:36: error: subscripted value is neither array nor pointer nor vector
     sizeof (default_target_libfuncs[0]),
                                    ^
gtype-desc.c:8899:31: error: subscripted value is neither array nor pointer nor vector
     sizeof (default_target_rtl[0]),
                               ^
gtype-desc.c:8920:31: error: subscripted value is neither array nor pointer nor vector
     sizeof (default_target_rtl[0]),
                               ^
gtype-desc.c:8927:31: error: subscripted value is neither array nor pointer nor vector
     sizeof (default_target_rtl[0]),
                               ^
gtype-desc.c:8934:31: error: subscripted value is neither array nor pointer nor vector
     sizeof (default_target_rtl[0]),
                               ^

gtype-desc.c is a machine generated file.

EDIT 2: I am now getting the error-

/tmp/cc4aDvmI.s: Assembler messages:
/tmp/cc4aDvmI.s:94: Error: no such instruction: `kmov %esi,%k2'
/tmp/cc4aDvmI.s:147: Error: no such instruction: `kmov %edi,%k2'
/tmp/cc4aDvmI.s:255: Error: no such instruction: `kmov %r8d,%k2'
/tmp/cc4aDvmI.s:258: Error: no such instruction: `vpackstorelq %zmm0,(%rsp){%k2}'

How can I fix this ? These seem to be vector instructions but I thought that the gcc cross compiler didn't support vector instructions.

1
"/tmp/cc4aDvmI.s:258: Error: no such instruction: 'vpackstorelq %zmm0,(%rsp){%k2}'" means that GCC generates that vector instruction, but Assembler doesn't support it. Try to add the path to correct as (from MPSS) to $PATH, or maybe you will need to rebuild GCC with --with-as=... option. - Ilya Verbin
The pre installed assemblers are either /usr/bin/as or /opt/mpss/3.5.1/sysroots/x86_64-mpsssdk-linux/usr/bin/k1om-mpss-linux/k1om-mpss-linux-as. The configure script however look for x86_64-mpsssdk-linux-as. Which one should I use or I need to make another assembler as well ? - lipak
In fact, I tried using both of them and they both gave the same error. - lipak
Are you sure that GCC really uses k1om-mpss‌​-linux-as? (e.g. you can look into strace -f -o out.strace /path/to/gcc ...) I've just tried to assemble 'vpackstorelq %zmm0,(%rsp){%k2}' using k1om-mpss‌​-linux-as from MPSS 3.5.1, and it works. - Ilya Verbin
Are you talking about the normal GCC or the GCC cross compiler ? Just to clarify, I am trying to install the cross compiler. Google only gives me results when this error occurs compiling a program using either icc or pre-installed cross compiler. I am getting this error during compilation of the gcc-4.7.0+mpss3.5.2 source code. - lipak

1 Answers

1
votes

Your --build, --host and --target machine are all different (this is referenced as canadian compile, which is slightly different from cross compile, where --build and --host are the same). This means that an additional compiler is needed to build target libraries.

From GCC docs (6.1):

If build and host are different, you must have already built and installed a cross compiler that will be used to build the target libraries (if you configured with --target=foo-bar, this compiler will be called foo-bar-gcc).

So, as your --target is k1om-mpss-linux, you need that version of compiler in order to build GCC.

The result will be a GCC compiled on a --build machine that will run on a --host machine and that will produce code that can run on a --target machine.