Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross-compile: How to install with one prefix, and deploy with a different prefix?

I'm trying to cross-compile some applications for an alternative architecture.

My typical procedure is as follows:

  1. Download and untar source into /var/source
  2. ./configure --prefix=/var/install CC=[my-cross-compiler-gcc]
  3. make
  4. make install

This works as expected: My application is installed into /var/install.

However, when I deploy this application onto my alternative architecture, I don't want it deployed in /var/install. I just want it installed in / as normal.

I can copy it into /, however the application itself is still trying to look inside /var/install for various default settings.

I want to compile and install the software on my x86 system, but when I deploy it on the alternative architecture, I want it to be as if I had installed it into /, not in /var/install.

Is there a way to accomplish what I'm trying to do?

like image 384
Runcible Avatar asked May 20 '11 22:05

Runcible


People also ask

How do you cross-compile arms with GCC?

Save this answer. Install gcc-arm-linux-gnueabi and binutils-arm-linux-gnueabi packages, and then just use arm-linux-gnueabi-gcc instead of gcc for compilation. This brings in the complete cross-compile environment, including binutils. On Ubuntu 13.10 you get gcc-4.7 for 'gnueabi' and gcc-4.8 for 'gnueabihf'.


2 Answers

If I understand correctly, /var/install on your x86 system will be / on your alternative architecture. To solve your issue, you need to modify the following step:

  • configure will certainly do some sed in file, so you need to specify the final place

    ./configure --prefix=/ CC=[my-cross-compiler-gcc]

  • makefile generated by automake have support of variable DESTDIR which is prepended to the installation path:

    make DESTDIR=/var/install install

like image 52
Patrice Tisserand Avatar answered Oct 31 '22 10:10

Patrice Tisserand


I had a similar problem, but I was cross-compiling and wanted to install to the root directory of my device. In this case I specified:

make install DESTDIR=<path/to/rootfs>
like image 3
Samuel Avatar answered Oct 31 '22 10:10

Samuel