Skip to contentSkip to conversation

ppc/native: Fix native builds with PowerPC 32-bit host system

PATCH In review Serhey Popovych 3 participants 12 messages Jan 12, 2019

lore
Share & tools
lore
#0 lore raw

cover ppc/native: Fix native builds with PowerPC 32-bit host system

In some specific environments on PowerPC native builds failing due to:

a) libgpg-error requires TARGET_ARCH tuple mapping to supported tuple
b) binutils fails to build with --enable-targets=all due to small bss and data relocation failures.

To fix a) is trivial: we need to add tuple mapping for TARGET_ARCH=ppc.

Fixing b) isn't simple because with --enable-targets=all binary becomes too big to support R_PPC_GOT16 relocations against small bss/data. Since for native builds we only need libbfd, libiberty and libopcodes we can build only these three archives and their dependencies.

See individual commit message for details on each change presented.

Serhey Popovych (2):
libgpg-error: Support build for native on ppc host
binutils: Speed up and fix native builds

 meta/recipes-devtools/binutils/binutils_2.31.bb    | 33 +++++++++++++---------
 .../libgpg-error/libgpg-error_1.33.bb              |  1 +
 2 files changed, 20 insertions(+), 14 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 libgpg-error: Support build for native on ppc host

In Ubuntu 16.04 LTS userspace is build for PowerPC 32-bit while kernel selected by the installer depending on PowerPC machine type:

* 32-bit for PowerMac G4 (ppc7400) and below
* 64-bit for PowerMac G5 and above

Thus uname(2) returns ppc64 for 64-bit kernels and 32-bit userspace making build impossible due to missing some of lib64 multilib equivalents in Ubuntu repository.

Using setarch(8) override to make whole host look as PowerPC 32-bit can actually help with build but requires mapping for ppc target to their libgpg-error equivalent to fix native build.

Build tested on Ubuntu 16.04 LTS host on PowerMac G5 with command:

MACHINE=qemuppc setarch ppc bitbake core-image-full-cmdline

---
 meta/recipes-support/libgpg-error/libgpg-error_1.33.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-support/libgpg-error/libgpg-error_1.33.bb +1 -0
index 325529d..4153954 100644
@@ -47,6 +47,7 @@ do_compile_prepend() {
 	  mips*el)    TUPLE=mipsel-unknown-linux-gnu ;;
 	  mips*)      TUPLE=mips-unknown-linux-gnu ;;
 	  x86_64)     TUPLE=x86_64-unknown-linux-gnu ;;
+	  ppc)        TUPLE=powerpc-unknown-linux-gnu ;;
 	  ppc64)      TUPLE=powerpc64-unknown-linux-gnu ;;
 	  ppc64le)    TUPLE=powerpc64le-unknown-linux-gnu ;;
 	  *)          TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;;
Signature · 1 line
2.7.4
#10 lore raw

PATCH 2/2 binutils: Speed up and fix native builds

In reply to Serhey Popovych

We need only libbfd, libiberty and libopcodes from binutils native. To get them we build entire binutils with --enable-targets=all to include all possible output targets support and then remove all but these three libs.

This has two side effects:

1) it wastes build time
2) may cause errors caused by --enable-targets=all on some exotics build hosts like PowerPC 32bit

To address both of these effects we can configure binutils in general and only required libs and their dependencies (zlib and intl at the time). Then build only build these libs and their dependencies.

Regarding to PowerPC 32-bit build host issues we get following errors when building on Ubuntu 16.04 LTS for PowerPC with command:

MACHINE=qemuppc setarch ppc bitbake binutils-native

<output omitted>

