Skip to contentSkip to conversation

enhance the toolchain bootstrap process

RFC In review Dexuan Cui 5 participants 16 messages Jan 18, 2011 – Jan 25, 2011

lore
Share & tools
lore

Dexuan Cui

author
#0 lore raw

v3 cover enhance the toolchain bootstrap process

Hi Richard and all,

The patch set enhances the toolchain bootstrap process by installing a separate sysroot for each step of the process.
The purpose is to avoid file overwriting in the current global sysroot, namely, to fix Bug 239: http://bugzilla.pokylinux.org/show_bug.cgi?id=239

The basic idea is straightforward:
1) For gcc-cross-initial and -intermediate, by changing MULTIMACH_TARGET_SYS to install the files into new locations;
2) Fix the build of eglibc-initial, eglibc by using the appropriate compilers, libs, headers;
3) Also make proper changes for the crosssdk/nativesdk version.

I've split all the changes into small git commits and each commit should be basically self-explanatory. :-)

Please review the commits and comment. Thanks!

Test Results:
I've tested building poky-image-sdk on various qemu targets: the qemu target can boot fine.
I'm also testing building meta-toolchain-sdk -- not finished yet, but I think it should be fine because "bitbake gcc-runtime-nativesdk" and "bitbake gcc-cross-canadian-mips" can succeed. I'll be doing more tests.

TODO:
1) changes to gcc-4.3.3 not completely finished (Should we still support gcc-4.3.3 since we have gcc-4.5.1?) However I think I should be able to add the missing changes soon, supposing here 4.3.3 and 4.5.1 have no big difference.
2) do more tests against glibc rather than eglibc.

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: dcui/tcbp-v3
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dcui/tcbp-v3

Thanks,
Dexuan Cui <[email protected]>
---

Dexuan Cui (7):
sstate.bbclass: allow each step of toolchain bootstrap processes to
do populate_sysroot independently
cross.bbclass: make MULTIMACH_TARGET_SYS adjustable for bindir,
libdir, libexecdir
gcc-cross-initial, gcc-crosssdk-initial: change CROSS_TARGET_SYS_DIR
and insall into new locations
eglibc-initial, eglibc-initial-nativesdk: install into individual
sysroots
gcc-cross-intermediate, gcc-crosssdk-intermediate: change
CROSS_TARGET_SYS_DIR and insall into new locations
cross.bbclass: modify sysroot_stage_all to allow
gcc-{cross,crossdk}-intermediate to populate the libgcc_s.so* files
eglibc, eglibc-nativesdk: fix the build due to changes to
eglibc-initial and gcc-cross-intermediate

 meta/classes/cross.bbclass                         |   17 +++++---
 meta/classes/sstate.bbclass                        |   24 ------------
 meta/recipes-core/eglibc/eglibc-initial.inc        |   10 +++++
 meta/recipes-core/eglibc/eglibc.inc                |    9 ++++
 meta/recipes-core/eglibc/eglibc_2.12.bb            |    8 +---
 .../fix_CPPFLAGS_LDFLAGS_FOR_TARGET.patch          |   40 ++++++++++++++++++++
 meta/recipes-devtools/gcc/gcc-cross-initial.inc    |    2 +
 .../gcc/gcc-cross-initial_4.3.3.bb                 |    2 +-
 .../gcc/gcc-cross-initial_4.5.1.bb                 |    2 +-
 .../gcc/gcc-cross-intermediate.inc                 |   32 ++++++++++++++-
 .../gcc/gcc-cross-intermediate_4.3.3.bb            |    2 +-
 .../gcc/gcc-cross-intermediate_4.5.1.bb            |    2 +-
 .../gcc/gcc-crosssdk-initial_4.3.3.bb              |    2 +-
 .../gcc/gcc-crosssdk-initial_4.5.1.bb              |    2 +-
 .../gcc/gcc-crosssdk-intermediate.inc              |    3 +
 .../gcc/gcc-crosssdk-intermediate_4.3.3.bb         |    2 +-
 .../gcc/gcc-crosssdk-intermediate_4.5.1.bb         |    2 +-
 17 files changed, 113 insertions(+), 48 deletions(-)
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.5.1/fix_CPPFLAGS_LDFLAGS_FOR_TARGET.patch
Signature · 1 line
1.7.2
author
#1 lore raw

RFC v3 1/7 sstate.bbclass: allow each step of toolchain bootstrap processes to do populate_sysroot independently

I'm adding an indidivual sysroot for each step.

---
 meta/classes/sstate.bbclass |   24 ------------------------
 1 files changed, 0 insertions(+), 24 deletions(-)
meta/classes/sstate.bbclass +0 -24
index b6e6c92..8d85f42 100644
@@ -87,30 +87,6 @@ def sstate_install(ss, d):
     if os.access(manifest, os.R_OK):
         bb.fatal("Package already staged (%s)?!" % manifest)
 
-    def checkmanifest(pn, task):
-        return os.access(bb.data.expand("${SSTATE_MANFILEBASE}%s.%s" % (pn, task), d), os.R_OK)
-
-    skipinst = False
-    pn = d.getVar("PN", True)
-    if pn == "gcc-cross-initial":
-        if checkmanifest("gcc-cross", "populate-sysroot"):
-            skipinst = True
-        if checkmanifest("gcc-cross-intermediate", "populate-sysroot"):
-            skipinst = True
-    elif pn == "gcc-cross-intermediate":
-        if checkmanifest("gcc-cross", "populate-sysroot"):
-            skipinst = True
-    elif pn == "glibc-initial":
-        if checkmanifest("glibc", "populate-sysroot"):
-            skipinst = True
-    elif pn == "eglibc-initial":
-        if checkmanifest("eglibc", "populate-sysroot"):
-            skipinst = True
-
-    if skipinst:
-        bb.note("Not staging %s.%s as sysroot already contains better functionality" % (pn, ss['name']))
-        return
-
     locks = []
     for lock in ss['lockfiles']:
         locks.append(bb.utils.lockfile(lock))
Signature · 1 line
1.7.2
author
#2 lore raw

RFC v3 2/7 cross.bbclass: make MULTIMACH_TARGET_SYS adjustable for bindir, libdir, libexecdir

In reply to Dexuan Cui

This will be used by gcc-cross-initial and gcc-cross-intermediate.

---
 meta/classes/cross.bbclass |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
meta/classes/cross.bbclass +4 -3
index 7c20be0..59d8293 100644
@@ -40,15 +40,16 @@ target_prefix := "${prefix}"
 target_exec_prefix := "${exec_prefix}"
 
 # Overrides for paths
+CROSS_TARGET_SYS_DIR = "${MULTIMACH_TARGET_SYS}"
 prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
 base_prefix = "${STAGING_DIR_NATIVE}"
 exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
-bindir = "${exec_prefix}/bin/${MULTIMACH_TARGET_SYS}"
+bindir = "${exec_prefix}/bin/${CROSS_TARGET_SYS_DIR}"
 sbindir = "${bindir}"
 base_bindir = "${bindir}"
 base_sbindir = "${bindir}"
