Skip to contentSkip to conversation

eglibc-initial: Fix kernel headers symlink being wrong

PATCH In review Matthew McClintock 5 participants 11 messages Nov 28, 2011 – Nov 30, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eglibc-initial: Fix kernel headers symlink being wrong

symlinks to the kernel headers were pointing at the wrong location when being used from cache. Just copy the kernel headers instead

---
Do we need something to depend on the kernel version too since we are copying instead of symlinking? Something like:

do_install[vardeps] += "virtual/kernel:do_populate_sysroot"

 meta/recipes-core/eglibc/eglibc-common.inc  |    2 +-
 meta/recipes-core/eglibc/eglibc-initial.inc |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/eglibc/eglibc-common.inc +1 -1
index 4fa6488..6a93968 100644
@@ -3,7 +3,7 @@ DESCRIPTION = "Embedded GLIBC (EGLIBC) is a variant of the GNU C Library (GLIBC)
 HOMEPAGE = "http://www.eglibc.org/home"
 SECTION = "libs"
 LICENSE = "GPLv2 & LGPLv2.1"
-INC_PR = "r11"
+INC_PR = "r12"
 LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \
       file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
       file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
meta/recipes-core/eglibc/eglibc-initial.inc +1 -1
index 448f73a..f154d64 100644
@@ -48,7 +48,7 @@ do_install () {
 
 	# 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}/
+		cp -ar ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
 	done
 }
 
Signature · 1 line
1.7.6.1
#1 lore raw
Quoted 35 lines · Matthew McClintock

symlinks to the kernel headers were pointing at the wrong location when being used from cache. Just copy the kernel headers instead

---
Do we need something to depend on the kernel version too since we are copying instead of symlinking? Something like:

do_install[vardeps] += "virtual/kernel:do_populate_sysroot"

 meta/recipes-core/eglibc/eglibc-common.inc  |    2 +- meta/recipes-core/eglibc/eglibc-initial.inc |    2 +-

 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/eglibc/eglibc-common.inc +0 -0
index 4fa6488..6a93968 100644
@@ -3,7 +3,7 @@ DESCRIPTION = "Embedded GLIBC (EGLIBC) is a variant of the GNU C Library (GLIBC)

 HOMEPAGE = "http://www.eglibc.org/home"
 SECTION = "libs"
 LICENSE = "GPLv2 & LGPLv2.1"

meta/recipes-core/eglibc/eglibc-common.inc +1 -1
-INC_PR = "r11"
+INC_PR = "r12"

 LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \
      file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
      file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \

meta/recipes-core/eglibc/eglibc-initial.inc +0 -0
index 448f73a..f154d64 100644
@@ -48,7 +48,7 @@ do_install () {
 
        # add links to linux-libc-headers: gcc-{cross,crossdk}-intermediate need this.
Quoted 3 lines

       for t in linux asm asm-generic; do
-               ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
+               cp -ar ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/

For reference, it looked something like this when used from cache:

/home/mattsm/git/poky/build/tmp/sysroots/${MACHINE_A}-tcbootstrap/usr/include/linux:
broken symbolic link to `../../../..//sysroots/${MACHINE_B}/usr/include/linux'

And ${MACHINE_B} did not exist...

-M

#2 lore raw
Quoted 42 lines · On Mon, 2011-11-28 at 23:15 +0000, McClintock Matthew-B29882 wrote:
Quoted 33 lines · Matthew McClintock

symlinks to the kernel headers were pointing at the wrong location when being used from cache. Just copy the kernel headers instead

---
Do we need something to depend on the kernel version too since we are copying instead of symlinking? Something like:

do_install[vardeps] += "virtual/kernel:do_populate_sysroot"

 meta/recipes-core/eglibc/eglibc-common.inc  |    2 +-
 meta/recipes-core/eglibc/eglibc-initial.inc |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/eglibc/eglibc-common.inc +1 -1
index 4fa6488..6a93968 100644
@@ -3,7 +3,7 @@ DESCRIPTION = "Embedded GLIBC (EGLIBC) is a variant of the GNU C Library (GLIBC)
 HOMEPAGE = "http://www.eglibc.org/home"
 SECTION = "libs"
 LICENSE = "GPLv2 & LGPLv2.1"
-INC_PR = "r11"
+INC_PR = "r12"
 LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \
      file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
      file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
meta/recipes-core/eglibc/eglibc-initial.inc +0 -0
index 448f73a..f154d64 100644

meta/recipes-core/eglibc/eglibc-initial.inc do_install () { · line 51

Quoted 5 lines
meta/recipes-core/eglibc/eglibc-initial.inc +1 -1
@@ -48,7 +48,7 @@ do_install () {
 
       # 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}/
+               cp -ar ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/

For reference, it looked something like this when used from cache:

Quoted 5 lines

/home/mattsm/git/poky/build/tmp/sysroots/${MACHINE_A}-tcbootstrap/usr/include/linux:
broken symbolic link to `../../../..//sysroots/${MACHINE_B}/usr/include/linux'

And ${MACHINE_B} did not exist...

Yes, good catch. I'm going to propose a different fix though as the builds take up a lot of disk space and I'd prefer not to continue to grow the disk footprint unnecessarily.

Cheers,

Richard

#3 lore raw

PATCH 1/1 eglibc-initial: Ensure symlinks point to the correct location when built from sstate cache

In reply to McClintock Matthew-B29882

If the sstate files are installed into a sysroot from the sstate cache, the directory to the main sysroot can change and the symlinks aren't adjusted to account for this. This is a problem specific to the toolchain bootstrap process. This patch adds up a function to recreate the symlinks, hence ensuring they always point at the correct location.

---

meta/recipes-core/eglibc/eglibc-initial.inc +12 -0
index 448f73a..9062516 100644
@@ -60,4 +60,16 @@ do_siteconfig () {
 	:
 }
 
+SSTATEPOSTINSTFUNCS += "eglibcinitial_sstate_postinst"
+eglibcinitial_sstate_postinst() {
+	if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
+	then
+		# Recreate the symlinks to ensure they point to the correct location
+		for t in linux asm asm-generic; do
+			rm -f ${STAGING_DIR_TCBOOTSTRAP}${includedir}/$t
+			ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${STAGING_DIR_TCBOOTSTRAP}${includedir}/
+		done
+	fi
+}
+
 do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}"
