"make install" fails in a cross-compilation mode with turned on optimization

Hi,

LLVM "make install" command fails in a cross-compilation mode if
optimization is turned on. In that case "install" program is executed
on x86 host with "-s" option and cannot strip target platform binaries
because "install" does not recognize format of these files. Running
"make install" on the target platform is not a solution. In that case
"install" cannot recognize format of "llvm-config-host" file.

What is the correct way for cross-building LLVM/CLang with turned on
optimization? Is it a known problem?

Hi Simon,

LLVM "make install" command fails in a cross-compilation mode if
optimization is turned on. In that case "install" program is executed
on x86 host with "-s" option and cannot strip target platform binaries
because "install" does not recognize format of these files. Running
"make install" on the target platform is not a solution. In that case
"install" cannot recognize format of "llvm-config-host" file.

What is the correct way for cross-building LLVM/CLang with turned on
optimization? Is it a known problem?

I think you can build binutils which will understand plenty of file
format. This way strip will work on cross-compiled stuff.

Yes, it's one of the possible workarounds. Personally I use a
different approach - a wrapper for the install script which invokes an
appropriate "strip" command. But I'm interesting in general solution
works out-of-the-box.

As far as I know if Makefiles are generated by cmake, binaries are not
stripped at all. Is it a deliberate decision? If yes, I can just fix
Makefile.rules to remove strip invocation and close the problem.