1

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.

lipak
  • 69
  • 6
  • "/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 Sep 02 '15 at 08:27
  • 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 Sep 02 '15 at 12:41
  • In fact, I tried using both of them and they both gave the same error. – lipak Sep 02 '15 at 13:31
  • 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 Sep 02 '15 at 14:12
  • 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 Sep 02 '15 at 14:57
  • Oh, I thought that you successfully built cross compiler, but it does not work. Probably `--disable-bootstrap` configure option will help. – Ilya Verbin Sep 02 '15 at 15:15

1 Answers1

1

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.

gengisdave
  • 1,969
  • 5
  • 21
  • 22
  • When I do `intel-provided-cross-compiler-gcc -v`, then also I get the same configure options. Just to clarify, I am trying to build the cross compiler and not the native compiler. – lipak Sep 01 '15 at 05:28
  • The `k1om-mpss-linux` GCC; you're not doing a cross compile as you gave different `--target`; a cross compile requires that `--build` and `--host` are the same – gengisdave Sep 01 '15 at 05:34
  • I don't understand why I would need foo-bar-gcc. `target` is the architecture for which the new compiler will generate binaries and `host` is the architecture on which the new compiler will run. So, to generate the binary of the new compiler, a cross compiler between `build` and `host` should be required, or is not ? – lipak Sep 01 '15 at 05:51
  • While `build` is the easier (as it the the arch used for the compilation), `host` is the architecture that will run the compiled (newer) GCC and `target` is the architecture of the code compiled by the newer GCC. Basically, you said: use my `x86_64-linux` to build a compiler that will run on `x86_64-mpsssdk-linux` who will generate code for `k1om-mpss-linux` – gengisdave Sep 01 '15 at 05:57
  • That is exactly what I said. Just to clarify, can you tell me what should be the correct config params if `k1om-mpss-linux-gcc` is what I finally desire to make. – lipak Sep 01 '15 at 13:17
  • You can install the `k1om-mpss-linux-gcc` from a package or compile yourself a native one (same `--build` and `--host`). – gengisdave Sep 01 '15 at 16:05
  • I edited the question details. Can you have a look ? – lipak Sep 01 '15 at 18:25
  • sadly, `thread_local` is not supported in GCC 4.7.0 http://stackoverflow.com/questions/9142453/c11-thread-local-in-gcc-alternatives - this post contains some workarounds – gengisdave Sep 01 '15 at 18:33
  • but the error is not due to `thread_local` but in `gtype-desc.c`. This is the intel provided source code as it is and I am compiling using GCC 4.8.2 – lipak Sep 01 '15 at 20:58
  • sorry, my fault; the error means that the code tries to handle a basic type as an array (of the same type); I found this old bug https://gcc.gnu.org/ml/gcc-help/2014-03/msg00049.html – gengisdave Sep 01 '15 at 21:15