install and the strip command

Trying to do a "make install" on a mips box .

llvm[2]: Installing Release+Asserts Archive Library /home/rkotler/caviumllvmwclang/install/lib/libLLVMLineEditor.a
make[2]: Leaving directory `/home/rkotler/caviumllvmwclang/build/lib/LineEditor'
make[1]: Leaving directory `/home/rkotler/caviumllvmwclang/build/lib'
make[1]: Entering directory `/home/rkotler/caviumllvmwclang/build/tools/llvm-config'
llvm[1]: Installing llvm-config-host
strip: Unable to recognise the format of the input file `/home/rkotler/caviumllvmwclang/install/bin/llvm-config-host'
/usr/bin/install: strip process terminated abnormally
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/rkotler/caviumllvmwclang/build/tools/llvm-config'
make: *** [install] Error 1

I can provide another strip but I don' think that we have a way to control the install command to use it.

Any ideas?

Tia.

Reed

Hi,

Trying to do a "make install" on a mips box .

llvm[2]: Installing Release+Asserts Archive Library
/home/rkotler/caviumllvmwclang/install/lib/libLLVMLineEditor.a
make[2]: Leaving directory
`/home/rkotler/caviumllvmwclang/build/lib/LineEditor'
make[1]: Leaving directory `/home/rkotler/caviumllvmwclang/build/lib'
make[1]: Entering directory
`/home/rkotler/caviumllvmwclang/build/tools/llvm-config'
llvm[1]: Installing llvm-config-host
strip: Unable to recognise the format of the input file
`/home/rkotler/caviumllvmwclang/install/bin/llvm-config-host'
/usr/bin/install: strip process terminated abnormally
make[1]: *** [install] Error 1
make[1]: Leaving directory
`/home/rkotler/caviumllvmwclang/build/tools/llvm-config'
make: *** [install] Error 1

I can provide another strip but I don' think that we have a way to control
the install command to use it.

It's a known problem. See r142997 and r143009. And this discussion:
http://llvm.1065342.n5.nabble.com/The-make-install-fails-in-cross-compile-mode-td23139.html

Install tool invokes strip. GNU install allows to configure which
strip to use (--strip-program). In general (for example on FreeBSD) it
is not possible and install always runs just 'strip'. In case of
cross-compilation that leads to the error.

The workaround, I hope it still works, is to keep symbols:
KEEP_SYMBOLS=1 make install

Another workaround is to configure with --enable-keep-symbols.

I had to chuckle when I read the discussion you pointed to. Reed was in it.

-Rich

Actually it is possible on FreeBSD -- from install(1):

ENVIRONMENT
     The install utility checks for the presence of the STRIPBIN environment
     variable and if present, uses the assigned value as the program to run if
     and when the -s option has been specified.

I'm not aware of other BSDs having this though, and supporting a
collection of command options and environment settings on various
platforms seems like it would be rather awkward.

However, FreeBSD will likely soon migrate to strip, nm, size and such
from the elftoolchain project, and those tools are natively cross-arch
so strip should just work for this case.

For NetBSD, it is STRIP.

Joerg

The problem seems to be the executable

llvm-config-host

this is the wrong file type for the machine that I'm on.

I'm building a hosted mips clang/llvm compiler, starting by compiling llvm with clang/llvm on x86 producing a mips executable.

The question then is where to run install.

If I run install on the mips target, then file llvm-config-host is an x86 executable so strip will fail.

../install/bin/llvm-config-host: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x64e37bd56c1edc16be1447ec301bfce3f207477d, not stripped
rkotler@mipsswbrd006-le:~/caviumllvmwclang/build$

If I tried to do the install on the host, there would be a bigger problem because then strip would fail on every other executable.

So the main problem is that install should not be trying to strip
rkotler@mipsswbrd006-le:~/caviumllvmwclang/build$ which strip
/usr/bin/strip
rkotler@mipsswbrd006-le:~/caviumllvmwclang/build$

Perhaps I just need to delete that file from the build directory.

All the tools in

./BuildTools/Release+Asserts/bin/

Are host tools. Since I'm not doing the make install on the target, then strip does not know about these.

It knows enough to install these as
xxx-host

but not enough to not call strip.

So I guess the question is: how do you do the make install?

I'm rebuilding right now with --enable-keep-symbols and then perhaps it can be installed on either the host or target.

It's always possible to later strip the binaries in the installed bin directory.

so if i configure with --enable-keep-symbols

then a "make install" on the host works but not on the target.

the resulting directory structure will be fine.

so if i configure with --enable-keep-symbols

then a "make install" on the host works but not on the target.

the resulting directory structure will be fine.

It would be better if "make install" worked on the target (also).

In this case, I'm using NFS mounted systems out of my home directory so it's easy to finesse this.

Otherwise I'd have to make a root files system to get something I could install on the target.

In this case I need to strip the executables manually, if desired, after the actual install, on the target.