[Buildroot] ulog compilation issue with buildroot 2022.02.2

Andreas Ziegler br015 at umbiko.net
Sun Jun 5 11:46:43 UTC 2022


Hi Thomas,

On 2022-06-05 07:06, Thomas Petazzoni wrote:
> Hello Andreas,
> 
> On Sun, 05 Jun 2022 06:05:09 +0000
> Andreas Ziegler <br015 at umbiko.net> wrote:
> 
>> This is the environment when alchemy is called from Buildroot:
>> 
>> ALCHEMY_TARGET_ENV = \
>> 	$(TARGET_MAKE_ENV) \
>> 	ALCHEMY_HOME=$(ALCHEMY_HOME) \
>> 	ALCHEMY_WORKSPACE_DIR="$(@D)" \
>> 	ALCHEMY_TARGET_OUT=alchemy-out \
>> 	PKGCONFIG_BIN=$(PKG_CONFIG_HOST_BINARY) \
>> 	TARGET_OS=linux \
>> 	TARGET_OS_FLAVOUR=buildroot \
>> 	TARGET_CROSS="$(TARGET_CROSS)" \
>> 	TARGET_ARCH=xxx \
>> 	TARGET_GLOBAL_CXXFLAGS="$(TARGET_CXXFLAGS)" \
>> 	TARGET_GLOBAL_LDFLAGS="$(TARGET_LDFLAGS)" \
>> 	                       ^ LDFLAGS are usually empty
>> 	TARGET_GLOBAL_FFLAGS="$(TARGET_FCFLAGS)" \
>> 	TARGET_GLOBAL_FCFLAGS="$(TARGET_FCFLAGS)"
>> 
>> Alchemy adds more settings to LDFLAGS, this is the final content:
>> 
>> + TARGET_GLOBAL_LDFLAGS = -O2 -Wl,-O1
>> -Lalchemy-out/staging/lib/arm-linux-gnueabihf 
>> -Lalchemy-out/staging/lib
>> -Lalchemy-out/staging/usr/lib/arm-linux-gnueabihf
>> -Lalchemy-out/staging/usr/lib
>> -Wl,-rpath-link=alchemy-out/staging/lib/arm-linux-gnueabihf
>> -Wl,-rpath-link=alchemy-out/staging/lib
>> -Wl,-rpath-link=alchemy-out/staging/usr/lib/arm-linux-gnueabihf
>> -Wl,-rpath-link=alchemy-out/staging/usr/lib
>> 
>> Adding the Buildroot staging library path to LDFLAGS makes the build
>> succeed:
>> 
>> 	...
>> 	TARGET_GLOBAL_LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" \
> 
> Thanks for your investigation!
> 
> -L$(STAGING_DIR)/usr/lib should normally not be needed, because
> $(STAGING_DIR)/usr/lib is in the default search path of the
> cross-compiler, as the compiler has $(STAGING_DIR)/usr as its sysroot.
> 
> So from a cross-compiler perspective, -L$(STAGING_DIR)/usr/lib should
> normally not be needed, and that's why it's not in $(TARGET_LDFLAGS).

And sysroot is detected by alchemy:

+ TARGET_TOOLCHAIN_SYSROOT = 
/home/data/test/autobuild/host/arm-buildroot-linux-gnueabihf/sysroot

> Also, there is a curious thing in the report from Nicolas: the error
> happens when systemd is enabled, but doesn't happen when systemd is
> disabled.

I can confirm this. Adding BR2_INIT_SYSTEMD=y breaks the build (using 
make clean && make ulog).

Kind regards,
Andreas

> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com



More information about the buildroot mailing list