| /usr/lib/gcc/powerpc-linux-gnu/5/../../../powerpc-linux-gnu/crti.o: In function `_init':
| (.init+0x22): relocation truncated to fit: R_PPC_GOT16 against undefined symbol `__gmon_start__'
| dwarf.o: In function `parse_gnu_debuglink':
| dwarf.c:(.text+0x482): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.o: In function `fetch_indexed_string':
| dwarf.c:(.text+0x8fa): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.o: In function `read_debug_line_header':
| dwarf.c:(.text+0x114a): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.c:(.text+0x12c6): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.o: In function `display_debug_ranges_list':
| dwarf.c:(.text+0x187e): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.c:(.text+0x18a2): relocation truncated to fit: R_PPC_GOT16 against symbol `stdout@@GLIBC_2.0' defined in .sdata section in /lib/powerpc-linux-gnu/libc.so.6
| dwarf.o: In function `display_debug_rnglists_list':
| dwarf.c:(.text+0x1bf2): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.c:(.text+0x1c06): relocation truncated to fit: R_PPC_GOT16 against symbol `stdout@@GLIBC_2.0' defined in .sdata section in /lib/powerpc-linux-gnu/libc.so.6
| dwarf.o: In function `display_block':
| dwarf.c:(.text+0x2486): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.o: In function `introduce.isra.2':
| dwarf.c:(.text+0x2556): additional relocation overflows omitted from the output
| collect2: error: ld returned 1 exit status
| Makefile:909: recipe for target 'objdump' failed
| make[4]: *** [objdump] Error 1
| make[4]: *** Waiting for unfinished jobs....

<output omitted>

While 'byte_get' is defined in small bss section in elfcomm.o and generally can be fixed, symbol from host glibc 'stdout@@GLIBC_2.0' in small data section can't be moved without recompile of Ubuntu 16.04 LTS glibc.

---
 meta/recipes-devtools/binutils/binutils_2.31.bb | 33 ++++++++++++++-----------
 1 file changed, 19 insertions(+), 14 deletions(-)
meta/recipes-devtools/binutils/binutils_2.31.bb +19 -14
index 51a9748..6796749 100644
@@ -20,26 +20,31 @@ EXTRA_OECONF_class-native = "--enable-targets=all \
                              --enable-install-libbfd \
                              --disable-werror"
 
+do_configure_append_class-native () {
+	for l in zlib intl bfd libiberty opcodes; do
+		oe_runmake configure-${l}
+	done
+}
+
+do_compile_class-native () {
+	for l in zlib intl bfd libiberty opcodes; do
+		cd "${l}"
+		autotools_do_compile
+		cd - >/dev/null
+	done
+}
+
 do_install_class-native () {
-	autotools_do_install
+	for l in bfd libiberty opcodes; do
+		cd "${l}"
+		autotools_do_install
+		cd - >/dev/null
+	done
 
 	# Install the libiberty header
 	install -d ${D}${includedir}
 	install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
 	install -m 644 ${S}/include/libiberty.h ${D}${includedir}
-
-	# We only want libiberty, libbfd and libopcodes
-	rm -rf ${D}${bindir}
-	rm -rf ${D}${prefix}/${TARGET_SYS}
-	rm -rf ${D}${prefix}/lib/ldscripts
-	rm -rf ${D}${prefix}/share/info
-	rm -rf ${D}${prefix}/share/locale
-	rm -rf ${D}${prefix}/share/man
-	rmdir ${D}${prefix}/share || :
-	rmdir ${D}/${libdir}/gcc-lib || :
-	rmdir ${D}/${libdir}64/gcc-lib || :
-	rmdir ${D}/${libdir} || :
-	rmdir ${D}/${libdir}64 || :
 }
 
 # Split out libbfd-*.so so including perf doesn't include extra stuff
Signature · 1 line
2.7.4
#11 lore raw

Re: [PATCH 2/2] binutils: Speed up and fix native builds

Quoted 45 lines · Serhey Popovych

We need only libbfd, libiberty and libopcodes from binutils native. To get them we build entire binutils with --enable-targets=all to include all possible output targets support and then remove all but these three libs.

This has two side effects:

1) it wastes build time
2) may cause errors caused by --enable-targets=all on some exotics build hosts like PowerPC 32bit

To address both of these effects we can configure binutils in general and only required libs and their dependencies (zlib and intl at the time). Then build only build these libs and their dependencies.

Regarding to PowerPC 32-bit build host issues we get following errors when building on Ubuntu 16.04 LTS for PowerPC with command:

MACHINE=qemuppc setarch ppc bitbake binutils-native

<output omitted>

| /usr/lib/gcc/powerpc-linux-gnu/5/../../../powerpc-linux-gnu/crti.o: In function `_init':
| (.init+0x22): relocation truncated to fit: R_PPC_GOT16 against undefined symbol `__gmon_start__'
| dwarf.o: In function `parse_gnu_debuglink':
| dwarf.c:(.text+0x482): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.o: In function `fetch_indexed_string':
| dwarf.c:(.text+0x8fa): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.o: In function `read_debug_line_header':
| dwarf.c:(.text+0x114a): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.c:(.text+0x12c6): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.o: In function `display_debug_ranges_list':
| dwarf.c:(.text+0x187e): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.c:(.text+0x18a2): relocation truncated to fit: R_PPC_GOT16 against symbol `stdout@@GLIBC_2.0' defined in .sdata section in /lib/powerpc-linux-gnu/libc.so.6
| dwarf.o: In function `display_debug_rnglists_list':
| dwarf.c:(.text+0x1bf2): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.c:(.text+0x1c06): relocation truncated to fit: R_PPC_GOT16 against symbol `stdout@@GLIBC_2.0' defined in .sdata section in /lib/powerpc-linux-gnu/libc.so.6
| dwarf.o: In function `display_block':
| dwarf.c:(.text+0x2486): relocation truncated to fit: R_PPC_GOT16 against symbol `byte_get' defined in .sbss section in elfcomm.o
| dwarf.o: In function `introduce.isra.2':
| dwarf.c:(.text+0x2556): additional relocation overflows omitted from the output
| collect2: error: ld returned 1 exit status
| Makefile:909: recipe for target 'objdump' failed
| make[4]: *** [objdump] Error 1
| make[4]: *** Waiting for unfinished jobs....
Quoted 7 lines

<output omitted>

While 'byte_get' is defined in small bss section in elfcomm.o and generally can be fixed, symbol from host glibc 'stdout@@GLIBC_2.0' in small data section can't be moved without recompile of Ubuntu 16.04 LTS glibc.

Can you try to add -fPIC to CFLAGS ? this should help in fixing the relocation spill.

Quoted 10 lines
---
 meta/recipes-devtools/binutils/binutils_2.31.bb | 33 ++++++++++++++-----------
 1 file changed, 19 insertions(+), 14 deletions(-)
meta/recipes-devtools/binutils/binutils_2.31.bb +0 -0
index 51a9748..6796749 100644

meta/recipes-devtools/binutils/binutils_2.31.bb EXTRA_OECONF_class-native = "--enable-targets=all \ · line 27

Quoted 8 lines
meta/recipes-devtools/binutils/binutils_2.31.bb +5 -0
@@ -20,26 +20,31 @@ EXTRA_OECONF_class-native = "--enable-targets=all \
                              --enable-install-libbfd \
                              --disable-werror"
 
+do_configure_append_class-native () {
+       for l in zlib intl bfd libiberty opcodes; do
+               oe_runmake configure-${l}
+       done
+}

lets use --disable-<DIR> instead in EXTRA_OECONF

meta/recipes-devtools/binutils/binutils_2.31.bb EXTRA_OECONF_class-native = "--enable-targets=all \ · line 36

Quoted 9 lines
meta/recipes-devtools/binutils/binutils_2.31.bb +9 -0
+
+do_compile_class-native () {
+       for l in zlib intl bfd libiberty opcodes; do
+               cd "${l}"
+               autotools_do_compile
+               cd - >/dev/null
+       done
+}
+

not needed

meta/recipes-devtools/binutils/binutils_2.31.bb EXTRA_OECONF_class-native = "--enable-targets=all \ · line 43

Quoted 8 lines
meta/recipes-devtools/binutils/binutils_2.31.bb +5 -1
 do_install_class-native () {
-       autotools_do_install
+       for l in bfd libiberty opcodes; do
+               cd "${l}"
+               autotools_do_install
+               cd - >/dev/null
+       done
 

not needed

Quoted 28 lines
meta/recipes-devtools/binutils/binutils_2.31.bb +0 -14
        # Install the libiberty header
        install -d ${D}${includedir}
        install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
        install -m 644 ${S}/include/libiberty.h ${D}${includedir}
-
-       # We only want libiberty, libbfd and libopcodes
-       rm -rf ${D}${bindir}
-       rm -rf ${D}${prefix}/${TARGET_SYS}
-       rm -rf ${D}${prefix}/lib/ldscripts
-       rm -rf ${D}${prefix}/share/info
-       rm -rf ${D}${prefix}/share/locale
-       rm -rf ${D}${prefix}/share/man
-       rmdir ${D}${prefix}/share || :
-       rmdir ${D}/${libdir}/gcc-lib || :
-       rmdir ${D}/${libdir}64/gcc-lib || :
-       rmdir ${D}/${libdir} || :
-       rmdir ${D}/${libdir}64 || :
 }
 
 # Split out libbfd-*.so so including perf doesn't include extra stuff
--

2.7.4

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

#2 lore raw

Re: [PATCH 1/2] libgpg-error: Support build for native on ppc host

In reply to Serhey Popovych
Quoted 30 lines · Serhey Popovych

In Ubuntu 16.04 LTS userspace is build for PowerPC 32-bit while kernel
selected by the installer depending on PowerPC machine type:

* 32-bit for PowerMac G4 (ppc7400) and below
* 64-bit for PowerMac G5 and above

Thus uname(2) returns ppc64 for 64-bit kernels and 32-bit userspace making build impossible due to missing some of lib64 multilib equivalents in Ubuntu repository.

Using setarch(8) override to make whole host look as PowerPC 32-bit can actually help with build but requires mapping for ppc target to their libgpg-error equivalent to fix native build.

Build tested on Ubuntu 16.04 LTS host on PowerMac G5 with command:

MACHINE=qemuppc setarch ppc bitbake core-image-full-cmdline

---
 meta/recipes-support/libgpg-error/libgpg-error_1.33.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-support/libgpg-error/libgpg-error_1.33.bb +0 -0
index 325529d..4153954 100644

meta/recipes-support/libgpg-error/libgpg-error_1.33.bb do_compile_prepend() { · line 53

Quoted 7 lines
meta/recipes-support/libgpg-error/libgpg-error_1.33.bb +1 -0
@@ -47,6 +47,7 @@ do_compile_prepend() {
 	  mips*el)    TUPLE=mipsel-unknown-linux-gnu ;;
 	  mips*)      TUPLE=mips-unknown-linux-gnu ;;
 	  x86_64)     TUPLE=x86_64-unknown-linux-gnu ;;
+	  ppc)        TUPLE=powerpc-unknown-linux-gnu ;;
 	  ppc64)      TUPLE=powerpc64-unknown-linux-gnu ;;
 	  ppc64le)    TUPLE=powerpc64le-unknown-linux-gnu ;;
 	  *)          TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;;

This doesn't feel correct. It only works if you're using the local setarch workaround and I'm worried most users are never going to find that.

I'm fine with adding in general fixes but this is getting very specific to an very uncommon usecase :(

Cheers,

Richard

#3 lore raw

Re: [PATCH 1/2] libgpg-error: Support build for native on ppc host

Quoted 43 lines · Richard Purdie
Quoted 30 lines · Serhey Popovych

In Ubuntu 16.04 LTS userspace is build for PowerPC 32-bit while kernel
selected by the installer depending on PowerPC machine type:

* 32-bit for PowerMac G4 (ppc7400) and below
* 64-bit for PowerMac G5 and above

Thus uname(2) returns ppc64 for 64-bit kernels and 32-bit userspace making build impossible due to missing some of lib64 multilib equivalents in Ubuntu repository.

Using setarch(8) override to make whole host look as PowerPC 32-bit can actually help with build but requires mapping for ppc target to their libgpg-error equivalent to fix native build.

Build tested on Ubuntu 16.04 LTS host on PowerMac G5 with command:

MACHINE=qemuppc setarch ppc bitbake core-image-full-cmdline

---
 meta/recipes-support/libgpg-error/libgpg-error_1.33.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-support/libgpg-error/libgpg-error_1.33.bb +0 -0
index 325529d..4153954 100644

meta/recipes-support/libgpg-error/libgpg-error_1.33.bb do_compile_prepend() { · line 53

Quoted 7 lines
meta/recipes-support/libgpg-error/libgpg-error_1.33.bb +1 -0
@@ -47,6 +47,7 @@ do_compile_prepend() {
 	  mips*el)    TUPLE=mipsel-unknown-linux-gnu ;;
 	  mips*)      TUPLE=mips-unknown-linux-gnu ;;
 	  x86_64)     TUPLE=x86_64-unknown-linux-gnu ;;
+	  ppc)        TUPLE=powerpc-unknown-linux-gnu ;;
 	  ppc64)      TUPLE=powerpc64-unknown-linux-gnu ;;
 	  ppc64le)    TUPLE=powerpc64le-unknown-linux-gnu ;;
 	  *)          TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;;

This doesn't feel correct. It only works if you're using the local setarch workaround and I'm worried most users are never going to find that.

Quoted 2 lines

I'm fine with adding in general fixes but this is getting very specific to an very uncommon usecase :(

Understand your position. Doing setarch(8) to run bitbake on ppc64 kernel with 32-bit user space with missing 64-bit multilib seems to be the only option.

Anyway this change just maps ppc to corresponding tuple used by libgpg-error, so with this fix we hit both

a) setarch(1) when kernel is 64-bit and userspace is 32-bit and no multilib
b) native 32-bit powerpc host that is running as virtual machine for example).

Quoted 5 lines

Cheers,

Richard

#4 lore raw

Re: [PATCH 1/2] libgpg-error: Support build for native on ppc host

Quoted 58 lines · Serhey Popovych
Quoted 49 lines · Richard Purdie
Quoted 35 lines · Serhey Popovych

In Ubuntu 16.04 LTS userspace is build for PowerPC 32-bit while kernel
selected by the installer depending on PowerPC machine type:

* 32-bit for PowerMac G4 (ppc7400) and below
* 64-bit for PowerMac G5 and above

Thus uname(2) returns ppc64 for 64-bit kernels and 32-bit userspace
making build impossible due to missing some of lib64 multilib equivalents in Ubuntu repository.

Using setarch(8) override to make whole host look as PowerPC 32- bit
can actually help with build but requires mapping for ppc target to
their libgpg-error equivalent to fix native build.

Build tested on Ubuntu 16.04 LTS host on PowerMac G5 with command:

MACHINE=qemuppc setarch ppc bitbake core-image-full-cmdline

---
 meta/recipes-support/libgpg-error/libgpg-error_1.33.bb | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

error_1.33.bb b/meta/recipes-support/libgpg-error/libgpg-error_1.33.bb index 325529d..4153954 100644

meta/recipes-support/libgpg-error/libgpg-error_1.33.bb do_compile_prepend() { · line 53

Quoted 7 lines
meta/recipes-support/libgpg-error/libgpg-error_1.33.bb +1 -0
@@ -47,6 +47,7 @@ do_compile_prepend() {
 	  mips*el)    TUPLE=mipsel-unknown-linux-gnu ;;
 	  mips*)      TUPLE=mips-unknown-linux-gnu ;;
 	  x86_64)     TUPLE=x86_64-unknown-linux-gnu ;;
+	  ppc)        TUPLE=powerpc-unknown-linux-gnu ;;
 	  ppc64)      TUPLE=powerpc64-unknown-linux-gnu ;;
 	  ppc64le)    TUPLE=powerpc64le-unknown-linux-gnu ;;
 	  *)          TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;;

This doesn't feel correct. It only works if you're using the local setarch workaround and I'm worried most users are never going to find
that.

Quoted 3 lines

I'm fine with adding in general fixes but this is getting very specific
to an very uncommon usecase :(

Understand your position. Doing setarch(8) to run bitbake on ppc64 kernel with 32-bit user space with missing 64-bit multilib seems to be the only option.

Quoted 8 lines

Anyway this change just maps ppc to corresponding tuple used by libgpg-error, so with this fix we hit both

a) setarch(1) when kernel is 64-bit and userspace is 32-bit and no multilib
b) native 32-bit powerpc host that is running as virtual machine
for
example).

I'd understand that if this were just libgpg-error-native but our qemuppc builds work which I guess is why I don't quite understand what is wrong here?

Cheers,

Richard

#5 lore raw

Re: [PATCH 1/2] libgpg-error: Support build for native on ppc host

Quoted 68 lines · Richard Purdie
Quoted 58 lines · Serhey Popovych
Quoted 49 lines · Richard Purdie
Quoted 35 lines · Serhey Popovych

In Ubuntu 16.04 LTS userspace is build for PowerPC 32-bit while kernel
selected by the installer depending on PowerPC machine type:

* 32-bit for PowerMac G4 (ppc7400) and below
* 64-bit for PowerMac G5 and above

Thus uname(2) returns ppc64 for 64-bit kernels and 32-bit userspace
making build impossible due to missing some of lib64 multilib equivalents in Ubuntu repository.

Using setarch(8) override to make whole host look as PowerPC 32- bit
can actually help with build but requires mapping for ppc target to
their libgpg-error equivalent to fix native build.

Build tested on Ubuntu 16.04 LTS host on PowerMac G5 with command:

MACHINE=qemuppc setarch ppc bitbake core-image-full-cmdline

---
 meta/recipes-support/libgpg-error/libgpg-error_1.33.bb | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

error_1.33.bb b/meta/recipes-support/libgpg-error/libgpg-error_1.33.bb index 325529d..4153954 100644

meta/recipes-support/libgpg-error/libgpg-error_1.33.bb do_compile_prepend() { · line 53

Quoted 7 lines
meta/recipes-support/libgpg-error/libgpg-error_1.33.bb +1 -0
@@ -47,6 +47,7 @@ do_compile_prepend() {
 	  mips*el)    TUPLE=mipsel-unknown-linux-gnu ;;
 	  mips*)      TUPLE=mips-unknown-linux-gnu ;;
 	  x86_64)     TUPLE=x86_64-unknown-linux-gnu ;;
+	  ppc)        TUPLE=powerpc-unknown-linux-gnu ;;
 	  ppc64)      TUPLE=powerpc64-unknown-linux-gnu ;;
 	  ppc64le)    TUPLE=powerpc64le-unknown-linux-gnu ;;
 	  *)          TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;;

This doesn't feel correct. It only works if you're using the local setarch workaround and I'm worried most users are never going to find
that.

Quoted 3 lines

I'm fine with adding in general fixes but this is getting very specific
to an very uncommon usecase :(

Understand your position. Doing setarch(8) to run bitbake on ppc64 kernel with 32-bit user space with missing 64-bit multilib seems to be the only option.

Quoted 8 lines

Anyway this change just maps ppc to corresponding tuple used by libgpg-error, so with this fix we hit both

a) setarch(1) when kernel is 64-bit and userspace is 32-bit and no multilib
b) native 32-bit powerpc host that is running as virtual machine
for
example).

Quoted 3 lines

I'd understand that if this were just libgpg-error-native but our qemuppc builds work which I guess is why I don't quite understand what is wrong here?

Problem only when PowerPC 32-bit (running in VM for example) is used as build host.

For that "uname -m" returns ppc, that mapping is missing for libgpg-error tuple.

Quoted 7 lines

Cheers,

Richard

#6 lore raw

Re: [PATCH 1/2] libgpg-error: Support build for native on ppc host

In reply to Richard Purdie
Quoted 69 lines · Richard Purdie
Quoted 58 lines · Serhey Popovych
Quoted 49 lines · Richard Purdie
Quoted 35 lines · Serhey Popovych

In Ubuntu 16.04 LTS userspace is build for PowerPC 32-bit while kernel
selected by the installer depending on PowerPC machine type:

* 32-bit for PowerMac G4 (ppc7400) and below
* 64-bit for PowerMac G5 and above

Thus uname(2) returns ppc64 for 64-bit kernels and 32-bit userspace
making build impossible due to missing some of lib64 multilib equivalents in Ubuntu repository.

Using setarch(8) override to make whole host look as PowerPC 32- bit
can actually help with build but requires mapping for ppc target to
their libgpg-error equivalent to fix native build.

Build tested on Ubuntu 16.04 LTS host on PowerMac G5 with command:

MACHINE=qemuppc setarch ppc bitbake core-image-full-cmdline

---
 meta/recipes-support/libgpg-error/libgpg-error_1.33.bb | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

error_1.33.bb b/meta/recipes-support/libgpg-error/libgpg-error_1.33.bb index 325529d..4153954 100644

meta/recipes-support/libgpg-error/libgpg-error_1.33.bb do_compile_prepend() { · line 53

Quoted 7 lines
meta/recipes-support/libgpg-error/libgpg-error_1.33.bb +1 -0
@@ -47,6 +47,7 @@ do_compile_prepend() {
    mips*el)    TUPLE=mipsel-unknown-linux-gnu ;;
    mips*)      TUPLE=mips-unknown-linux-gnu ;;
    x86_64)     TUPLE=x86_64-unknown-linux-gnu ;;
+   ppc)        TUPLE=powerpc-unknown-linux-gnu ;;
    ppc64)      TUPLE=powerpc64-unknown-linux-gnu ;;
    ppc64le)    TUPLE=powerpc64le-unknown-linux-gnu ;;
    *)          TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;;

This doesn't feel correct. It only works if you're using the local setarch workaround and I'm worried most users are never going to find
that.

Quoted 3 lines

I'm fine with adding in general fixes but this is getting very specific
to an very uncommon usecase :(

Understand your position. Doing setarch(8) to run bitbake on ppc64 kernel with 32-bit user space with missing 64-bit multilib seems to be the only option.

Quoted 8 lines

Anyway this change just maps ppc to corresponding tuple used by libgpg-error, so with this fix we hit both

a) setarch(1) when kernel is 64-bit and userspace is 32-bit and no multilib
b) native 32-bit powerpc host that is running as virtual machine
for
example).

Quoted 3 lines

I'd understand that if this were just libgpg-error-native but our qemuppc builds work which I guess is why I don't quite understand what is wrong here?

this is when using ppc32 as build host :)

Quoted 12 lines

Cheers,

Richard

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

#7 lore raw

Re: [PATCH 1/2] libgpg-error: Support build for native on ppc host

Quoted 78 lines · Khem Raj
Quoted 76 lines · Richard Purdie
Quoted 74 lines · Serhey Popovych
Quoted 54 lines · Richard Purdie
Quoted 38 lines · Serhey Popovych

In Ubuntu 16.04 LTS userspace is build for PowerPC 32-bit while
kernel
selected by the installer depending on PowerPC machine type:

* 32-bit for PowerMac G4 (ppc7400) and below
* 64-bit for PowerMac G5 and above

Thus uname(2) returns ppc64 for 64-bit kernels and 32-bit userspace
making build impossible due to missing some of lib64 multilib equivalents in Ubuntu repository.

Using setarch(8) override to make whole host look as PowerPC 32-
bit
can actually help with build but requires mapping for ppc target
to
their libgpg-error equivalent to fix native build.

Build tested on Ubuntu 16.04 LTS host on PowerMac G5 with command:

MACHINE=qemuppc setarch ppc bitbake core-image-full-cmdline

---
 meta/recipes-support/libgpg-error/libgpg-error_1.33.bb | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

error_1.33.bb b/meta/recipes-support/libgpg-error/libgpg-error_1.33.bb index 325529d..4153954 100644

meta/recipes-support/libgpg-error/libgpg-error_1.33.bb do_compile_prepend() { · line 53

Quoted 7 lines
meta/recipes-support/libgpg-error/libgpg-error_1.33.bb +1 -0
@@ -47,6 +47,7 @@ do_compile_prepend() {
    mips*el)    TUPLE=mipsel-unknown-linux-gnu ;;
    mips*)      TUPLE=mips-unknown-linux-gnu ;;
    x86_64)     TUPLE=x86_64-unknown-linux-gnu ;;
+   ppc)        TUPLE=powerpc-unknown-linux-gnu ;;
    ppc64)      TUPLE=powerpc64-unknown-linux-gnu ;;
    ppc64le)    TUPLE=powerpc64le-unknown-linux-gnu ;;
    *)          TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;;

This doesn't feel correct. It only works if you're using the local
setarch workaround and I'm worried most users are never going to
find
that.

Quoted 3 lines

I'm fine with adding in general fixes but this is getting very specific
to an very uncommon usecase :(

Understand your position. Doing setarch(8) to run bitbake on ppc64
kernel with 32-bit user space with missing 64-bit multilib seems to
be the only option.

Anyway this change just maps ppc to corresponding tuple used by libgpg-error, so with this fix we hit both

a) setarch(1) when kernel is 64-bit and userspace is 32-bit and no multilib
b) native 32-bit powerpc host that is running as virtual
machine
for
example).

Quoted 6 lines
Quoted 4 lines

I'd understand that if this were just libgpg-error-native but our qemuppc builds work which I guess is why I don't quite understand what
is wrong here?

this is when using ppc32 as build host :)

I appreciate that. My point is that we can build for ppc32 target machines (qemuppc) so why are ppc32 target machines using a different arch to native ppc32 machines?

If the native and target recipes were different I could understand it but they're not.

Could is mean we're using a non-standard name for ppc32 target builds? or does it mean setarch should be to something else like powerpc on native builds? Basically I worry that we're using different names for the same thing.

Cheers,

Richard

#8 lore raw

Re: [PATCH 1/2] libgpg-error: Support build for native on ppc host

Quoted 84 lines · Richard Purdie
Quoted 83 lines · Khem Raj
Quoted 80 lines · Richard Purdie
Quoted 68 lines · Serhey Popovych
Quoted 54 lines · Richard Purdie
Quoted 38 lines · Serhey Popovych

In Ubuntu 16.04 LTS userspace is build for PowerPC 32-bit while
kernel
selected by the installer depending on PowerPC machine type:

* 32-bit for PowerMac G4 (ppc7400) and below
* 64-bit for PowerMac G5 and above

Thus uname(2) returns ppc64 for 64-bit kernels and 32-bit userspace
making build impossible due to missing some of lib64 multilib equivalents in Ubuntu repository.

Using setarch(8) override to make whole host look as PowerPC 32-
bit
can actually help with build but requires mapping for ppc target
to
their libgpg-error equivalent to fix native build.

Build tested on Ubuntu 16.04 LTS host on PowerMac G5 with command:

MACHINE=qemuppc setarch ppc bitbake core-image-full-cmdline

---
 meta/recipes-support/libgpg-error/libgpg-error_1.33.bb | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

error_1.33.bb b/meta/recipes-support/libgpg-error/libgpg-error_1.33.bb index 325529d..4153954 100644

meta/recipes-support/libgpg-error/libgpg-error_1.33.bb do_compile_prepend() { · line 53

Quoted 7 lines
meta/recipes-support/libgpg-error/libgpg-error_1.33.bb +1 -0
@@ -47,6 +47,7 @@ do_compile_prepend() {
    mips*el)    TUPLE=mipsel-unknown-linux-gnu ;;
    mips*)      TUPLE=mips-unknown-linux-gnu ;;
    x86_64)     TUPLE=x86_64-unknown-linux-gnu ;;
+   ppc)        TUPLE=powerpc-unknown-linux-gnu ;;
    ppc64)      TUPLE=powerpc64-unknown-linux-gnu ;;
    ppc64le)    TUPLE=powerpc64le-unknown-linux-gnu ;;
    *)          TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;;

This doesn't feel correct. It only works if you're using the local
setarch workaround and I'm worried most users are never going to
find
that.

Quoted 3 lines

I'm fine with adding in general fixes but this is getting very specific
to an very uncommon usecase :(

Understand your position. Doing setarch(8) to run bitbake on ppc64
kernel with 32-bit user space with missing 64-bit multilib seems to
be the only option.

Anyway this change just maps ppc to corresponding tuple used by libgpg-error, so with this fix we hit both

Quoted 6 lines

a) setarch(1) when kernel is 64-bit and userspace is 32-bit and no multilib
b) native 32-bit powerpc host that is running as virtual
machine
for
example).

I'd understand that if this were just libgpg-error-native but our qemuppc builds work which I guess is why I don't quite understand what
is wrong here?

Quoted 5 lines
Quoted 1 line

this is when using ppc32 as build host :)

I appreciate that. My point is that we can build for ppc32 target machines (qemuppc) so why are ppc32 target machines using a different arch to native ppc32 machines?

For target we have TUNE_ARCH, for native we have BUILD_ARCH that comes from uname(2).

So for target we hit *) in case statement, while for native we hit special cases from various uname(2) (and where ppc is missing for ppc32).

Quoted 10 lines

If the native and target recipes were different I could understand it but they're not.

Could is mean we're using a non-standard name for ppc32 target builds? or does it mean setarch should be to something else like powerpc on native builds? Basically I worry that we're using different names for the same thing.

In sense of uname(2) and TUNE_ARCH mismatch this looks as true.

However for configure triplet for target powerpc, powerpc64 and powerpc64le are used nearly always.

Quoted 7 lines

Cheers,

Richard

#9 lore raw

Re: [PATCH 1/2] libgpg-error: Support build for native on ppc host

In reply to Richard Purdie
Quoted 85 lines · Richard Purdie
Quoted 83 lines · Khem Raj
Quoted 80 lines · Richard Purdie
Quoted 68 lines · Serhey Popovych
Quoted 54 lines · Richard Purdie
Quoted 38 lines · Serhey Popovych

In Ubuntu 16.04 LTS userspace is build for PowerPC 32-bit while
kernel
selected by the installer depending on PowerPC machine type:

* 32-bit for PowerMac G4 (ppc7400) and below
* 64-bit for PowerMac G5 and above

Thus uname(2) returns ppc64 for 64-bit kernels and 32-bit userspace
making build impossible due to missing some of lib64 multilib equivalents in Ubuntu repository.

Using setarch(8) override to make whole host look as PowerPC 32-
bit
can actually help with build but requires mapping for ppc target
to
their libgpg-error equivalent to fix native build.

Build tested on Ubuntu 16.04 LTS host on PowerMac G5 with command:

MACHINE=qemuppc setarch ppc bitbake core-image-full-cmdline

---
 meta/recipes-support/libgpg-error/libgpg-error_1.33.bb | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

error_1.33.bb b/meta/recipes-support/libgpg-error/libgpg-error_1.33.bb index 325529d..4153954 100644

meta/recipes-support/libgpg-error/libgpg-error_1.33.bb do_compile_prepend() { · line 53

Quoted 7 lines
meta/recipes-support/libgpg-error/libgpg-error_1.33.bb +1 -0
@@ -47,6 +47,7 @@ do_compile_prepend() {
    mips*el)    TUPLE=mipsel-unknown-linux-gnu ;;
    mips*)      TUPLE=mips-unknown-linux-gnu ;;
    x86_64)     TUPLE=x86_64-unknown-linux-gnu ;;
+   ppc)        TUPLE=powerpc-unknown-linux-gnu ;;
    ppc64)      TUPLE=powerpc64-unknown-linux-gnu ;;
    ppc64le)    TUPLE=powerpc64le-unknown-linux-gnu ;;
    *)          TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;;

This doesn't feel correct. It only works if you're using the local
setarch workaround and I'm worried most users are never going to
find
that.

Quoted 3 lines

I'm fine with adding in general fixes but this is getting very specific
to an very uncommon usecase :(

Understand your position. Doing setarch(8) to run bitbake on ppc64
kernel with 32-bit user space with missing 64-bit multilib seems to
be the only option.

Anyway this change just maps ppc to corresponding tuple used by libgpg-error, so with this fix we hit both

Quoted 6 lines

a) setarch(1) when kernel is 64-bit and userspace is 32-bit and no multilib
b) native 32-bit powerpc host that is running as virtual
machine
for
example).

I'd understand that if this were just libgpg-error-native but our qemuppc builds work which I guess is why I don't quite understand what
is wrong here?

Quoted 5 lines
Quoted 1 line

this is when using ppc32 as build host :)

I appreciate that. My point is that we can build for ppc32 target machines (qemuppc) so why are ppc32 target machines using a different arch to native ppc32 machines?

Thats because for our ppc32 targets TARGET_ARCH is 'powerpc' and not ppc which has one to one mapping for target specific lock-obj-pub.h file

Quoted 5 lines

If the native and target recipes were different I could understand it but they're not.

Could is mean we're using a non-standard name for ppc32 target builds?

Not really.

Quoted 2 lines

or does it mean setarch should be to something else like powerpc on native builds?

yes historically ppc is ok they are used interchangeably

Basically I worry that we're using different names for

Quoted 8 lines

the same thing.

Cheers,

Richard