0

I'm having some issues using busybox and dns lookups. I found a claim that this a glibc problem. I'm on gentoo. I would like to compile busybox against uClibc, without replacing glibc on the system.

Clarification

Host system

Gentoo system, packages build against glibc. I have busybox installed as a statically linked binary against glibc. Edit: Architecture is x86_64, nomultilib.

Goal

I want to link busybox against uClibc, without messing with the host system's libc. I prefer to achieve this using gentoo's native tools, like emerge. But, suggestions that involve some manual scripting are also welcome. The target host is the same architecture.

Tried

  1. use emerge --root=/.. option. But linking still seems to be done against glibc in /
  2. Use the gentoo prefix project, but I just end up with another glibc based stage 3, in a prefixed installation path.
  3. I've found the option of gcc -Xlinker -rpath=/default/path/to/libraries -Xlinker -I/default/path/to/libraries/ld.so program.c. But I have no clue how to use this in gentoo's make.conf or in a regular make based build like busybox'.

Edit; More tries:

  1. Set USE="-static on busybox to build a dynamic linked version. Find it's library dependencies using ldd /bin/busybox. Stangly, ldd does not return any of the nss*.so libs. So I copied them the the image manually. Bit still, nslookup of ping example.com would result in an error.
  2. Download an uClibc stage from https://www.gentoo.org/downloads/. Configure and re-build the busybox binary in a chroot. This works, but is a definite overkill for building the +/- 1MB busybox binary vs a stage3 of 144MB.
7
  • Why is busybox statically linked? Using genkernel, I can build busybox without static linking into the initrd. If you aren't using busybox on your host, have you considered using a crossbuild environment? See Also: Vapier's uClibc FAQ. Of specific importance is: I've downloaded and installed crossdev but there is no target for uClibc. How am I supposed to build a cross-toolchain for gentoo? This might be overkill for one package but it's native as you requested.
    – eyoung100
    Commented Jun 26, 2018 at 22:22
  • 1
    After reading what you linked, start over, and attempt to build the entire post you linked in the crossdev environment using uclibc, after using the crossdev environment to build the ARM toolchain using your Gentoo host.
    – eyoung100
    Commented Jun 26, 2018 at 22:34
  • @eyoung100, I'm not attempting to cross-compile to ARM. I want to compile against my own system's target arch (x86_64). Reading your proposed article, crossdev might just be the answer. I didn't thought of it, since I'm compiling for same arch. I will update my question with some things I already tried since asking, including you suggestion for dynamic linking.
    – Tim
    Commented Jun 27, 2018 at 5:55
  • Let me know how it turns out. You might consider building a whole uClibc toolchain in the crossdev environment, using the info in the FAQ I linked.
    – eyoung100
    Commented Jun 27, 2018 at 6:00
  • The FAQ indeed is a good starting point, thanks for that. I will let you know. Meanwhile, I doubt if nslookup would work from the genkernel rescue shell? If so, I'd be seriously interested what their magic is to make it work.
    – Tim
    Commented Jun 27, 2018 at 6:14

0

You must log in to answer this question.

Browse other questions tagged .