[Buildroot] [PATCH 1/1] toolchain/helpers.mk: add the processing when LIBPATH is a directory

Yann E. MORIN yann.morin.1998 at free.fr
Sun Apr 23 16:40:25 UTC 2023


MidCheck, All,

On 2023-04-23 23:54 +0800, MidCheck spake thusly:
> When built with the system's toolchain, the output is as follows:
> >>> toolchain-external-custom  Installing to target
> >>> toolchain-external-custom  Copying external toolchain libraries to target...
> make: *** [package/pkg-generic.mk:384: /root/buildroot-2022.02.11/output/build/toolchain-external-custom/.stamp_target_installed] Error 255
> 
> After echo the value of LIBPATH, I found it is a directory:
> /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/etc/ld.so.conf.d

This is weird that you get an ld.so.conf.d in your toolchain. Is it a
toolchain we can have access to? How did it get built?

> So it caused the script to execute the "exit -1". When I added the processing of the directory, it was successfully built.
> 
> Signed-off-by: MidCheck <mc.xin at foxmail.com>

Please, use your real name, not a nickname. Note that it must also match
the authorship. Non-latin-script characters are perfectly OK.

> ---
>  toolchain/helpers.mk | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index 24c482923a..e0ab991bec 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -28,6 +28,10 @@ copy_toolchain_lib_root = \
>  			elif test -f $${LIBPATH}; then \
>  				$(INSTALL) -D -m0755 $${LIBPATH} $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
>  				break ; \
> +			elif test -d $${LIBPATH}; then \
> +				mkdir -p $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
> +				cp -r $${LIBPATH}/* $(TARGET_DIR)/$${DESTDIR}/$${LIBNAME}; \
> +				break ; \

The proper fix would be to exclude directories in the find on line 13.

Indeed, LIBPATTERN is the argument to copy_toolchain_lib_root, and in
the case of external toolchains, is each item in TOOLCHAIN_EXTERNAL_LIBS,
the first of which is ld*.so.*, which we expect to only match files, but
in your case matches a directory.

As I understand it, ld.so.conf is not used at build time to find
libraries, so having it in the staging is useless.

Also note that having /etc/ld.so.conf.d in the target is not supported,
and that Buildroot will explicitly fail at the end of the build if it
sees such a directory, as it is not possible to have proper ldconfig
setup in cross-compilation; see the top-level Makefile, lines 753-756,
and commit 9c4072348960 (Makefile: drop ldconfig handling). And so it is
even weirder that your change makes the build succeed...

Regards,
Yann E. MORIN.

>  			else \
>  				exit -1; \
>  			fi; \
> -- 
> 2.40.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot at buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list