toolchain/helpers.mk: add the processing when LIBPATH is a directory
PATCH 1/1 toolchain/helpers.mk: add the processing when LIBPATH is a directory
When built with the system's toolchain, the output is as follows:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
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
So it caused the script to execute the "exit -1". When I added the processing of the directory, it was successfully built.
--- toolchain/helpers.mk | 4 ++++ 1 file changed, 4 insertions(+)
toolchain/helpers.mk +4 -0
@@ -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 ; \ else \ exit -1; \ fi; \
Signature · 6 lines
2.40.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
MidCheck, All,
On 2023-04-23 23:54 +0800, MidCheck spake thusly:
Quoted 7 lines
When built with the system's toolchain, the output is as follows:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
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 255After 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?
Quoted 3 lines
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 <[email protected]>
Please, use your real name, not a nickname. Note that it must also match the authorship. Non-latin-script characters are perfectly OK.
Quoted 9 lines
--- toolchain/helpers.mk | 4 ++++ 1 file changed, 4 insertions(+)toolchain/helpers.mk +0
-0
toolchain/helpers.mk copy_toolchain_lib_root = \ · line 34
Quoted 7 lines
toolchain/helpers.mk +4
-0@@ -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.
Quoted 10 lines
toolchain/helpers.mk +0
-0else \ exit -1; \ fi; \Signature · 6 lines
2.40.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN, ALL,
I build rootfs in docker container based on ubuntu22.04, host arch is x86_64. I chose the gcc downloaded by apt to build.
After the shell command in helpers.mk is excuted, the following content is output:
root@824b1b82dfae:~/buildroot-2022.02.11# find /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot -name "ld*.so.*" /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/etc/ld.so.conf.d /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/etc/ld.so.cache /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/etc/ld.so.conf /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/ld-linux-x86-64.so.2 /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/lib/ld-linux-x86-64.so.2 root@824b1b82dfae:~/buildroot-2022.02.11# ls -l /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/etc/ld.so.conf.d total 12 -rw-r--r-- 1 root root 38 Mar 5 2022 fakeroot-x86_64-linux-gnu.conf -rw-r--r-- 1 root root 44 Sep 24 2021 libc.conf -rw-r--r-- 1 root root 100 Sep 28 2021 x86_64-linux-gnu.conf
I added the echo on lines 753-756 of the top-level Makefile, and the build log shows it doesn't get there. Should the processing of directories be added in toolchain/helpers.mk?
Finally, I changed name to my real name: JiangXin. Thank you very much for pointint this out.
Regards,
JiangXin.
------------------ 原始邮件 ------------------
发件人: "Yann E. MORIN" <[email protected]>;
发送时间: 2023年4月24日(星期一) 凌晨0:40
收件人: "JiangXin"<[email protected]>;
抄送: "buildroot"<[email protected]>;"Romain Naour"<[email protected]>;"Giulio Benetti"<[email protected]>;"Thomas De Schampheleire"<[email protected]>;"Thomas Petazzoni"<[email protected]>; 主题: Re: [Buildroot] [PATCH 1/1] toolchain/helpers.mk: add the processing when LIBPATH is a directory
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 <[email protected]>
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
> [email protected]
> https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
JiangXin, All,
On 2023-04-24 15:56 +0800, JiangXin spake thusly:
Quoted 2 lines
I build rootfs in docker container based on ubuntu22.04, host arch is
x86_64. I chose the gcc downloaded by apt to build.
Ah, we do not support distro toolchains, see the manual, chapter 6.1.2. External toolchain backend:
https://buildroot.org/downloads/manual/manual.html#external-toolchain-backend
We also do not support using the distribution toolchain (i.e. the gcc/binutils/C library installed by your distribution) as the toolchain to build software for the target. This is because your distribution toolchain is not a "pure" toolchain (i.e. only with the C/C++ library), so we cannot import it properly into the Buildroot build environment.
Quoted 14 lines
After the shell command in helpers.mk is excuted, the following content is output:
root@824b1b82dfae:~/buildroot-2022.02.11# find /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot -name "ld*.so.*" /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/etc/ld.so.conf.d /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/etc/ld.so.cache /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/etc/ld.so.conf /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/usr/lib/ld-linux-x86-64.so.2 /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/lib/ld-linux-x86-64.so.2 root@824b1b82dfae:~/buildroot-2022.02.11# ls -l /root/buildroot-2022.02.11/output/host/x86_64-buildroot-linux-gnu/sysroot/etc/ld.so.conf.d total 12(quoted diff) +0
-3-rw-r--r-- 1 root root 38 Mar 5 2022 fakeroot-x86_64-linux-gnu.conf -rw-r--r-- 1 root root 44 Sep 24 2021 libc.conf -rw-r--r-- 1 root root 100 Sep 28 2021 x86_64-linux-gnu.conf
Quoted 2 lines
I added the echo on lines 753-756 of the top-level
Makefile, and the build log shows it doesn't get there.
This is weird, because that part should be unconditional. So, it looks like the build may in fact not be finished successfully. Could you share the last 50-or so last lines of the log?
Quoted 2 lines
Should the processing of directories be added
intoolchain/helpers.mk?
As I explained previously, and as confirmed above, support for ld.so.conf should not be added, and thus the real solution is to exclude directories in toolchain/helpers.mk line 13:
find $(STAGING_DIR)/ -name "$${LIBPATTERN}" -not -type d 2>/dev/nullRegards,
Yann E. MORIN.
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi JiangXin,
Please don't top-post, but reply inline like I do below. Note that this
requires configuring your mailer to quote replies properly.
On 25/04/2023 04:25, JiangXin wrote:
[snip]
Quoted 2 lines
Is it possible for buildroot to support distro toolchains? I'm interested in using my spare time to do that. It can save a little time for low performance processors.
You can use one of the Bootlin toolchains. It's the default if you select to
use an external toolchain. I can't imagine that you have a configuration for which a distro toolchain would exist, but no Bootlin toolchain.
Regards,
Arnout
[snip]
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot