* [Buildroot] [RFC] First hack for external toolchain support based on sysroot
@ 2008-12-02 22:21 Thomas Petazzoni
2008-12-03 8:14 ` Daniel Laird
2008-12-10 8:24 ` Thomas Petazzoni
0 siblings, 2 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2008-12-02 22:21 UTC (permalink / raw)
To: buildroot
Hi,
This evening, I had a quick look at implementing support for external
toolchain based on --sysroot. It seems to work, see the included patch.
It's very hacky at the moment, I'm waiting for your suggestions to
improve the patch.
Sincerly,
Thomas
---
Another external toolchain support solution
* In toolchain/external-toolchain/ext-tool.mk, copy the contents of
the sysroot directory to the staging dir.
* In package/Makefile.in, add a --sysroot CFLAGS pointing to the
staging dir
* Remove the CFLAGS and LDFLAGS definition from
TARGET_CONFIGURE_OPTS. I haven't investigated exactly why, but with
these options, DirectFB fails to build because it cannot find
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, even if DirectFB's Makefile
properly sets -D_GNU_SOURCE.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
package/Makefile.in | 4 +---
toolchain/external-toolchain/ext-tool.mk | 6 ++++++
2 files changed, 7 insertions(+), 3 deletions(-)
Index: buildroot2/package/Makefile.in
===================================================================
--- buildroot2.orig/package/Makefile.in
+++ buildroot2/package/Makefile.in
@@ -89,7 +89,7 @@
# else it's an external toolchain
#########################################################################
else
-TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include -I$(TOOLCHAIN_EXTERNAL_PATH)/$(TOOLCHAIN_EXTERNAL_PREFIX)/include
+TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include -I$(TOOLCHAIN_EXTERNAL_PATH)/$(TOOLCHAIN_EXTERNAL_PREFIX)/include --sysroot $(STAGING_DIR)/
TARGET_CXXFLAGS=$(TARGET_CFLAGS)
TARGET_LDFLAGS=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
endif
@@ -210,8 +210,6 @@
AR="$(TARGET_AR)" \
AS="$(TARGET_AS)" \
LD="$(TARGET_LD)" \
- CFLAGS="$(TARGET_CFLAGS)" \
- LDFLAGS="$(TARGET_LDFLAGS)" \
NM="$(TARGET_NM)" \
CC="$(TARGET_CC) $(TARGET_CFLAGS)" \
GCC="$(TARGET_CC) $(TARGET_CFLAGS)" \
Index: buildroot2/toolchain/external-toolchain/ext-tool.mk
===================================================================
--- buildroot2.orig/toolchain/external-toolchain/ext-tool.mk
+++ buildroot2/toolchain/external-toolchain/ext-tool.mk
@@ -44,6 +44,11 @@
\
echo -n
+copy_toolchain_sysroot = \
+ SYSROOT_DIR=`$(TARGET_CC) -v 2>&1 | grep ^Configured | tr " " "\n" | grep -- "--with-sysroot" | cut -f2 -d=`; \
+ cp -a $${SYSROOT_DIR}/* $(STAGING_DIR)/ ; \
+ find $(STAGING_DIR) -type d | xargs chmod 755
+
uclibc: dependencies $(TARGET_DIR)/lib/$(strip $(subst ",, $(BR2_TOOLCHAIN_EXTERNAL_LIB_C)))
$(TARGET_DIR)/lib/$(strip $(subst ",, $(BR2_TOOLCHAIN_EXTERNAL_LIB_C))):
@@ -54,3 +59,4 @@
for libs in $(strip $(subst ",, $(BR2_TOOLCHAIN_EXTERNAL_LIBS))); do \
$(call copy_toolchain_lib_root, $$libs, /lib, $(BR2_TOOLCHAIN_EXTERNAL_STRIP)); \
done
+ $(call copy_toolchain_sysroot)
\ No newline at end of file
--
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [RFC] First hack for external toolchain support based on sysroot
2008-12-02 22:21 [Buildroot] [RFC] First hack for external toolchain support based on sysroot Thomas Petazzoni
@ 2008-12-03 8:14 ` Daniel Laird
2008-12-03 8:31 ` Thomas Petazzoni
2008-12-10 8:24 ` Thomas Petazzoni
1 sibling, 1 reply; 4+ messages in thread
From: Daniel Laird @ 2008-12-03 8:14 UTC (permalink / raw)
To: buildroot
I had done the first bit and not the second. I will start to look at this.
Perhaps the CFLAGS and LDFLAGS can go back to how they were when new started
all this.
eg LD="$(TARGET_LD) $(TARGET_LDFLAGS)"
Does that work for DirectFB?
Cheers foe this good work, maybe we will have external toolchain working
properly soon?
My next question is - with sysroot set do we really need to set the SYSROOT
option to pkgconfig? and do we need to sed all the .la files?
Many thanks
Daniel Laird
-----Original Message-----
From: Thomas Petazzoni [mailto:thomas.petazzoni at free-electrons.com]
Sent: 2008 Dec 02 22:22
To: Daniel James Laird; buildroot at uclibc.org
Subject: [RFC] First hack for external toolchain support based on sysroot
Hi,
This evening, I had a quick look at implementing support for external
toolchain based on --sysroot. It seems to work, see the included patch.
It's very hacky at the moment, I'm waiting for your suggestions to
improve the patch.
Sincerly,
Thomas
---
Another external toolchain support solution
* In toolchain/external-toolchain/ext-tool.mk, copy the contents of
the sysroot directory to the staging dir.
* In package/Makefile.in, add a --sysroot CFLAGS pointing to the
staging dir
* Remove the CFLAGS and LDFLAGS definition from
TARGET_CONFIGURE_OPTS. I haven't investigated exactly why, but with
these options, DirectFB fails to build because it cannot find
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, even if DirectFB's Makefile
properly sets -D_GNU_SOURCE.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
package/Makefile.in | 4 +---
toolchain/external-toolchain/ext-tool.mk | 6 ++++++
2 files changed, 7 insertions(+), 3 deletions(-)
Index: buildroot2/package/Makefile.in
===================================================================
--- buildroot2.orig/package/Makefile.in
+++ buildroot2/package/Makefile.in
@@ -89,7 +89,7 @@
# else it's an external toolchain
#########################################################################
else
-TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
-I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include
-I$(TOOLCHAIN_EXTERNAL_PATH)/$(TOOLCHAIN_EXTERNAL_PREFIX)/include
+TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
-I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include
-I$(TOOLCHAIN_EXTERNAL_PATH)/$(TOOLCHAIN_EXTERNAL_PREFIX)/include --sysroot
$(STAGING_DIR)/
TARGET_CXXFLAGS=$(TARGET_CFLAGS)
TARGET_LDFLAGS=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
endif
@@ -210,8 +210,6 @@
AR="$(TARGET_AR)" \
AS="$(TARGET_AS)" \
LD="$(TARGET_LD)" \
- CFLAGS="$(TARGET_CFLAGS)" \
- LDFLAGS="$(TARGET_LDFLAGS)" \
NM="$(TARGET_NM)" \
CC="$(TARGET_CC) $(TARGET_CFLAGS)" \
GCC="$(TARGET_CC) $(TARGET_CFLAGS)" \
Index: buildroot2/toolchain/external-toolchain/ext-tool.mk
===================================================================
--- buildroot2.orig/toolchain/external-toolchain/ext-tool.mk
+++ buildroot2/toolchain/external-toolchain/ext-tool.mk
@@ -44,6 +44,11 @@
\
echo -n
+copy_toolchain_sysroot = \
+ SYSROOT_DIR=`$(TARGET_CC) -v 2>&1 | grep ^Configured | tr " " "\n" |
grep -- "--with-sysroot" | cut -f2 -d=`; \
+ cp -a $${SYSROOT_DIR}/* $(STAGING_DIR)/ ; \
+ find $(STAGING_DIR) -type d | xargs chmod 755
+
uclibc: dependencies $(TARGET_DIR)/lib/$(strip $(subst ",,
$(BR2_TOOLCHAIN_EXTERNAL_LIB_C)))
$(TARGET_DIR)/lib/$(strip $(subst ",, $(BR2_TOOLCHAIN_EXTERNAL_LIB_C))):
@@ -54,3 +59,4 @@
for libs in $(strip $(subst ",, $(BR2_TOOLCHAIN_EXTERNAL_LIBS))); do
\
$(call copy_toolchain_lib_root, $$libs, /lib,
$(BR2_TOOLCHAIN_EXTERNAL_STRIP)); \
done
+ $(call copy_toolchain_sysroot)
\ No newline at end of file
--
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [RFC] First hack for external toolchain support based on sysroot
2008-12-03 8:14 ` Daniel Laird
@ 2008-12-03 8:31 ` Thomas Petazzoni
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2008-12-03 8:31 UTC (permalink / raw)
To: buildroot
Le Wed, 3 Dec 2008 08:14:00 +0000,
"Daniel Laird" <danieljlaird@hotmail.com> a ?crit :
> I had done the first bit and not the second. I will start to look at
> this. Perhaps the CFLAGS and LDFLAGS can go back to how they were
> when new started all this.
> eg LD="$(TARGET_LD) $(TARGET_LDFLAGS)"
>
> Does that work for DirectFB?
Maybe, I haven't tried.
> Cheers foe this good work, maybe we will have external toolchain
> working properly soon?
I hope so :-)
The nice advantage of the --sysroot solution is that it should work in
all cases, while the -rpath-link solution didn't work for Qtopia, for
example.
> My next question is - with sysroot set do we really need to set the
> SYSROOT option to pkgconfig? and do we need to sed all the .la files?
I'd say we still need them. Otherwise in a .la file you'll
have /usr/lib/libfoobar.a, and I don't think gcc will interpret that
relative to its --sysroot. But it remains to be checked.
Sincerly,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [RFC] First hack for external toolchain support based on sysroot
2008-12-02 22:21 [Buildroot] [RFC] First hack for external toolchain support based on sysroot Thomas Petazzoni
2008-12-03 8:14 ` Daniel Laird
@ 2008-12-10 8:24 ` Thomas Petazzoni
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2008-12-10 8:24 UTC (permalink / raw)
To: buildroot
Hi,
Any reaction to this patch ?
Thanks,
Thomas
Le Tue, 2 Dec 2008 23:21:32 +0100,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :
> Hi,
>
> This evening, I had a quick look at implementing support for external
> toolchain based on --sysroot. It seems to work, see the included
> patch. It's very hacky at the moment, I'm waiting for your
> suggestions to improve the patch.
>
> Sincerly,
>
> Thomas
>
> ---
>
> Another external toolchain support solution
>
> * In toolchain/external-toolchain/ext-tool.mk, copy the contents of
> the sysroot directory to the staging dir.
>
> * In package/Makefile.in, add a --sysroot CFLAGS pointing to the
> staging dir
>
> * Remove the CFLAGS and LDFLAGS definition from
> TARGET_CONFIGURE_OPTS. I haven't investigated exactly why, but with
> these options, DirectFB fails to build because it cannot find
> PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, even if DirectFB's Makefile
> properly sets -D_GNU_SOURCE.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> package/Makefile.in | 4 +---
> toolchain/external-toolchain/ext-tool.mk | 6 ++++++
> 2 files changed, 7 insertions(+), 3 deletions(-)
>
> Index: buildroot2/package/Makefile.in
> ===================================================================
> --- buildroot2.orig/package/Makefile.in
> +++ buildroot2/package/Makefile.in
> @@ -89,7 +89,7 @@
> # else it's an external toolchain
> #########################################################################
> else
> -TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
> -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include
> -I$(TOOLCHAIN_EXTERNAL_PATH)/$(TOOLCHAIN_EXTERNAL_PREFIX)/include
> +TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
> -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include
> -I$(TOOLCHAIN_EXTERNAL_PATH)/$(TOOLCHAIN_EXTERNAL_PREFIX)/include
> --sysroot $(STAGING_DIR)/ TARGET_CXXFLAGS=$(TARGET_CFLAGS)
> TARGET_LDFLAGS=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib endif @@
> -210,8 +210,6 @@ AR="$(TARGET_AR)" \ AS="$(TARGET_AS)" \
> LD="$(TARGET_LD)" \
> - CFLAGS="$(TARGET_CFLAGS)" \
> - LDFLAGS="$(TARGET_LDFLAGS)" \
> NM="$(TARGET_NM)" \
> CC="$(TARGET_CC) $(TARGET_CFLAGS)" \
> GCC="$(TARGET_CC) $(TARGET_CFLAGS)" \
> Index: buildroot2/toolchain/external-toolchain/ext-tool.mk
> ===================================================================
> --- buildroot2.orig/toolchain/external-toolchain/ext-tool.mk
> +++ buildroot2/toolchain/external-toolchain/ext-tool.mk
> @@ -44,6 +44,11 @@
> \
> echo -n
>
> +copy_toolchain_sysroot = \
> + SYSROOT_DIR=`$(TARGET_CC) -v 2>&1 | grep ^Configured | tr "
> " "\n" | grep -- "--with-sysroot" | cut -f2 -d=`; \
> + cp -a $${SYSROOT_DIR}/* $(STAGING_DIR)/ ; \
> + find $(STAGING_DIR) -type d | xargs chmod 755
> +
> uclibc: dependencies $(TARGET_DIR)/lib/$(strip $(subst ",,
> $(BR2_TOOLCHAIN_EXTERNAL_LIB_C)))
> $(TARGET_DIR)/lib/$(strip $(subst ",,
> $(BR2_TOOLCHAIN_EXTERNAL_LIB_C))): @@ -54,3 +59,4 @@
> for libs in $(strip $(subst ",,
> $(BR2_TOOLCHAIN_EXTERNAL_LIBS))); do \ $(call
> copy_toolchain_lib_root, $$libs, /lib,
> $(BR2_TOOLCHAIN_EXTERNAL_STRIP)); \ done
> + $(call copy_toolchain_sysroot)
> \ No newline at end of file
>
>
--
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-12-10 8:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-02 22:21 [Buildroot] [RFC] First hack for external toolchain support based on sysroot Thomas Petazzoni
2008-12-03 8:14 ` Daniel Laird
2008-12-03 8:31 ` Thomas Petazzoni
2008-12-10 8:24 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox