kalamar
kalamar

Reputation: 953

Use different toolchain with configure on Linux

I have a toolchain for my target system (arm) correctly installed at $TOOLCHAIN.

The output of ls $TOOLCHAIN is: bin debug-root include lib lib32 lib64 sysroot.

The content of bin/* is not prefixed, i.e gcc, g++, as, ...

Now, I have a source distribution of an application I'd like to compile with the given toolchain for this target system. The source distribution has a configure script.

How to do this? Thanks in advance.

Upvotes: 0

Views: 1320

Answers (1)

user2284570
user2284570

Reputation: 3060

Building a cross compiler/binutils is often very hard, and it doesn't allow you to test your programs.
Virtual machines are very slow and create a strong separation which make hard to share files between the host an the VM.

The easiest solution is Qemu-User-static : system-calls and instructions are wrapped in user mode to the native kernel.

Download or extract a rootfs.

  • Copy it to a sub-folder of you real root directory.
  • Copy qemu-user-(the name of your mips arch)-static to the root of the target directory.
  • Correctly bind mount everything.
  • Copy /etc/resolv.conf to /your_path_to_target/etc/resolv.conf
  • Chroot to it by executing /bin/bash.
  • Use the rootfs as if you were using a real mips based machine.

Things became very simple : Many libraries aren't compiled because of things like hard-coded paths (you'll face many; many problems like the one you have with cross-compiling, a typical case). Here all happen as if you build packages natively and you'll have to type./configure.

Upvotes: 1

Related Questions