* [Buildroot] [PATCH 0/3] toolchain: Add support for Sourcery Codebench Standard
@ 2014-07-13 18:45 Romain Naour
2014-07-13 18:45 ` [Buildroot] [PATCH 1/3] toolchain-external: handle a special case where kernel headers check needs TOOLCHAIN_EXTERNAL_CFLAGS Romain Naour
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Romain Naour @ 2014-07-13 18:45 UTC (permalink / raw)
To: buildroot
The purpose of this series is to provide support for Sourcery Codebench
Standard (licenced) edition in Buildroot.
Since these toolchain can't be downloaded, we need to use the custom toolchain
backend to import them into Buildroot.
In Toolchain menu, select:
Toolchain type (External toolchain)
Toolchain (Custom toolchain)
Toolchain origin (Pre-installed toolchain)
Then set all toolchain settings (kernel headers, libc, rpc, c++ etc...)
I'm using the Sourcery Codebench 2014.05 for IA32 GNU/Linux, here is the
settings:
(i686-pc-linux-gnu) Toolchain prefix
External toolchain kernel headers series (3.13.x)
External toolchain C library (glibc/eglibc)
[*] Toolchain has RPC support
[*] Toolchain has C++ support?
(-pipe -msgxx-glibc) Target Optimizations
The "-msgxx-glibc" flag in "Target Optimizations" is mandatory otherwise the
toolchain won't work.
The toolchain-external infra need to be modified to handle a special case where
all the libraries and headers are in the arch sysroot (sgxx-glibc).
Romain Naour (3):
toolchain-external: handle a special case where kernel headers check
needs TOOLCHAIN_EXTERNAL_CFLAGS
toolchain-external: handle a special case where glibc check needs
TOOLCHAIN_EXTERNAL_CFLAGS
toolchain-external: fix Sourcery Codebench symlink
toolchain/toolchain-external/toolchain-external.mk | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 1/3] toolchain-external: handle a special case where kernel headers check needs TOOLCHAIN_EXTERNAL_CFLAGS
2014-07-13 18:45 [Buildroot] [PATCH 0/3] toolchain: Add support for Sourcery Codebench Standard Romain Naour
@ 2014-07-13 18:45 ` Romain Naour
2014-07-13 18:45 ` [Buildroot] [PATCH 2/3] toolchain-external: handle a special case where glibc " Romain Naour
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Romain Naour @ 2014-07-13 18:45 UTC (permalink / raw)
To: buildroot
With the Sourcery Codebench standard edition, the sysroot returned
point to a non existant directory if no CFLAGS are specified.
Here are the results of -print-sysroot gcc option:
$ ./i686-pc-linux-gnu-gcc -print-sysroot
Full/path/to/i686-pc-linux-gnu/libc/system32
$ ./i686-pc-linux-gnu-gcc -m64 -print-sysroot
Full/path/to/i686-pc-linux-gnu/libc/system64
$ ./i686-pc-linux-gnu-gcc -msgxx-glibc -print-sysroot
Full/path/to/i686-pc-linux-gnu/libc/sgxx-glibc
The problem is that in the "libc" directory there is only the sub-directory
"sgxx-glibc".
Note: All hearders files and libraries are available in arch specific sysroot.
When using the -print-file-name gcc option, the result is quite buggy and it is
not empty.
$ ./i686-pc-linux-gnu-gcc -print-file-name=libc.a
libc.a
So the toolchain check fail because $PWD/libc.a is used as SYSROOT_DIR since
the toolchain-external backend does not always use CFLAGS.
Add a test to use ARCH_SYSROOT_DIR for kernel headers check if SYSROOT_DIR is
not a directory.
Signed-off-by: Romain Naour <romain.naour@openwide.fr>
---
toolchain/toolchain-external/toolchain-external.mk | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index 0955686..8280b84 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -454,9 +454,16 @@ define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
exit 1 ; \
fi ; \
- $(call check_kernel_headers_version,\
- $(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC)),\
- $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \
+ ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
+ if test -d "$${SYSROOT_DIR}" ; then \
+ $(call check_kernel_headers_version,\
+ "$${SYSROOT_DIR}",\
+ $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \
+ else \
+ $(call check_kernel_headers_version,\
+ "$${ARCH_SYSROOT_DIR}",\
+ $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \
+ fi ; \
if test "$(BR2_arm)" = "y" ; then \
$(call check_arm_abi,\
"$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS)",\
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 2/3] toolchain-external: handle a special case where glibc check needs TOOLCHAIN_EXTERNAL_CFLAGS
2014-07-13 18:45 [Buildroot] [PATCH 0/3] toolchain: Add support for Sourcery Codebench Standard Romain Naour
2014-07-13 18:45 ` [Buildroot] [PATCH 1/3] toolchain-external: handle a special case where kernel headers check needs TOOLCHAIN_EXTERNAL_CFLAGS Romain Naour
@ 2014-07-13 18:45 ` Romain Naour
2014-07-13 18:46 ` [Buildroot] [PATCH 3/3] toolchain-external: fix Sourcery Codebench symlink Romain Naour
2014-10-12 14:53 ` [Buildroot] [PATCH 0/3] toolchain: Add support for Sourcery Codebench Standard Thomas Petazzoni
3 siblings, 0 replies; 5+ messages in thread
From: Romain Naour @ 2014-07-13 18:45 UTC (permalink / raw)
To: buildroot
With the Sourcery Codebench standard edition, the sysroot returned
point to a non existant directory if no CFLAGS are specified.
Add a test to use ARCH_SYSROOT_DIR for glibc check if SYSROOT_DIR is not a
directory.
Signed-off-by: Romain Naour <romain.naour@openwide.fr>
---
toolchain/toolchain-external/toolchain-external.mk | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index 8280b84..f6e51a1 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -477,7 +477,11 @@ define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
elif test "$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \
$(call check_musl,$${SYSROOT_DIR}) ; \
else \
- $(call check_glibc,$${SYSROOT_DIR}) ; \
+ if test -d "$${SYSROOT_DIR}" ; then \
+ $(call check_glibc,$${SYSROOT_DIR}) ; \
+ else \
+ $(call check_glibc,$${ARCH_SYSROOT_DIR}) ; \
+ fi \
fi
endef
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 3/3] toolchain-external: fix Sourcery Codebench symlink
2014-07-13 18:45 [Buildroot] [PATCH 0/3] toolchain: Add support for Sourcery Codebench Standard Romain Naour
2014-07-13 18:45 ` [Buildroot] [PATCH 1/3] toolchain-external: handle a special case where kernel headers check needs TOOLCHAIN_EXTERNAL_CFLAGS Romain Naour
2014-07-13 18:45 ` [Buildroot] [PATCH 2/3] toolchain-external: handle a special case where glibc " Romain Naour
@ 2014-07-13 18:46 ` Romain Naour
2014-10-12 14:53 ` [Buildroot] [PATCH 0/3] toolchain: Add support for Sourcery Codebench Standard Thomas Petazzoni
3 siblings, 0 replies; 5+ messages in thread
From: Romain Naour @ 2014-07-13 18:46 UTC (permalink / raw)
To: buildroot
With the Sourcery Codebench standard edition, the sysroot returned
point to a non existant directory if no CFLAGS is specified.
When copying external toolchain sysroot to staging, we need to
create the symbolic link that matches the name of the subdirectory
for the architecture variant in the original sysroot (ie: sgxx-glibc)
To do that, SYSROOT_DIR must be different than ARCH_SYSROOT_DIR.
So, set SYSROOT_DIR deduced from ARCH_SYSROOT_DIR by removing
arch specific part at the end of the path.
Signed-off-by: Romain Naour <romain.naour@openwide.fr>
---
toolchain/toolchain-external/toolchain-external.mk | 3 +++
1 file changed, 3 insertions(+)
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index f6e51a1..212fbc9 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -555,6 +555,9 @@ define TOOLCHAIN_EXTERNAL_INSTALL_CORE
exit 1 ; \
fi ; \
ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
+ if test ! -d "$${SYSROOT_DIR}" ; then \
+ SYSROOT_DIR=$$(echo -n "$${ARCH_SYSROOT_DIR}" | sed -r 's:(/libc/)([^&]*):\1:') ; \
+ fi ; \
ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
SUPPORT_LIB_DIR="" ; \
if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 0/3] toolchain: Add support for Sourcery Codebench Standard
2014-07-13 18:45 [Buildroot] [PATCH 0/3] toolchain: Add support for Sourcery Codebench Standard Romain Naour
` (2 preceding siblings ...)
2014-07-13 18:46 ` [Buildroot] [PATCH 3/3] toolchain-external: fix Sourcery Codebench symlink Romain Naour
@ 2014-10-12 14:53 ` Thomas Petazzoni
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2014-10-12 14:53 UTC (permalink / raw)
To: buildroot
Dear Romain Naour,
On Sun, 13 Jul 2014 20:45:57 +0200, Romain Naour wrote:
> The purpose of this series is to provide support for Sourcery Codebench
> Standard (licenced) edition in Buildroot.
>
> Since these toolchain can't be downloaded, we need to use the custom toolchain
> backend to import them into Buildroot.
Thanks for this patch series. As we discussed today during the meeting,
the currently proposed implementation is a bit fragile because:
* SYSROOT_DIR is empty/invalid in your situation, while most of the
code assumes SYSROOT_DIR exists. While your patches make sure every
time SYSROOT_DIR is used, we fallback to ARCH_SYSROOT_DIR if
SYSROOT_DIR doesn't exist, this may break in the future, especially
as we don't have access to this proprietary Sourcery Codebench
toolchain to test and check that future changes will keep this
toolchain working.
* the dance with faking a SYSROOT_DIR being different from
ARCH_SYSROOT_DIR by one path component is really highly specific to
this toolchain, and will not work in other situations.
Consequently, the proposal is to:
* Change the SYSROOT_DIR/ARCH_SYSROOT_DIR detection logic so that if
SYSROOT_DIR is empty/bogus, then the same value as ARCH_SYSROOT_DIR
is used. This ensures that both SYSROOT_DIR and ARCH_SYSROOT_DIR
point to valid directories (which would the same in the case of this
toolchain, which brings us back to the non-multilib toolchain case).
* Adjust the symlink logic to handle a new case: when SYSROOT_DIR ==
ARCH_SYSROOT_DIR, look again at the real sysroot directory, and if
it's bogus, then it means we in fact have a multilib toolchain that
may need a symbolic link. If that's the case, then using
-print-sysroot with no flags, -print-sysroot with flags, and
computing the common part of both paths, we get the "base sysroot".
Thinking about it, we might also think of using the strategy described
above to find the "base sysroot" and use this value in SYSROOT_DIR, no?
In the mean time, I'll mark the three patches as Changes Requested in
patchwork.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-10-12 14:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-13 18:45 [Buildroot] [PATCH 0/3] toolchain: Add support for Sourcery Codebench Standard Romain Naour
2014-07-13 18:45 ` [Buildroot] [PATCH 1/3] toolchain-external: handle a special case where kernel headers check needs TOOLCHAIN_EXTERNAL_CFLAGS Romain Naour
2014-07-13 18:45 ` [Buildroot] [PATCH 2/3] toolchain-external: handle a special case where glibc " Romain Naour
2014-07-13 18:46 ` [Buildroot] [PATCH 3/3] toolchain-external: fix Sourcery Codebench symlink Romain Naour
2014-10-12 14:53 ` [Buildroot] [PATCH 0/3] toolchain: Add support for Sourcery Codebench Standard Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox