Thu Nov 26 17:52:13 CET 2009

on-target ldd / INTERP and --dynamic-linker=

Busybox simply returns a "not found" error whenever an application
doesn't load due to dynamic linker errors.  It would be handy to have
"ldd" on the target device.

Solution: with /data/uclibc as the root of the uclibc tree, set the
INTERP program header using the linker flag:


This means gcc at link time needs the following flag



  - can this be done as a post-processing step (i.e. adding an elf section?)

  - how to build an entire buildroot setup with this flag added --
    without postprocessing?

Grepping the buildroot tree gives the follwing:

toolchain_build_arm/uClibc-	LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO)

Grepping for UCLIBC_LDSO_ABSPATH gives:

toolchain_build_arm/uClibc-$(shell pwd)
toolchain_build_arm/uClibc-	LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO)

Looks like the var of interest is SHARED_LIB_LOADER_PREFIX, which is a
configuration variable in toolchain_build_arm/uClibc-


uClibc Configuration -> Library Installation Options -> Shared library loader path

Could also be the next one: RUNTIME_PREFIX

Where to change this?  Probably not in the .config file itself...

Apparently buildroot patches the .oldconfig file and resets the
SHARED_LIB_LOADER_PREFIX variable, so no use in changing it

cp -f  uClibc-android.config /usr/people/beschout.nba/src/buildroot-2009.08/toolchain_build_arm/uClibc-
/usr/people/beschout.nba/src/buildroot-2009.08/toolchain_build_arm/bin/sed -i -e 's,^CROSS_COMPILER_PREFIX=.*,CROSS_COMPILER_PREFIX="/usr/people/beschout.nba/src/buildroot-2009.08/build_arm/staging_dir/usr/bin/arm-linux-uclibcandroid-",g' \
		-e 's,# TARGET_arm is not set,TARGET_arm=y,g' \
		-e 's,^TARGET_ARCH=".*",TARGET_ARCH=\"arm\",g' \
		-e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"/usr/people/beschout.nba/src/buildroot-2009.08/toolchain_build_arm/linux\",g' \
		-e 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"/usr/people/beschout.nba/src/buildroot-2009.08/toolchain_build_arm/linux/include\",g' \
		-e 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \
		-e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \
(/bin/echo "# CONFIG_GENERIC_ARM is not set"; \
	 /bin/echo "# CONFIG_ARM610 is not set"; \
	 /bin/echo "# CONFIG_ARM710 is not set"; \
	 /bin/echo "# CONFIG_ARM7TDMI is not set"; \
	 /bin/echo "# CONFIG_ARM720T is not set"; \
	 /bin/echo "# CONFIG_ARM920T is not set"; \
	 /bin/echo "# CONFIG_ARM922T is not set"; \
	 /bin/echo "# CONFIG_ARM926T is not set"; \
	 /bin/echo "# CONFIG_ARM10T is not set"; \
	 /bin/echo "# CONFIG_ARM1136JF_S is not set"; \
	 /bin/echo "# CONFIG_ARM1176JZ_S is not set"; \
	 /bin/echo "# CONFIG_ARM1176JZF_S is not set"; \
	 /bin/echo "# CONFIG_ARM_SA110 is not set"; \
	 /bin/echo "# CONFIG_ARM_SA1100 is not set"; \
	 /bin/echo "# CONFIG_ARM_XSCALE is not set"; \
	 /bin/echo "# CONFIG_ARM_IWMMXT is not set"; \
	) >> /usr/people/beschout.nba/src/buildroot-2009.08/toolchain_build_arm/uClibc-

The template for this is:

# Reset the installation paths:

sed -e "s@.*SHARED_LIB_LOADER_P.*@SHARED_LIB_LOADER_PREFIX=\"${prefix}/lib\"@g" \
	-i .config &&
sed -e "s@.*RUNTIME_PREFIX.*@RUNTIME_PREFIX=\"${prefix}\"@g" \
	-i .config &&
sed -e "s@.*DEVEL_PREFIX.*@DEVEL_PREFIX=\"${prefix}/\"@g" \
	-i .config &&
sed -e "s@.*KERNEL_SOURCE.*@KERNEL_SOURCE=\"${prefix}\"@g" -i .config

beschout@vixen:~/sony/android-uclibc/buildroot-2009.08/toolchain$ grep -re 'SHARED_LIB_LOADER_PREFIX' *
uClibc/uclibc.mk:		-e 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \

What about patching toolchain/uClibc/uclibc.mk directly?