0

I am trying to build OATH Toolkit for MIPS on an x86 system. I want to produce a static build so it would most likely work on any MIPS system.

Just to be more precise the supported ISA on target system are: mips1 mips2 mips32r1 mips32r2

From what I understood I need to prepare a toolchain in order to do this and I successfully configured and build buildroot so now I do have it inside ~/buildroot-2016.08.1/output/target

How am I supposed to use/activate the buildroot in order to build the check put oath-toolkit code?

Note: I am not forced to use buildroot, so I would consider any alternatives.

sorin
  • 161,544
  • 178
  • 535
  • 806

1 Answers1

2

Just run the configure script with the appropriate arguments to use the Buildroot compiler as a cross-compiler, and with the argument to link statically.

./configure --enable-static --disable-shared \
     --target=mips-buildroot-linux-gnu --host=mips-buildroot-linux-gnu \
     CC=$HOME/buildroot-2016.08.1/output/host/usr/bin/mips-linux-gcc

The above is assuming you are using glibc and big-endian MIPS. Check the directory name of ~/buildroot-2016.08.1/output/host/usr/mips* for the correct value of the --target/--host options, and the contents of ~/buildroot-2016.08.1/output/host/usr/bin for the correct value of the CC= option.

Note that you have to choose the "mips 32" architecture variant (BR2_mips_32) to be compatible with all your target systems.

Note also that with glibc, you might not have a completely statically linked executable, because it will try to load the NSS libraries dynamically. This is the case e.g. if getaddrinfo is used to resolve a hostname. You need to use uClibc or musl to avoid that.

Arnout
  • 2,927
  • 16
  • 24