#4 lore raw

Re: [PATCH] eglibc-initial: Ensure symlinks point to the correct location when built from sstate cache

Quoted 5 lines · Richard Purdie

If the sstate files are installed into a sysroot from the sstate cache, the directory to the main sysroot can change and the symlinks aren't adjusted to account for this. This is a problem specific to the toolchain bootstrap process. This patch adds up a function to recreate the symlinks, hence ensuring they always point at the correct location.

Similar issue is IMHO in python and apr (and probably more)
http://lists.linuxtogo.org/pipermail/openembedded-core/2011-November/012149.html

Cheers,

Quoted 30 lines

---

meta/recipes-core/eglibc/eglibc-initial.inc +12 -0
index 448f73a..9062516 100644
@@ -60,4 +60,16 @@ do_siteconfig () {
 	:
 }
 
+SSTATEPOSTINSTFUNCS += "eglibcinitial_sstate_postinst"
+eglibcinitial_sstate_postinst() {
+	if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
+	then
+		# Recreate the symlinks to ensure they point to the correct location
+		for t in linux asm asm-generic; do
+			rm -f ${STAGING_DIR_TCBOOTSTRAP}${includedir}/$t
+			ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${STAGING_DIR_TCBOOTSTRAP}${includedir}/
+		done
+	fi
+}
+
 do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}"

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#5 lore raw

Re: [PATCH] eglibc-initial: Ensure symlinks point to the correct location when built from sstate cache

Quoted 9 lines · Martin Jansa
Quoted 5 lines · Richard Purdie

If the sstate files are installed into a sysroot from the sstate cache, the directory to the main sysroot can change and the symlinks aren't adjusted to account for this. This is a problem specific to the toolchain bootstrap process. This patch adds up a function to recreate the symlinks, hence ensuring they always point at the correct location.

Similar issue is IMHO in python and apr (and probably more)
http://lists.linuxtogo.org/pipermail/openembedded-core/2011-November/012149.html

Its similar but not that similar. The toolchain sysroots are special in that the bootstrap one needs to refer to the non-bootstrap one via symlinks.

The path references you mention above should be detected by the sstate relocation code and fixed up automatically. It sounds like the search and replace expressions we're using aren't catching every reference we need to which is a different problem.

Cheers,

Richard

#6 lore raw

Re: [PATCH] eglibc-initial: Ensure symlinks point to the correct location when built from sstate cache

Quoted 11 lines · Richard Purdie
Quoted 9 lines · Martin Jansa
Quoted 5 lines · Richard Purdie

If the sstate files are installed into a sysroot from the sstate cache, the directory to the main sysroot can change and the symlinks aren't adjusted to account for this. This is a problem specific to the toolchain bootstrap process. This patch adds up a function to recreate the symlinks, hence ensuring they always point at the correct location.

Similar issue is IMHO in python and apr (and probably more)
http://lists.linuxtogo.org/pipermail/openembedded-core/2011-November/012149.html

Quoted 8 lines

Its similar but not that similar. The toolchain sysroots are special in that the bootstrap one needs to refer to the non-bootstrap one via symlinks.

The path references you mention above should be detected by the sstate relocation code and fixed up automatically. It sounds like the search and replace expressions we're using aren't catching every reference we need to which is a different problem.

As a hint, I think:

SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( -name "*.la" -o -name "*-config" \) -type f"

might need "Makefile" adding to that list of files to mangle...

Cheers,

Richard

#7 lore raw

Re: [PATCH] eglibc-initial: Ensure symlinks point to the correct location when built from sstate cache

