Built OpenWrt with LIBC, but hostapd_cli uses musl

I need an openwrt build based on libc in stead of musl. So I build my own image.
In menuconfig, advanced options, toolchain options I selected libc.
The resulting openwrt image works perfectly, as well as a custom program that uses libc.
So far so good.

I also include hostapd-utils in the build.
Executing hostapd works OK.
However hostapd_cli gives not found

file hostapd_cli gives

hostapd_cli: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-armhf.so.1, no section header

So it looks like hostapd_cli is dependent on musl, despite the fact I build Openwrt with the option libc.

Any ideas how to solve this, because I need an libc based openwrt, but also a working hostapd_cli.

I am not a developer and I have not compiled/built OpenWrt so hopefully someone can give a definitive answer.
I have seen several posts similar to yours so you may want to use the search tool on this forum to find more info. There may also be info on this in the wiki.

EDIT: Maybe using c libraries other than musl are no longer supported. At least uclibc:

What I recall seeing is that you need to compile all the components that you may need and all their dependencies and sub dependencies using the libc libraries. It may take more storage space and time to do the compile but it may be "easier" to select everything and compile/build all kmods, packages, etc. Things like kmods need the same build hash or something like that in order to run and that is one reason to build everything together.

You can then install kmods and packages from your own build as needed.

I hope this is helpful but do keep looking for more info if it seems like I don't remember correctly.

1 Like

Thanks for you reaction! I will investigate further.

1 Like

Can you check other binaries are not linked with musl ?

Like the following, which is from a musl-based openwrt:

root@owrt:~# ldd /bin/ping
        /lib/ld-musl-mipsel-sf.so.1 (0x77eee000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x77fee000)
        libc.so => /lib/ld-musl-mipsel-sf.so.1 (0x77eee000)

Yes, I can :slight_smile:

BusyBox v1.35.0 (2023-01-03 00:24:21 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 22.03.3, r20028-43d71ad93e
 -----------------------------------------------------
root@OpenWrt:~# ldd /bin/ping
        linux-vdso.so.1 (0xbed2a000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0xb6ef1000)
        libm.so.6 => /lib/libm.so.6 (0xb6e9e000)
        libresolv.so.2 => /lib/libresolv.so.2 (0xb6e7f000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6e63000)
        libc.so.6 => /lib/libc.so.6 (0xb6cf1000)
        /lib/ld-linux-armhf.so.3 (0xb6f30000)
root@OpenWrt:~#

Wait, I just tested hostapd_cli and it is normally working; I think I messed up the two openwrt's I have (one operational router, and one for testing on my RPI4).

Sorry for bothering you!

1 Like

Hey, wasn't bothering, just a bit intriguing. Glad you sorted it out.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.