-libdir = "${exec_prefix}/lib/${MULTIMACH_TARGET_SYS}"
-libexecdir = "${exec_prefix}/libexec/${MULTIMACH_TARGET_SYS}"
+libdir = "${exec_prefix}/lib/${CROSS_TARGET_SYS_DIR}"
+libexecdir = "${exec_prefix}/libexec/${CROSS_TARGET_SYS_DIR}"
 
 do_install () {
 	oe_runmake 'DESTDIR=${D}' install
Signature · 1 line
1.7.2
author
#3 lore raw

RFC v3 3/7 gcc-cross-initial, gcc-crosssdk-initial: change CROSS_TARGET_SYS_DIR and insall into new locations

In reply to Dexuan Cui
---
 meta/recipes-devtools/gcc/gcc-cross-initial.inc    |    2 ++
 .../gcc/gcc-cross-initial_4.3.3.bb                 |    2 +-
 .../gcc/gcc-cross-initial_4.5.1.bb                 |    2 +-
 .../gcc/gcc-crosssdk-initial_4.3.3.bb              |    2 +-
 .../gcc/gcc-crosssdk-initial_4.5.1.bb              |    2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)
meta/recipes-devtools/gcc/gcc-cross-initial.inc +2 -0
index f582de9..4e2e343 100644
@@ -2,6 +2,8 @@ DEPENDS = "virtual/${TARGET_PREFIX}binutils gettext-native ${NATIVEDEPS}"
 PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
 PACKAGES = ""
 
+CROSS_TARGET_SYS_DIR_append = ".${PN}"
+
 # This is intended to be a -very- basic config
 # sysroot is needed in case we use libc-initial
 EXTRA_OECONF = "--with-local-prefix=${STAGING_DIR_TARGET}${target_prefix} \
meta/recipes-devtools/gcc/gcc-cross-initial_4.3.3.bb +1 -1
index 081b7d6..28ac1ab 100644
@@ -1,5 +1,5 @@
 require gcc-cross_${PV}.bb
 require gcc-cross-initial.inc
 
-PR = "r4"
+PR = "r5"
 
meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb +1 -1
index a121782..b2c257d 100644
@@ -1,5 +1,5 @@
 require gcc-cross_${PV}.bb
 require gcc-cross-initial.inc
 
-PR = "r1"
+PR = "r2"
 
meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.3.3.bb +1 -1
index 5daa31b..b42de47 100644
@@ -1,3 +1,3 @@
 require gcc-cross-initial_${PV}.bb
 require gcc-crosssdk-initial.inc
-PR = "r5"
+PR = "r6"
meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb +1 -1
index 0fc5faa..240caf5 100644
@@ -1,4 +1,4 @@
 require gcc-cross-initial_${PV}.bb
 require gcc-crosssdk-initial.inc
 
-PR = "r1"
+PR = "r2"
Signature · 1 line
1.7.2
#4 lore raw

Re: [RFC: enhance toolchain bootstrap process: v3: 3/7] gcc-cross-initial, gcc-crosssdk-initial: change CROSS_TARGET_SYS_DIR and insall into new locations

Seeing all those PR bumps, would something like http://cgit.openembedded.org/cgit.cgi/meta-openembedded/commit/?id=6f1647aa (ignore the sysroot patch) be usefull for yocto?

Op 18 jan 2011, om 14:57 heeft Dexuan Cui het volgende geschreven:

Quoted 70 lines

---

meta/recipes-devtools/gcc/gcc-cross-initial.inc    |    2 ++
.../gcc/gcc-cross-initial_4.3.3.bb                 |    2 +-
.../gcc/gcc-cross-initial_4.5.1.bb                 |    2 +-
.../gcc/gcc-crosssdk-initial_4.3.3.bb              |    2 +-
.../gcc/gcc-crosssdk-initial_4.5.1.bb              |    2 +-
5 files changed, 6 insertions(+), 4 deletions(-)
meta/recipes-devtools/gcc/gcc-cross-initial.inc +0 -0
index f582de9..4e2e343 100644
@@ -2,6 +2,8 @@ DEPENDS = "virtual/${TARGET_PREFIX}binutils gettext-native ${NATIVEDEPS}"

PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
PACKAGES = ""

meta/recipes-devtools/gcc/gcc-cross-initial.inc +2 -0
+CROSS_TARGET_SYS_DIR_append = ".${PN}"
+

# This is intended to be a -very- basic config

# sysroot is needed in case we use libc-initial
EXTRA_OECONF = "--with-local-prefix=${STAGING_DIR_TARGET}${target_prefix} \
meta/recipes-devtools/gcc/gcc-cross-initial_4.3.3.bb +0 -0
index 081b7d6..28ac1ab 100644
@@ -1,5 +1,5 @@

require gcc-cross_${PV}.bb
require gcc-cross-initial.inc

meta/recipes-devtools/gcc/gcc-cross-initial_4.3.3.bb +1 -1
-PR = "r4"
+PR = "r5"
meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb +0 -0
index a121782..b2c257d 100644
@@ -1,5 +1,5 @@

require gcc-cross_${PV}.bb
require gcc-cross-initial.inc

meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb +1 -1
-PR = "r1"
+PR = "r2"
meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.3.3.bb +0 -0
index 5daa31b..b42de47 100644
@@ -1,3 +1,3 @@

require gcc-cross-initial_${PV}.bb
require gcc-crosssdk-initial.inc

meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.3.3.bb +1 -1
-PR = "r5"
+PR = "r6"
meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb +0 -0
index 0fc5faa..240caf5 100644
@@ -1,4 +1,4 @@

require gcc-cross-initial_${PV}.bb
require gcc-crosssdk-initial.inc

meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb +1 -1
-PR = "r1"
+PR = "r2"
Signature · 6 lines
1.7.2

_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky
#5 lore raw

Re: [RFC: enhance toolchain bootstrap process: v3: 3/7] gcc-cross-initial, gcc-crosssdk-initial: change CROSS_TARGET_SYS_DIR and insall into new locations

Quoted 3 lines · Koen Kooi

Seeing all those PR bumps, would something like
http://cgit.openembedded.org/cgit.cgi/meta-openembedded/commit/?id=6f1647aa
(ignore the sysroot patch) be usefull for yocto?

It can be useful. I'll try to use that for my next version. Thanks for the suggestion.

Thanks,
-- Dexuan

author
#6 lore raw

RFC v3 4/7 eglibc-initial, eglibc-initial-nativesdk: install into individual sysroots

In reply to Dexuan Cui

Install sysroot to ${STAGING_DIR_TARGET}/${PN}.

---
 meta/recipes-core/eglibc/eglibc-initial.inc |   10 ++++++++++
 meta/recipes-core/eglibc/eglibc_2.12.bb     |    2 +-
 2 files changed, 11 insertions(+), 1 deletions(-)
meta/recipes-core/eglibc/eglibc-initial.inc +10 -0
index d49ec8a..ea0763e 100644
@@ -1,5 +1,8 @@
 require eglibc-common.inc
 
+STAGING_BINDIR_TOOLCHAIN_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-cross-initial:"
+STAGING_BINDIR_TOOLCHAIN_virtclass-nativesdk_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-crosssdk-initial:"
+
 DEPENDS = "linux-libc-headers virtual/${TARGET_PREFIX}gcc-initial"
 PROVIDES = "virtual/${TARGET_PREFIX}libc-initial"
 
@@ -42,8 +45,15 @@ do_install () {
        install -m 644 csu/crt[1in].o ${D}${libdir}
        ${CC} -nostdlib -nostartfiles -shared -x c /dev/null \
                -o ${D}${libdir}/libc.so
+
+       # add links to linux-libc-headers: gcc-{cross,crossdk}-intermediate need this.
+       ln -s ${STAGING_DIR_TARGET}${includedir}/linux  ${D}${includedir}/
+       ln -s ${STAGING_DIR_TARGET}${includedir}/asm  ${D}${includedir}/
+       ln -s ${STAGING_DIR_TARGET}${includedir}/asm-generic  ${D}${includedir}/
 }
 
 do_siteconfig () {
 	:
 }
