All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Ohly <Patrick.Ohly@gmx.de>
To: openembedded-devel@lists.openembedded.org
Subject: Re: cross-compiling for x86_64
Date: Sat, 30 Dec 2006 16:12:48 +0100	[thread overview]
Message-ID: <1167491568.4160.16.camel@ip6-localhost> (raw)
In-Reply-To: <1163273077.4395.96.camel@ip6-localhost>

[-- Attachment #1: Type: text/plain, Size: 2220 bytes --]

Hi all,

I have had some time over the holidays to investigate this again and
have come up with patches that solves the problem for me. I'm attaching
them in the hope that someone else will find them useful and/or commit
them on dev.

Note that I have only patched the packages that were picked up by the
current "generic" distro - some of the changes will probably also need
to be done to other .bb files. I have also intentionally not updated any
PR variables to avoid conflicts.

On Sat, 2006-11-11 at 20:24 +0100, Patrick Ohly wrote:
> Here's a summary of the problems I had:
>       * glibc-initial-2.3.2+cvs20040726-r22: generic bits/wordsize.h and
>         bits/endian.h is used instead of the x86_64 ones

Failed differently for me now (something about NTPL requiring TLS), but
instead of investigating further I simply changed
gcc-cross-initial_4.1.1.bb to not depend on libc-initial. This is
already how it works for 'arm', 'armeb', 'mips', 'mipsel'.

If there is a particular reason why the initial libc should be needed
for x86_64, then I haven't noticed it.

>       * glibc-intermediate-2.5-r2: asm-x86_64 header files not found
>       * glibc-intermediate-2.5-r2: config-name.h not created by
>         configure although it is needed
>       * glibc-intermediate-2.5-r2: #error "__NR_pread and __NR_pread64
>         both defined???"

All caused by linux-libc-headers_2.6.18.bb not installing the
asm-i386/x86_64 directories which are referenced by the asm include
files depending on the current compiler flags. Along the same line
compiler.h also had to be installed explicitly because it was missing
otherwise.

Finally gcc-cross-initial_4.1.1.bb failed to stage the compiler shared
objects because the gcc make system insists on installing them in
<libdir>/../lib64 and the .bb file expects them in <libdir> (code came
from gcc-package-cross.inc).

With those changes I was able to compile the normal glibc and some other
packages. I have not tested whether any of these results actually run
anywhere, ATM my main goal is to just verify that compilation in 64 bit
mode works.

-- 
Bye, Patrick Ohly
--  
Patrick.Ohly@gmx.de
http://www.estamos.de/

[-- Attachment #2: gcc-cross-initial_4.1.1.bb.patch --]
[-- Type: text/x-patch, Size: 953 bytes --]

# 
# old_revision [08852d3ee921e5b54ef924285cd0ed124cb83e31]
# 
# patch "packages/gcc/gcc-cross-initial_4.1.1.bb"
#  from [7820cd16078d41cfc1e61af5ec45f1fbe7835156]
#    to [246e2d677fba6679138489915cb8570790a896cc]
# 
============================================================
--- packages/gcc/gcc-cross-initial_4.1.1.bb	7820cd16078d41cfc1e61af5ec45f1fbe7835156
+++ packages/gcc/gcc-cross-initial_4.1.1.bb	246e2d677fba6679138489915cb8570790a896cc
@@ -1,7 +1,7 @@ DEPENDS = "virtual/${TARGET_PREFIX}binut
 require gcc-cross_${PV}.bb
 
 DEPENDS = "virtual/${TARGET_PREFIX}binutils"
-DEPENDS += "${@['virtual/${TARGET_PREFIX}libc-initial',''][bb.data.getVar('TARGET_ARCH', d, 1) in ['arm', 'armeb', 'mips', 'mipsel']]}"
+DEPENDS += "${@['virtual/${TARGET_PREFIX}libc-initial',''][bb.data.getVar('TARGET_ARCH', d, 1) in ['arm', 'armeb', 'mips', 'mipsel', 'x86_64']]}"
 PROVIDES = "virtual/${TARGET_PREFIX}gcc-initial"
 PACKAGES = ""
 

[-- Attachment #3: gcc-package-cross.inc.patch --]
[-- Type: text/x-patch, Size: 1468 bytes --]

# 
# old_revision [08852d3ee921e5b54ef924285cd0ed124cb83e31]
# 
# patch "packages/gcc/gcc-package-cross.inc"
#  from [02cf25e589eef74ad349812027d82351a7cf8ec9]
#    to [2e5f07377a4db88a035c3a46e16649e7cb1aaa9b]
# 
============================================================
--- packages/gcc/gcc-package-cross.inc	02cf25e589eef74ad349812027d82351a7cf8ec9
+++ packages/gcc/gcc-package-cross.inc	2e5f07377a4db88a035c3a46e16649e7cb1aaa9b
@@ -47,18 +47,18 @@ do_install () {
 		:
 	elif [ -f ${D}${prefix}/lib/libgcc_s.so.? ]; then
 		mv -f ${D}${prefix}/lib/libgcc_s.so* ${D}${target_base_libdir}
-	else
-		mv -f ${D}${prefix}/*/lib/libgcc_s.so* ${D}${target_base_libdir}
+        else
+		mv -f ${D}${prefix}/*/lib*/libgcc_s.so* ${D}${target_base_libdir}
 	fi
 
 	# Move libstdc++ and libg2c into libdir (resetting our prefix to /usr
 	mkdir -p ${D}${target_libdir}
-	mv -f ${D}${prefix}/*/lib/libstdc++.so* ${D}${target_libdir}
+      mv -f ${D}${prefix}/*/lib*/libstdc++.so* ${D}${target_libdir}
 	if [ "${HAS_G2C}" = "yes" ]; then
-	  mv -f ${D}${prefix}/*/lib/libg2c.so* ${D}${target_libdir} || true
+	  mv -f ${D}${prefix}/*/lib*/libg2c.so* ${D}${target_libdir} || true
 	fi
 	if [ "${HAS_GFORTRAN}" = "yes" ]; then
-	  mv -f ${D}${prefix}/*/lib/libgfortran*.so* ${D}${target_libdir}
+	  mv -f ${D}${prefix}/*/lib*/libgfortran*.so* ${D}${target_libdir}
 	fi
 
        # Manually run the target stripper since we won't get it run by

[-- Attachment #4: linux-libc-headers_2.6.18.bb.patch --]
[-- Type: text/x-patch, Size: 2027 bytes --]

# 
# old_revision [08852d3ee921e5b54ef924285cd0ed124cb83e31]
# 
# patch "packages/linux-libc-headers/linux-libc-headers_2.6.18.bb"
#  from [037dd011e97011fedc216fdceaba007201fa19dd]
#    to [4e3aaa4c88bc5fc59f119bf1c10237744e7801e0]
# 
============================================================
--- packages/linux-libc-headers/linux-libc-headers_2.6.18.bb	037dd011e97011fedc216fdceaba007201fa19dd
+++ packages/linux-libc-headers/linux-libc-headers_2.6.18.bb	4e3aaa4c88bc5fc59f119bf1c10237744e7801e0
@@ -46,6 +46,10 @@ do_install_append_arm() {
 	cp include/asm-arm/procinfo.h ${D}${includedir}/asm
 }
 
+do_install_append_x86_64() {
+        cp -r include/asm-x86_64 include/asm-i386 ${D}${includedir}/
+}
+
 STAGE_TEMP="${WORKDIR}/temp-staging"
 
 do_stage () {
@@ -56,6 +60,9 @@ do_stage () {
 	if [ "${ARCH}" == "arm" ]; then
 		cp include/asm-arm/procinfo.h ${STAGE_TEMP}${includedir}/asm
 	fi
+        if [ "${ARCH}" == "x86_64" ]; then
+                cp include/linux/compiler.h ${STAGE_TEMP}${includedir}/linux
+        fi
 	install -d ${STAGING_INCDIR}
 	rm -rf ${STAGING_INCDIR}/linux ${STAGING_INCDIR}/asm ${STAGING_INCDIR}/asm-generic
 	cp -pfLR ${STAGE_TEMP}${includedir}/linux ${STAGING_INCDIR}/
@@ -68,4 +75,11 @@ do_stage () {
 	cp -pfLR ${STAGE_TEMP}${includedir}/linux ${CROSS_DIR}/${TARGET_SYS}/include/
 	cp -pfLR ${STAGE_TEMP}${includedir}/asm ${CROSS_DIR}/${TARGET_SYS}/include/
 	cp -pfLR ${STAGE_TEMP}${includedir}/asm-generic ${CROSS_DIR}/${TARGET_SYS}/include/
+        if [ "${ARCH}" == "x86_64" ]; then
+                cp -pfLR include/asm-x86_64 ${STAGING_INCDIR}
+                cp -pflR include/asm-i386 ${STAGING_INCDIR}
+              	rm -rf ${CROSS_DIR}/${TARGET_SYS}/include/asm-x86_64 ${CROSS_DIR}/${TARGET_SYS}/include/asm-i386
+                cp -pfLR ${STAGE_TEMP}${includedir}/asm-x86_64 ${CROSS_DIR}/${TARGET_SYS}/include/
+                cp -pfLR ${STAGE_TEMP}${includedir}/asm-i386 ${CROSS_DIR}/${TARGET_SYS}/include/
+        fi
 }

  reply	other threads:[~2006-12-30 15:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-07 22:00 cross-compiling for x86_64 Patrick Ohly
2006-11-11 19:24 ` Patrick Ohly
2006-12-30 15:12   ` Patrick Ohly [this message]
2006-12-30 15:37     ` Koen Kooi
2006-12-30 16:13       ` Patrick Ohly
2006-12-31 22:39         ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1167491568.4160.16.camel@ip6-localhost \
    --to=patrick.ohly@gmx.de \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.