In reply to Richard Purdie
Quoted 18 lines · Richard Purdie

If the sstate files are installed into a sysroot from the sstate cache, the directory to the main sysroot can change and the symlinks aren't adjusted to account for this. This is a problem specific to the toolchain bootstrap process. This patch adds up a function to recreate the symlinks, hence ensuring they always point at the correct location.

---

meta/recipes-core/eglibc/eglibc-initial.inc +0 -0
index 448f73a..9062516 100644
@@ -60,4 +60,16 @@ do_siteconfig () {

       :
 }

meta/recipes-core/eglibc/eglibc-initial.inc +2 -0
+SSTATEPOSTINSTFUNCS += "eglibcinitial_sstate_postinst"
+eglibcinitial_sstate_postinst() {

meta/recipes-core/eglibc/eglibc-initial.inc do_siteconfig () { · line 74

Quoted 10 lines
meta/recipes-core/eglibc/eglibc-initial.inc +10 -0
+       if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
+       then
+               # Recreate the symlinks to ensure they point to the correct location
+               for t in linux asm asm-generic; do
+                       rm -f ${STAGING_DIR_TCBOOTSTRAP}${includedir}/$t
+                       ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${STAGING_DIR_TCBOOTSTRAP}${includedir}/
+               done
+       fi
+}
+

you could do ln -sf here

Acked-by on v1 1/1
#8 lore raw
In reply to Matthew McClintock
Quoted 35 lines · Matthew McClintock

symlinks to the kernel headers were pointing at the wrong location when being used from cache. Just copy the kernel headers instead

---
Do we need something to depend on the kernel version too since we are copying instead of symlinking? Something like:

do_install[vardeps] += "virtual/kernel:do_populate_sysroot"

 meta/recipes-core/eglibc/eglibc-common.inc  |    2 +- meta/recipes-core/eglibc/eglibc-initial.inc |    2 +-

 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/eglibc/eglibc-common.inc +0 -0
index 4fa6488..6a93968 100644
@@ -3,7 +3,7 @@ DESCRIPTION = "Embedded GLIBC (EGLIBC) is a variant of the GNU C Library (GLIBC)

 HOMEPAGE = "http://www.eglibc.org/home"
 SECTION = "libs"
 LICENSE = "GPLv2 & LGPLv2.1"

meta/recipes-core/eglibc/eglibc-common.inc +1 -1
-INC_PR = "r11"
+INC_PR = "r12"

 LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \
      file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
      file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \

meta/recipes-core/eglibc/eglibc-initial.inc +0 -0
index 448f73a..f154d64 100644
@@ -48,7 +48,7 @@ do_install () {
 
        # add links to linux-libc-headers: gcc-{cross,crossdk}-intermediate need this.
Quoted 5 lines

       for t in linux asm asm-generic; do
-               ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
+               cp -ar ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/ done
 }

these were cross sysroot symlinks. imo copying is
the safer think to do here.

#9 lore raw
In reply to Matthew McClintock
Quoted 35 lines · Matthew McClintock

symlinks to the kernel headers were pointing at the wrong location when being used from cache. Just copy the kernel headers instead

---
Do we need something to depend on the kernel version too since we are copying instead of symlinking? Something like:

do_install[vardeps] += "virtual/kernel:do_populate_sysroot"

 meta/recipes-core/eglibc/eglibc-common.inc  |    2 +- meta/recipes-core/eglibc/eglibc-initial.inc |    2 +-

 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/eglibc/eglibc-common.inc +0 -0
index 4fa6488..6a93968 100644
@@ -3,7 +3,7 @@ DESCRIPTION = "Embedded GLIBC (EGLIBC) is a variant of the GNU C Library (GLIBC)

 HOMEPAGE = "http://www.eglibc.org/home"
 SECTION = "libs"
 LICENSE = "GPLv2 & LGPLv2.1"

meta/recipes-core/eglibc/eglibc-common.inc +1 -1
-INC_PR = "r11"
+INC_PR = "r12"

 LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \
      file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \
      file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \

meta/recipes-core/eglibc/eglibc-initial.inc +0 -0
index 448f73a..f154d64 100644
@@ -48,7 +48,7 @@ do_install () {
 
        # add links to linux-libc-headers: gcc-{cross,crossdk}-intermediate need this.
Quoted 3 lines

       for t in linux asm asm-generic; do
-               ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
+               cp -ar ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/

thinking a bit more I think just doing ln -sf might be another option instead of doing ln -s
will avoid copying.

Quoted 13 lines

       done
 }

--
1.7.6.1

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#10 lore raw
Quoted 8 lines · Khem Raj
Quoted 4 lines
       # 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}/
+               cp -ar ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/

thinking a bit more I think just doing ln -sf might be another option instead of doing ln -s
will avoid copying.

Richard's new approach was sort of more along the lines of what I was thinking. It's essentially fixing the symlinks after we deploy from sstate-cache. I don't think (correct me if I'm wrong) this step above will get run when deploying from sstate-cache.

-M