+
+do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TARGET}/${PN}"
meta/recipes-core/eglibc/eglibc_2.12.bb +1 -1
index c773af0..97353b7 100644
@@ -2,7 +2,7 @@ require eglibc.inc
 
 DEPENDS += "gperf-native"
 FILESPATHPKG =. "eglibc-svn:"
-PR = "r13"
+PR = "r14"
 
 EGLIBC_BRANCH="eglibc-2_12"
 SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http \
Signature · 1 line
1.7.2
author
#7 lore raw

RFC v3 5/7 gcc-cross-intermediate, gcc-crosssdk-intermediate: change CROSS_TARGET_SYS_DIR and insall into new locations

In reply to Dexuan Cui
---
 .../fix_CPPFLAGS_LDFLAGS_FOR_TARGET.patch          |   40 ++++++++++++++++++++
 .../gcc/gcc-cross-intermediate.inc                 |   29 +++++++++++++-
 .../gcc/gcc-cross-intermediate_4.3.3.bb            |    2 +-
 .../gcc/gcc-cross-intermediate_4.5.1.bb            |    2 +-
 .../gcc/gcc-crosssdk-intermediate.inc              |    3 +
 .../gcc/gcc-crosssdk-intermediate_4.3.3.bb         |    2 +-
 .../gcc/gcc-crosssdk-intermediate_4.5.1.bb         |    2 +-
 7 files changed, 73 insertions(+), 7 deletions(-)
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.5.1/fix_CPPFLAGS_LDFLAGS_FOR_TARGET.patch
meta/recipes-devtools/gcc/gcc-4.5.1/fix_CPPFLAGS_LDFLAGS_FOR_TARGET.patch new file +40 -0
new file mode 100644
index 0000000..9fd8621
@@ -0,0 +1,40 @@
+This patch is used to fix gcc's Bug 35804:
+
+We made the patch according to the hint:
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35804#c3
+
+"[email protected] 2008-04-02 17:52:36 UTC
+Subject: Re:  Bootstrap of combined gcc + binutils, with
+ --enable-shared, with sysroot fails
+
+On Wed, 2 Apr 2008, pinskia at gcc dot gnu dot org wrote:
+
+> Sounds like you should be using --build-sysroot= and not set LDFLAGS_FOR_TARGET
+> and CPPFLAGS_FOR_TARGET .
+
+My experience is that you do need to set LDFLAGS_FOR_TARGET and
+CPPFLAGS_FOR_TARGET to include the --sysroot option if you're configuring
+with a build sysroot.  (This is a bug: --with-build-sysroot should cause
+the right --sysroot option to be used automatically when compiling and
+linking runtime libraries.)"
+
+Signed-off-by: Kevin Tian <[email protected]>
+Signed-off-by: Dexuan Cui <[email protected]>
+
+diff --git a/Makefile.in b/Makefile.in
+index d986692..b0531ac 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -537,10 +537,11 @@ CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
+ 
+ LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
+ LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
+-LDFLAGS_FOR_TARGET = 
+ 
+ FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
+ SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
++CPPFLAGS_FOR_TARGET = ${SYSROOT_CFLAGS_FOR_TARGET}
++LDFLAGS_FOR_TARGET = ${SYSROOT_CFLAGS_FOR_TARGET}
+ DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@
+ 
+ XGCC_FLAGS_FOR_TARGET = $(FLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
meta/recipes-devtools/gcc/gcc-cross-intermediate.inc +26 -3
index 72a4241..32e4e5e 100644
@@ -3,6 +3,13 @@ DEPENDS += "virtual/${TARGET_PREFIX}libc-initial gettext-native"
 PROVIDES = "virtual/${TARGET_PREFIX}gcc-intermediate"
 PACKAGES = ""
 
+SRC_URI += " file://fix_CPPFLAGS_LDFLAGS_FOR_TARGET.patch"
+
+CROSS_TARGET_SYS_DIR_append = ".${PN}"
+
+
+GCC_CROSS_INTERMEDIATE_WITH_BUILD_SYSROOT = "${STAGING_DIR_TARGET}/eglibc-initial/${TARGET_SYS}"
+
 # This is intended to be a -very- basic config
 # sysroot is needed in case we use libc-initial
 EXTRA_OECONF = "--with-local-prefix=${STAGING_DIR_TARGET}${target_prefix} \
@@ -13,7 +20,7 @@ EXTRA_OECONF = "--with-local-prefix=${STAGING_DIR_TARGET}${target_prefix} \
                 ${OPTSPACE} \
 		--program-prefix=${TARGET_PREFIX} \
 		--with-sysroot=${STAGING_DIR_TARGET} \
-		--with-build-sysroot=${STAGING_DIR_TARGET} \
+		--with-build-sysroot=${GCC_CROSS_INTERMEDIATE_WITH_BUILD_SYSROOT} \
 		${EXTRA_OECONF_INTERMEDIATE} \
 		${@get_gcc_fpu_setting(bb, d)}"
 
@@ -23,6 +30,22 @@ do_compile () {
 
 do_install () {
 	oe_runmake 'DESTDIR=${D}' install
-	install -d ${D}${target_base_libdir}/
-	mv ${D}${exec_prefix}/${TARGET_SYS}/lib/* ${D}${target_base_libdir}/
+
+	# Without the .{PN} suffix, here it would conflict with the recipe libgcc.
+	install -d ${D}${target_base_libdir}.${PN}/
+	mv ${D}${exec_prefix}/${TARGET_SYS}/lib/* ${D}${target_base_libdir}.${PN}/
+
+	# We don't really need this (here shares/ contains man, info, locale).
+	rm -rf ${D}${prefix}/share/
+
+	# binutils has supplied libiberty.a.
+	rm -f ${D}${exec_prefix}/lib/lib/libiberty.a
+
+	# Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
+	# found. These need to be relative paths so they work in different locations.
+	dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
+	install -d $dest
+	for t in ar as ld nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
+		ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
+	done
 }
meta/recipes-devtools/gcc/gcc-cross-intermediate_4.3.3.bb +1 -1
index 9a30cb5..a8473b0 100644
@@ -1,4 +1,4 @@
 require gcc-cross_${PV}.bb
 require gcc-cross-intermediate.inc
-PR = "r4"
+PR = "r5"
 
meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb +1 -1
index 7aaa5b0..10681da 100644
@@ -1,4 +1,4 @@
 require gcc-cross_${PV}.bb
 require gcc-cross-intermediate.inc
-PR = "r1"
+PR = "r2"
 
meta/recipes-devtools/gcc/gcc-crosssdk-intermediate.inc +3 -0
index ed5d5e8..5d1d055 100644
@@ -7,3 +7,6 @@ SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/"
 DEPENDS = "virtual/${TARGET_PREFIX}binutils-crosssdk gettext-native"
 DEPENDS += "virtual/${TARGET_PREFIX}libc-initial-nativesdk"
 PROVIDES = "virtual/${TARGET_PREFIX}gcc-intermediate-crosssdk"
+
+GCC_CROSS_INTERMEDIATE_WITH_BUILD_SYSROOT = "${STAGING_DIR_TARGET}/eglibc-initial-nativesdk/${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}"
+
meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.3.3.bb +1 -1
index cd1f966..2be05f1 100644
@@ -1,3 +1,3 @@
 require gcc-cross-intermediate_${PV}.bb
 require gcc-crosssdk-intermediate.inc
-PR = "r8"
+PR = "r9"
meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb +1 -1
index 4260c35..a6653dd 100644
@@ -1,4 +1,4 @@
 require gcc-cross-intermediate_${PV}.bb
 require gcc-crosssdk-intermediate.inc
 
-PR = "r1"
+PR = "r2"
Signature · 1 line
1.7.2
author
#8 lore raw

RFC v3 6/7 cross.bbclass: modify sysroot_stage_all to allow gcc-{cross, crossdk}-intermediate to populate the libgcc_s.so* files

In reply to Dexuan Cui
---
 meta/classes/cross.bbclass                         |   10 ++++++----
 .../gcc/gcc-cross-intermediate.inc                 |    7 +++++--
 2 files changed, 11 insertions(+), 6 deletions(-)
meta/classes/cross.bbclass +6 -4
index 59d8293..435362b 100644
@@ -41,6 +41,8 @@ target_exec_prefix := "${exec_prefix}"
 
 # Overrides for paths
 CROSS_TARGET_SYS_DIR = "${MULTIMACH_TARGET_SYS}"
+CROSS_TARGET_LIBDIR = "${target_libdir}"
+CROSS_TARGET_BASE_LIBDIR = "${target_base_libdir}"
 prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
 base_prefix = "${STAGING_DIR_NATIVE}"
 exec_prefix = "${STAGING_DIR_NATIVE}${prefix_native}"
@@ -60,10 +62,10 @@ do_install () {
 #
 sysroot_stage_all() {
 	sysroot_stage_dir ${D} ${SYSROOT_DESTDIR}
-	install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/
-	install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/  
-	mv ${SYSROOT_DESTDIR}${target_base_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_base_libdir}/ || true
-	mv ${SYSROOT_DESTDIR}${target_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/ || true
+	install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${CROSS_TARGET_BASE_LIBDIR}/
+	install -d ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${CROSS_TARGET_LIBDIR}/
+	mv ${SYSROOT_DESTDIR}${CROSS_TARGET_BASE_LIBDIR}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${CROSS_TARGET_BASE_LIBDIR}/ || true
+	mv ${SYSROOT_DESTDIR}${CROSS_TARGET_LIBDIR}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${CROSS_TARGET_LIBDIR}/ || true
 }
 
 
meta/recipes-devtools/gcc/gcc-cross-intermediate.inc +5 -2
index 32e4e5e..4e4b050 100644
@@ -28,12 +28,15 @@ do_compile () {
     oe_runmake
 }
 
+CROSS_TARGET_LIBDIR = "${target_libdir}.${PN}"
+CROSS_TARGET_BASE_LIBDIR = "${target_base_libdir}.${PN}"
+
 do_install () {
 	oe_runmake 'DESTDIR=${D}' install
 
 	# Without the .{PN} suffix, here it would conflict with the recipe libgcc.
-	install -d ${D}${target_base_libdir}.${PN}/
-	mv ${D}${exec_prefix}/${TARGET_SYS}/lib/* ${D}${target_base_libdir}.${PN}/
+	install -d ${D}${CROSS_TARGET_BASE_LIBDIR}/
+	mv ${D}${exec_prefix}/${TARGET_SYS}/lib/* ${D}${CROSS_TARGET_BASE_LIBDIR}/
 
 	# We don't really need this (here shares/ contains man, info, locale).
 	rm -rf ${D}${prefix}/share/
Signature · 1 line
1.7.2
author
#9 lore raw

RFC v3 7/7 eglibc, eglibc-nativesdk: fix the build due to changes to eglibc-initial and gcc-cross-intermediate

In reply to Dexuan Cui

BTW: I'm not very sure about the comments about CPPFLAGS and LDFLAGS, but I do need to pass the 2 variables to make eglibc build ok.

---
 meta/recipes-core/eglibc/eglibc.inc     |    9 +++++++++
 meta/recipes-core/eglibc/eglibc_2.12.bb |    8 ++------
 2 files changed, 11 insertions(+), 6 deletions(-)
meta/recipes-core/eglibc/eglibc.inc +9 -0
index 4698254..a61d35d 100644
@@ -1,5 +1,14 @@
 require eglibc-common.inc
 
+STAGING_BINDIR_TOOLCHAIN_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-cross-intermediate:"
+STAGING_BINDIR_TOOLCHAIN_virtclass-nativesdk_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-crosssdk-intermediate:"
+
+CPPFLAGS_prepend = "-I${STAGING_DIR_TARGET}/eglibc-initial/${TARGET_SYS}${includedir_native} "
+CPPFLAGS_virtclass-nativesdk_prepend = "-I${STAGING_DIR_TARGET}/eglibc-initial-nativesdk/${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}${base_prefix}${includedir_native} "
+
+LDFLAGS_prepend= "-L${STAGING_DIR_TARGET}${base_libdir}.gcc-cross-intermediate "
+LDFLAGS_virtclass-nativesdk_prepend= "-L${STAGING_DIR_TARGET}${base_libdir}.gcc-crosssdk-intermediate "
+
 # nptl needs unwind support in gcc, which can't be built without glibc.
 DEPENDS = "virtual/${TARGET_PREFIX}gcc-intermediate linux-libc-headers"
 #this leads to circular deps, so lets not add it yet
meta/recipes-core/eglibc/eglibc_2.12.bb +2 -6
index 97353b7..c325d1b 100644
@@ -2,7 +2,7 @@ require eglibc.inc
 
 DEPENDS += "gperf-native"
 FILESPATHPKG =. "eglibc-svn:"
-PR = "r14"
+PR = "r15"
 
 EGLIBC_BRANCH="eglibc-2_12"
 SRC_URI = "svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http \
@@ -73,15 +73,13 @@ do_move_ports() {
 do_configure () {
 # override this function to avoid the autoconf/automake/aclocal/autoheader
 # calls for now
-# don't pass CPPFLAGS into configure, since it upsets the kernel-headers
-# version check and doesn't really help with anything
         if [ -z "`which rpcgen`" ]; then
                 echo "rpcgen not found.  Install glibc-devel."
                 exit 1
         fi
         (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
         find ${S} -name "configure" | xargs touch
-        CPPFLAGS="" oe_runconf
+        oe_runconf
 }
 
 rpcsvc = "bootparam_prot.x nlm_prot.x rstat.x \
@@ -89,8 +87,6 @@ rpcsvc = "bootparam_prot.x nlm_prot.x rstat.x \
 	  rusers.x spray.x nfs_prot.x rquota.x key_prot.x"
 
 do_compile () {
-	# -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging
-	unset LDFLAGS
 	base_do_compile
 	(
 		cd ${S}/sunrpc/rpcsvc
Signature · 1 line
1.7.2
#10 lore raw

Re: [RFC: enhance toolchain bootstrap process: v3: 7/7] eglibc, eglibc-nativesdk: fix the build due to changes to eglibc-initial and gcc-cross-intermediate

Quoted 6 lines

From: Dexuan Cui
Sent: Tuesday, January 18, 2011 9:58 PM

BTW: I'm not very sure about the comments about CPPFLAGS and LDFLAGS, but I do
need to pass the 2 variables to make eglibc build ok.

From the commit history the special tweaks on CPPFLAGS and LDFLAGS exist for a long time. It's possible that they're there due to a specific issue which doesn't exist now. Does anyone remember the historical reason here? If not, and the intensive tests works fine, perhaps it's safe to change them. :-)

Thanks
Kevin

Quoted 86 lines
---
 meta/recipes-core/eglibc/eglibc.inc     |    9 +++++++++
 meta/recipes-core/eglibc/eglibc_2.12.bb |    8 ++------
 2 files changed, 11 insertions(+), 6 deletions(-)
meta/recipes-core/eglibc/eglibc.inc +1 -0
index 4698254..a61d35d 100644
@@ -1,5 +1,14 @@
 require eglibc-common.inc
 
+STAGING_BINDIR_TOOLCHAIN_prepend =

"${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-cross-intermediat e:"
+STAGING_BINDIR_TOOLCHAIN_virtclass-nativesdk_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-crosssdk-intermed iate:"

meta/recipes-core/eglibc/eglibc.inc +2 -0
+
+CPPFLAGS_prepend =

"-I${STAGING_DIR_TARGET}/eglibc-initial/${TARGET_SYS}${includedir_native} " +CPPFLAGS_virtclass-nativesdk_prepend = "-I${STAGING_DIR_TARGET}/eglibc-initial-nativesdk/${SDK_ARCH}-nativesdk${S DK_VENDOR}-${SDK_OS}${base_prefix}${includedir_native} "

meta/recipes-core/eglibc/eglibc.inc +2 -0
+
+LDFLAGS_prepend=

"-L${STAGING_DIR_TARGET}${base_libdir}.gcc-cross-intermediate " +LDFLAGS_virtclass-nativesdk_prepend= "-L${STAGING_DIR_TARGET}${base_libdir}.gcc-crosssdk-intermediate "

meta/recipes-core/eglibc/eglibc.inc +1 -0
+
 # nptl needs unwind support in gcc, which can't be built without glibc.
 DEPENDS = "virtual/${TARGET_PREFIX}gcc-intermediate linux-libc-headers"
 #this leads to circular deps, so lets not add it yet
meta/recipes-core/eglibc/eglibc_2.12.bb +1 -1
index 97353b7..c325d1b 100644
@@ -2,7 +2,7 @@ require eglibc.inc
 
 DEPENDS += "gperf-native"
 FILESPATHPKG =. "eglibc-svn:"
-PR = "r14"
+PR = "r15"
 
 EGLIBC_BRANCH="eglibc-2_12"
 SRC_URI =

"svn://www.eglibc.org/svn/branches/;module=${EGLIBC_BRANCH};proto=http \

meta/recipes-core/eglibc/eglibc_2.12.bb +1 -4
@@ -73,15 +73,13 @@ do_move_ports() {
 do_configure () {
 # override this function to avoid the autoconf/automake/aclocal/autoheader
 # calls for now
-# don't pass CPPFLAGS into configure, since it upsets the kernel-headers
-# version check and doesn't really help with anything
         if [ -z "`which rpcgen`" ]; then
                 echo "rpcgen not found.  Install glibc-devel."
                 exit 1
         fi
         (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
         find ${S} -name "configure" | xargs touch
-        CPPFLAGS="" oe_runconf
+        oe_runconf
 }
 
 rpcsvc = "bootparam_prot.x nlm_prot.x rstat.x \
@@ -89,8 +87,6 @@ rpcsvc = "bootparam_prot.x nlm_prot.x rstat.x \
 	  rusers.x spray.x nfs_prot.x rquota.x key_prot.x"
 
 do_compile () {
-	# -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another

glibc is in staging

meta/recipes-core/eglibc/eglibc_2.12.bb +0 -2
-	unset LDFLAGS
 	base_do_compile
 	(
 		cd ${S}/sunrpc/rpcsvc
--

1.7.2

_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky

#11 lore raw
In reply to Dexuan Cui

Hi Dexuan,

Quoted 6 lines · Dexuan Cui

Hi Richard and all,

The patch set enhances the toolchain bootstrap process by installing a separate sysroot for each step of the process.
The purpose is to avoid file overwriting in the current global sysroot, namely, to fix Bug 239: http://bugzilla.pokylinux.org/show_bug.cgi?id=239

Quoted 6 lines

The basic idea is straightforward:
1) For gcc-cross-initial and -intermediate, by changing MULTIMACH_TARGET_SYS to install the files into new locations;
2) Fix the build of eglibc-initial, eglibc by using the appropriate compilers, libs, headers;
3) Also make proper changes for the crosssdk/nativesdk version.

I've split all the changes into small git commits and each commit should be basically self-explanatory. :-)

I've had a look through this and experimented a little with the code and I've some feedback:

sstate.bbclass: allow each step of toolchain bootstrap processes to do populate_sysroot independently cross.bbclass: make MULTIMACH_TARGET_SYS adjustable for bindir, libdir, libexecdir

These two are fine.

gcc-cross-initial, gcc-crosssdk-initial: change CROSS_TARGET_SYS_DIR and insall into new locations

This change is ok but its incomplete. Why? If I apply this change and try a build, things won't work as it needs bits from later commits. To illustrate this and some other details, take a look at:

http://git.pokylinux.org/cgit.cgi/poky-contrib/commit/?h=rpurdie/tt-bootstrap&id=5512f876b103987b74722a7788a1ebe797852bbe

Here I've updated glibc and eglibc to use the new locations so the change will allow a build to succeed in its own right. Notice that I've simplified the variables quite a bit too.

There is also a subsequent commit on the branch to enable this change for gcc-cross-intermediate.

eglibc-initial, eglibc-initial-nativesdk: install into individual sysroots gcc-cross-intermediate, gcc-crosssdk-intermediate: change CROSS_TARGET_SYS_DIR and insall into new locations cross.bbclass: modify sysroot_stage_all to allow gcc-{cross,crossdk}-intermediate to populate the libgcc_s.so* files eglibc, eglibc-nativesdk: fix the build due to changes to eglibc-initial and gcc-cross-intermediate

These other changes need separating out more cleanly. For example, adding a patch to gcc should be a separate commit, the update to use a new sysroot directory should probably be one commit so builds work before and after it.

I'm also wondering if there isn't a neater way to handle the target sysroot problem instead of the prefixes you're using. I'll send an update as and when I've experimented a little to determine if this is possible.

Cheers,

Richard

#12 lore raw
Quoted 19 lines · Richard Purdie

Hi Dexuan,

Quoted 16 lines · Dexuan Cui

Hi Richard and all,

The patch set enhances the toolchain bootstrap process by installing a separate sysroot for each step of the process.
The purpose is to avoid file overwriting in the current global sysroot, namely, to fix Bug 239:
http://bugzilla.pokylinux.org/show_bug.cgi?id=239

The basic idea is straightforward:
1) For gcc-cross-initial and -intermediate, by changing MULTIMACH_TARGET_SYS to install the files into new locations; 2) Fix the build of eglibc-initial, eglibc by using the appropriate compilers, libs, headers; 3) Also make proper changes for the crosssdk/nativesdk version.

Quoted 6 lines
Quoted 2 lines

I've split all the changes into small git commits and each commit should be basically self-explanatory. :-)

I've had a look through this and experimented a little with the code and
I've some feedback:

Hi Richard, thanks very much for the review and feedback!
BTW: I was just about to send out my "RFC v5" patches and I saw the mail. :-)

During the past days, I've been busy with testing and fixing & updating my patches.
The v5 patches are at http://git.pokylinux.org/cgit/cgit.cgi/poky-contrib/log/?h=dcui/tcbp-v5 (actually it's the same as dcui/tcbp-test currently) The attached v3-to-v5.diff shows the difference from v3 to v5:

1) fix several typos for "_prepend_virtclass-nativesdk": previously I used the wrong "_virtclass-nativesdk_prepend"!

2) in eglibc-initial.inc, now the line is
STAGING_BINDIR_TOOLCHAIN_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${BASEPKG_HOST_SYS}.gcc-cross-initial:" Previously, I used HOST_SYS rather than BASEPKG_HOST_SYS. Actually HOST_SYS is not ok because this breaks arm/ppc builds.

3) similarly,

	in eglibc.inc: 
		STAGING_BINDIR_TOOLCHAIN_prepend: HOST_SYS --> BASEPKG_HOST_SYS
		CPPFLAGS_prepend: TARGET_SYS -> BASEPKG_TARGET_SYS
	in gcc-cross-intermediate.inc:
		GCC_CROSS_INTERMEDIATE_WITH_BUILD_SYSROOT: TARGET_SYS --> BASEPKG_TARGET_SYS

4) in eglibc-initial.inc:
use a "for t in ..." loop to replace the previous 3 statements.

5) add the code for glibc and glibc-initial similarly.
6) bump PRs accordingly.

I'll send my current test results later.

Quoted 5 lines

sstate.bbclass: allow each step of toolchain bootstrap processes to do populate_sysroot independently cross.bbclass: make
MULTIMACH_TARGET_SYS adjustable for bindir, libdir, libexecdir

These two are fine.

Thanks a lot for your previous great suggestion about MULTIMACH_TARGET_SYS. :-)

Quoted 6 lines

gcc-cross-initial, gcc-crosssdk-initial: change
CROSS_TARGET_SYS_DIR and insall into new locations

This change is ok but its incomplete. Why? If I apply this change and try a build, things won't work as it needs bits from later commits. To

I split my changes into small commits for easy review. Sorry, I didn't try to ensure every commit should be buildable. :-)

Quoted 8 lines

illustrate this and some other details, take a look at:

http://git.pokylinux.org/cgit.cgi/poky-contrib/commit/?h=rpurdie/tt-bootstrap&id=5512f876b103987b74722a7788a1ebe797852bbe

Here I've updated glibc and eglibc to use the new locations so the change will allow a build to succeed in its own right. Notice that I've
simplified the variables quite a bit too.

OK, I'll look at this branch carefully and see if anything in my v3-to-v5.diff should be added into this branch.

Quoted 10 lines

There is also a subsequent commit on the branch to enable this change for gcc-cross-intermediate.

eglibc-initial, eglibc-initial-nativesdk: install into individual sysroots gcc-cross-intermediate, gcc-crosssdk-intermediate: change CROSS_TARGET_SYS_DIR and insall into new locations cross.bbclass:
modify sysroot_stage_all to allow gcc-{cross,crossdk}-intermediate
to populate the libgcc_s.so* files eglibc, eglibc-nativesdk: fix the build due to changes to eglibc-initial and gcc-cross-intermediate

Quoted 4 lines

These other changes need separating out more cleanly. For example, adding a patch to gcc should be a separate commit, the update to use a new sysroot directory should probably be one commit so builds work before and after it.

OK, I'll think about how to organize the changes properly. Thanks for the suggestions!

Quoted 5 lines

I'm also wondering if there isn't a neater way to handle the target sysroot problem instead of the prefixes you're using. I'll send an update as and when I've experimented a little to determine if this is possible.

Thanks a lot for the help!

Thanks,
-- Dexuan

meta/recipes-core/eglibc/eglibc-initial.inc +5 -5
diff -Nru pc3/meta/recipes-core/eglibc/eglibc-initial.inc pc5/meta/recipes-core/eglibc/eglibc-initial.inc
@@ -1,7 +1,7 @@
 require eglibc-common.inc
 
-STAGING_BINDIR_TOOLCHAIN_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-cross-initial:"
-STAGING_BINDIR_TOOLCHAIN_virtclass-nativesdk_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-crosssdk-initial:"
+STAGING_BINDIR_TOOLCHAIN_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${BASEPKG_HOST_SYS}.gcc-cross-initial:"
+STAGING_BINDIR_TOOLCHAIN_prepend_virtclass-nativesdk = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-crosssdk-initial:"
 
 DEPENDS = "linux-libc-headers virtual/${TARGET_PREFIX}gcc-initial"
 PROVIDES = "virtual/${TARGET_PREFIX}libc-initial"
@@ -47,9 +47,9 @@
                -o ${D}${libdir}/libc.so
 
        # add links to linux-libc-headers: gcc-{cross,crossdk}-intermediate need this.
-       ln -s ${STAGING_DIR_TARGET}${includedir}/linux  ${D}${includedir}/
-       ln -s ${STAGING_DIR_TARGET}${includedir}/asm  ${D}${includedir}/
-       ln -s ${STAGING_DIR_TARGET}${includedir}/asm-generic  ${D}${includedir}/
+       for t in linux asm asm-generic; do
+               ln -s ${STAGING_DIR_TARGET}${includedir}/$t  ${D}${includedir}/
+       done
 }
 
 do_siteconfig () {
meta/recipes-core/eglibc/eglibc.inc +5 -5
diff -Nru pc3/meta/recipes-core/eglibc/eglibc.inc pc5/meta/recipes-core/eglibc/eglibc.inc
@@ -1,13 +1,13 @@
 require eglibc-common.inc
 
-STAGING_BINDIR_TOOLCHAIN_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-cross-intermediate:"
-STAGING_BINDIR_TOOLCHAIN_virtclass-nativesdk_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-crosssdk-intermediate:"
+STAGING_BINDIR_TOOLCHAIN_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${BASEPKG_HOST_SYS}.gcc-cross-intermediate:"
+STAGING_BINDIR_TOOLCHAIN_prepend_virtclass-nativesdk = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-crosssdk-intermediate:"
 
-CPPFLAGS_prepend = "-I${STAGING_DIR_TARGET}/eglibc-initial/${TARGET_SYS}${includedir_native} "
-CPPFLAGS_virtclass-nativesdk_prepend = "-I${STAGING_DIR_TARGET}/eglibc-initial-nativesdk/${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}${base_prefix}${includedir_native} "
+CPPFLAGS_prepend = "-I${STAGING_DIR_TARGET}/eglibc-initial/${BASEPKG_TARGET_SYS}${includedir_native} "
+CPPFLAGS_prepend_virtclass-nativesdk = "-I${STAGING_DIR_TARGET}/eglibc-initial-nativesdk/${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}${base_prefix}${includedir_native} "
 
 LDFLAGS_prepend= "-L${STAGING_DIR_TARGET}${base_libdir}.gcc-cross-intermediate "
-LDFLAGS_virtclass-nativesdk_prepend= "-L${STAGING_DIR_TARGET}${base_libdir}.gcc-crosssdk-intermediate "
+LDFLAGS_prepend_virtclass-nativesdk= "-L${STAGING_DIR_TARGET}${base_libdir}.gcc-crosssdk-intermediate "
 
 # nptl needs unwind support in gcc, which can't be built without glibc.
 DEPENDS = "virtual/${TARGET_PREFIX}gcc-intermediate linux-libc-headers"
meta/recipes-core/glibc/glibc-initial.inc +10 -0
diff -Nru pc3/meta/recipes-core/glibc/glibc-initial.inc pc5/meta/recipes-core/glibc/glibc-initial.inc
@@ -3,6 +3,9 @@
 PROVIDES = "virtual/${TARGET_PREFIX}libc-initial"
 FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/glibc-${PV}', '${FILE_DIRNAME}/glibc-2.4', '${FILE_DIRNAME}/glibc', '${FILE_DIRNAME}/files', '${FILE_DIRNAME}' ], d)}"
 
+STAGING_BINDIR_TOOLCHAIN_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${BASEPKG_HOST_SYS}.gcc-cross-initial:"
+STAGING_BINDIR_TOOLCHAIN_prepend_virtclass-nativesdk = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-crosssdk-initial:"
+
 PACKAGES = ""
 PACKAGES_DYNAMIC = ""
 
@@ -50,8 +53,15 @@
 	install -m 644 csu/crt[1in].o ${D}${libdir}
 	${CC} -nostdlib -nostartfiles -shared -x c /dev/null \
 		-o ${D}${libdir}/libc.so
+
+	# add links to linux-libc-headers: gcc-{cross,crossdk}-intermediate need this.
+	for t in linux asm asm-generic; do
+		ln -s ${STAGING_DIR_TARGET}${includedir}/$t  ${D}${includedir}/
+	done
 }
 
 do_siteconfig () {
 	:
 }
+
+do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TARGET}/${PN}"
meta/recipes-core/glibc/glibc.inc +10 -0
diff -Nru pc3/meta/recipes-core/glibc/glibc.inc pc5/meta/recipes-core/glibc/glibc.inc
@@ -8,6 +8,16 @@
                     file://elf/cache.c;beginline=1;endline=17;md5=926aac25497b1de7d630b4749005d208 \
                     file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff \
                     file://bits/types.h;beginline=1;endline=18;md5=267938e7c0538e76f734551ec6ea908d"
+
+STAGING_BINDIR_TOOLCHAIN_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${BASEPKG_HOST_SYS}.gcc-cross-intermediate:"
+STAGING_BINDIR_TOOLCHAIN_prepend_virtclass-nativesdk = "${STAGING_DIR_NATIVE}${bindir_native}/${HOST_SYS}.gcc-crosssdk-intermediate:"
+
+CPPFLAGS_prepend = "-I${STAGING_DIR_TARGET}/glibc-initial/${BASEPKG_TARGET_SYS}${includedir_native} "
+CPPFLAGS_prepend_virtclass-nativesdk = "-I${STAGING_DIR_TARGET}/glibc-initial-nativesdk/${SDK_ARCH}-nativesdk${SDK_VENDOR}-${SDK_OS}${base_prefix}${includedir_native} "
+
+LDFLAGS_prepend= "-L${STAGING_DIR_TARGET}${base_libdir}.gcc-cross-intermediate "
+LDFLAGS_prepend_virtclass-nativesdk= "-L${STAGING_DIR_TARGET}${base_libdir}.gcc-crosssdk-intermediate "
+
 # nptl needs unwind support in gcc, which can't be built without glibc.
 DEPENDS = "virtual/${TARGET_PREFIX}gcc-intermediate linux-libc-headers"
 RDEPENDS_${PN}-dev = "linux-libc-headers-dev"
meta/recipes-core/glibc/glibc_2.10.1.bb +2 -6
diff -Nru pc3/meta/recipes-core/glibc/glibc_2.10.1.bb pc5/meta/recipes-core/glibc/glibc_2.10.1.bb
@@ -5,7 +5,7 @@
 PACKAGES_DYNAMIC = "libc6*"
 RPROVIDES_${PN}-dev = "libc6-dev virtual-libc-dev"
 
-PR = "r6"
+PR = "r8"
 
 # the -isystem in bitbake.conf screws up glibc do_stage
 BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
@@ -128,14 +128,12 @@
 	sed -i s:/var/db/nscd:/var/run/nscd: ${S}/nscd/nscd.h
 # override this function to avoid the autoconf/automake/aclocal/autoheader
 # calls for now
-# don't pass CPPFLAGS into configure, since it upsets the kernel-headers
-# version check and doesn't really help with anything
 	if [ -z "`which rpcgen`" ]; then
 		echo "rpcgen not found.  Install glibc-devel."
 		exit 1
 	fi
 	(cd ${S} && gnu-configize) || die "failure in running gnu-configize"
-	CPPFLAGS="" oe_runconf
+	oe_runconf
 }
 
 rpcsvc = "bootparam_prot.x nlm_prot.x rstat.x \
@@ -143,8 +141,6 @@
           rusers.x spray.x nfs_prot.x rquota.x key_prot.x"
 
 do_compile () {
-	# -Wl,-rpath-link <staging>/lib in LDFLAGS can cause breakage if another glibc is in staging
-	unset LDFLAGS
 	base_do_compile
 	(
 		cd ${S}/sunrpc/rpcsvc
meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb +1 -1
diff -Nru pc3/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb pc5/meta/recipes-devtools/gcc/gcc-cross-initial_4.5.1.bb
@@ -1,5 +1,5 @@
 require gcc-cross_${PV}.bb
 require gcc-cross-initial.inc
 
-PR = "r2"
+PR = "r1"
 
meta/recipes-devtools/gcc/gcc-cross-intermediate.inc +1 -1
diff -Nru pc3/meta/recipes-devtools/gcc/gcc-cross-intermediate.inc pc5/meta/recipes-devtools/gcc/gcc-cross-intermediate.inc
@@ -8,7 +8,7 @@
 CROSS_TARGET_SYS_DIR_append = ".${PN}"
 
 
-GCC_CROSS_INTERMEDIATE_WITH_BUILD_SYSROOT = "${STAGING_DIR_TARGET}/eglibc-initial/${TARGET_SYS}"
+GCC_CROSS_INTERMEDIATE_WITH_BUILD_SYSROOT = "${STAGING_DIR_TARGET}/eglibc-initial/${BASEPKG_TARGET_SYS}"
 
 # This is intended to be a -very- basic config
 # sysroot is needed in case we use libc-initial
meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb +1 -1
diff -Nru pc3/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb pc5/meta/recipes-devtools/gcc/gcc-cross-intermediate_4.5.1.bb
@@ -1,4 +1,4 @@
 require gcc-cross_${PV}.bb
 require gcc-cross-intermediate.inc
-PR = "r2"
+PR = "r1"
 
meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb +1 -1
diff -Nru pc3/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb pc5/meta/recipes-devtools/gcc/gcc-crosssdk-initial_4.5.1.bb
@@ -1,4 +1,4 @@
 require gcc-cross-initial_${PV}.bb
 require gcc-crosssdk-initial.inc
 
-PR = "r2"
+PR = "r1"
meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb +1 -1
diff -Nru pc3/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb pc5/meta/recipes-devtools/gcc/gcc-crosssdk-intermediate_4.5.1.bb
@@ -1,4 +1,4 @@
 require gcc-cross-intermediate_${PV}.bb
 require gcc-crosssdk-intermediate.inc
 
-PR = "r2"
+PR = "r1"
#13 lore raw
Quoted 53 lines · Dexuan
Quoted 19 lines · Richard Purdie

Hi Dexuan,

Quoted 16 lines · Dexuan Cui

Hi Richard and all,

The patch set enhances the toolchain bootstrap process by installing a separate sysroot for each step of the process.
The purpose is to avoid file overwriting in the current global sysroot, namely, to fix Bug 239:
http://bugzilla.pokylinux.org/show_bug.cgi?id=239

The basic idea is straightforward:
1) For gcc-cross-initial and -intermediate, by changing MULTIMACH_TARGET_SYS to install the files into new locations; 2) Fix the build of eglibc-initial, eglibc by using the appropriate compilers, libs, headers; 3) Also make proper changes for the crosssdk/nativesdk version.

Quoted 5 lines
Quoted 2 lines

I've split all the changes into small git commits and each commit should be basically self-explanatory. :-)

I've had a look through this and experimented a little with the code and I've some feedback:

Hi Richard, thanks very much for the review and feedback!
BTW: I was just about to send out my "RFC v5" patches and I saw the mail. :-)

During the past days, I've been busy with testing and fixing & updating my patches.
The v5 patches are at
http://git.pokylinux.org/cgit/cgit.cgi/poky-contrib/log/?h=dcui/tcbp-v5
(actually it's the same as dcui/tcbp-test currently) The attached v3-to-v5.diff shows the difference from v3 to v5:

1) fix several typos for "_prepend_virtclass-nativesdk": previously I used the wrong "_virtclass-nativesdk_prepend"!

2) in eglibc-initial.inc, now the line is STAGING_BINDIR_TOOLCHAIN_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${BASEPKG_HOST_SYS}.gcc-cross-initial:" Previously, I used HOST_SYS rather than BASEPKG_HOST_SYS. Actually HOST_SYS is not ok because this breaks arm/ppc builds.

3) similarly,

	in eglibc.inc:
		STAGING_BINDIR_TOOLCHAIN_prepend: HOST_SYS --> BASEPKG_HOST_SYS
		CPPFLAGS_prepend: TARGET_SYS -> BASEPKG_TARGET_SYS
	in gcc-cross-intermediate.inc:
		GCC_CROSS_INTERMEDIATE_WITH_BUILD_SYSROOT: TARGET_SYS -->

BASEPKG_TARGET_SYS

Quoted 7 lines

4) in eglibc-initial.inc:
use a "for t in ..." loop to replace the previous 3 statements.

5) add the code for glibc and glibc-initial similarly.
6) bump PRs accordingly.

I'll send my current test results later.

My testing for tcbp-v5 is still not finished, but here I'd like to share the current status:

The latest master (070b7ee3, package_deb: Remove access to ...) is not stable: e.g,. pseudo issues, package-output.lock issue(this was fixed by RP 3 hours ago). So I used a slightly old commit 740ea682(poky-init-build-env: unset BBPATH) as a "Base Build"(without my patches), and also do new build with my patches(My Build).

1) For all qemu targets(x86, x86-64, mips, ppc, arm) , My Build (bitbake poky-image-sdk) can build fine and can boot to sato GUI (except ppc that has not GUI). I checked the list of files in each qemu target's rootfs and can verify the list is the same as that in a Base Build; Inside qemu targets, I tried to run gcc/g++ to build simple C/C++ code and everything works fine.

2) I can also verify My Build(bitbake meta-toolchain-sdk) can build fine.
A KNOWN issue: aftar "tar -jxf" the .bz2 file and "source environment-setup-*, I got the error when running "${CC}":
[root@dcui-desktop 0.9+snapshot]# ${CC}
Inconsistency detected by ld.so: dynamic-link.h: 209: elf_get_dynamic_info: Assertion `info[15] == ((void *)0)' failed!

I'm trying to fix this asap -- looks eglibc-nativesdk is not built ok???

Thanks,
-- Dexuan

#14 lore raw
In reply to Cui, Dexuan
Quoted 7 lines · Dexuan
Quoted 6 lines

  gcc-cross-initial, gcc-crosssdk-initial: change CROSS_TARGET_SYS_DIR and insall into new locations

This change is ok but its incomplete. Why? If I apply this change and try a build, things won't work as it needs bits from later commits. To

I split my changes into small commits for easy review. Sorry, I didn't try to ensure every commit should be buildable. :-)

Note that in general, keeping things buildable through the history is important for bisectability (assuming, of course, that this is a priority for poky -- I'm not certain about that). The more places where it won't build, the more commits have to be skipped when attempting to isolate a real problem. I'd suggest using the git test-sequence script (see google) to sanity check a branch before requesting a merge.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#15 lore raw
In reply to Cui, Dexuan
Quoted 22 lines · Dexuan
Quoted 1 line · Richard Purdie

On Tue, 2011-01-18 at 21:57 +0800, Dexuan Cui wrote:

Hi Richard, thanks very much for the review and feedback!
BTW: I was just about to send out my "RFC v5" patches and I saw the mail. :-)

During the past days, I've been busy with testing and fixing & updating my patches.
The v5 patches are at http://git.pokylinux.org/cgit/cgit.cgi/poky-contrib/log/?h=dcui/tcbp-v5 (actually it's the same as dcui/tcbp-test currently) The attached v3-to-v5.diff shows the difference from v3 to v5:

1) fix several typos for "_prepend_virtclass-nativesdk": previously I used the wrong "_virtclass-nativesdk_prepend"!

2) in eglibc-initial.inc, now the line is
STAGING_BINDIR_TOOLCHAIN_prepend = "${STAGING_DIR_NATIVE}${bindir_native}/${BASEPKG_HOST_SYS}.gcc-cross-initial:" Previously, I used HOST_SYS rather than BASEPKG_HOST_SYS. Actually HOST_SYS is not ok because this breaks arm/ppc builds.

3) similarly,

	in eglibc.inc: 
		STAGING_BINDIR_TOOLCHAIN_prepend: HOST_SYS --> BASEPKG_HOST_SYS
		CPPFLAGS_prepend: TARGET_SYS -> BASEPKG_TARGET_SYS
	in gcc-cross-intermediate.inc:
		GCC_CROSS_INTERMEDIATE_WITH_BUILD_SYSROOT: TARGET_SYS --> BASEPKG_TARGET_SYS
Quoted 7 lines

4) in eglibc-initial.inc:
use a "for t in ..." loop to replace the previous 3 statements.

5) add the code for glibc and glibc-initial similarly.
6) bump PRs accordingly.

I'll send my current test results later.

Sounds good.

I did a bit of research and experimentation with your remaining changes and came up with the hybrid you can see here:

http://git.pokylinux.org/cgit.cgi/poky-contrib/commit/?h=rpurdie/tt-bootstrap&id=bba04b790b0454e8bf2de8ea5a9d610e81f0a278

This is actually very similar to what you've done but I made a few tweaks to try and improve the way it works.

Firstly instead of overloading the /lib and /usr/lib directories, I just created a "bootstrap" sysroot, STAGING_DIR_TCBOOTSTRAP.

eglibc-initial then stages into that sysroot, as per your changes.

I then made gcc-cross-intermediate use this as both the build *and* installation sysroot since its files don't conflict with those from eglibc-initial.

We can then easily point eglibc to build against the bootstrap sysroot using TOOLCHAIN_OPTIONS but install into the target.

Looking back at my patch, the change to make gcc-configure-cross.inc use the bootstrap sysroot might not be correct, it should likely use the libc from the main sysroot by that point.

The biggest problem I found was the sitecache.bbclass function in eglibc as this wanted to run configure to be able to compile things yet we don't populate the sysroot at that point so the intermediate compiler won't fully work as it can't find a libc. I added a horrendous hack to fudge this piece into working. A neater solution would be nice, I'm still working on that but I'm not too optimistic.

Could you take a look at these changes and see what you think? There are still a few details that need to be ironed out but I think it could work.

Cheers,

Richard