为Yocto构建GoAccess配方时缺失ld-linux-armhf.so.3的解决咨询
Hi there! Let's work through your GoAccess Yocto recipe issues step by step:
1. Fixing the /lib/ld-linux-armhf.so.3 Error
This error is a classic cross-compilation gotcha—here's what's happening: the bin2c utility is being compiled for your target ARM architecture, but your build machine is x86. When the build process tries to run this ARM binary, it looks for the ARM dynamic linker (ld-linux-armhf.so.3) which doesn't exist on your x86 host.
The fix is to compile a host-compatible version of bin2c first, then tell the build system to use that instead of the cross-compiled one:
- Add a pre-compile step to build bin2c with your host toolchain
- Override the
do_compiletask to use this host binary
Here's how to implement it in your recipe:
do_compile_prepend() { # Build a version of bin2c that runs on your build host ${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS} ${S}/tools/bin2c.c -o ${S}/tools/bin2c-host } do_compile() { # Use the host bin2c instead of the cross-compiled one oe_runmake BIN2C=${S}/tools/bin2c-host }
And to clarify: ld-linux-armhf.so.3 is part of the glibc package for ARM targets, but you don't need to add it to DEPENDS—this isn't a missing dependency issue, it's a toolchain usage problem.
2. Recipe Cleanup & Optimizations
Your recipe has some redundant bits we can trim:
- Remove unnecessary
cdcommands: Theautotoolsclass already sets${S}as the working directory fordo_configureanddo_compile, so thosecd ${S}lines are totally unnecessary and can be deleted. - Simplify configuration: Instead of overriding
do_configureentirely, use theEXTRA_OECONFvariable to pass your custom flags—this is the Yocto idiomatic way:
You can then delete the entireEXTRA_OECONF = "--enable-utf8 --enable-geoip=legacy"do_configurefunction, since the autotools class will handle runningconfigurewith the correct host/build arguments plus your custom flags. - Drop the empty
do_compile_prepend: The original emptycd ${S}block can be removed entirely once you add the bin2c pre-compile step.
3. Dependency Questions
Let's clear up your dependency doubts:
- coreutils: You don't need this in
DEPENDS. Yocto's build environment already provides all core utilities (likecat,sed,tr) via native packages or your build host's tools. Adding it here is redundant. - popt: To confirm if this is needed, check the GoAccess configure output (look for lines about popt) or run
./configure --helpin the source tree to see if there's a--without-poptoption. If it's not a hard requirement, you can safely remove it fromDEPENDS.
Optimized Full Recipe
Putting it all together, here's your cleaned-up recipe:
SUMMARY = "GoAccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal on *nix systems or through your browser." HOMEPAGE = "https://goaccess.io" SECTION = "console/utils" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=01c937f4a0ce3daba5ca22e80b53d24b" DEPENDS = "ncurses geoip tokyocabinet gettext-native" SRC_URI = "https://tar.goaccess.io/goaccess-${PV}.tar.gz" SRC_URI[md5sum] = "6f4b60f87755a7d1b350badfedda0aa3" SRC_URI[sha256sum] = "e8fbb9ff852556d72dfd9f1d0134ba075ce5b4c41289902a6f4e0d97c69377be" S = "${WORKDIR}/goaccess-${PV}" inherit autotools pkgconfig EXTRA_OECONF = "--enable-utf8 --enable-geoip=legacy" do_compile_prepend() { # Build host-compatible bin2c to avoid cross-compilation runtime issues ${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS} ${S}/tools/bin2c.c -o ${S}/tools/bin2c-host } do_compile() { oe_runmake BIN2C=${S}/tools/bin2c-host }
Final Tip
Before rebuilding, run bitbake goaccess -c cleanall to wipe any stale build artifacts—this ensures you're starting fresh with your updated recipe.
内容的提问来源于stack exchange,提问作者martinklaus

