http://gentoo.mindzoo.de/index.cgi/wiki/cross-compiling 按上面的方法,试了几回都失败,不听话的glibc
没找到其他完整的文档,只有折腾了
至于openembedded解决
install ->> ${STAGING}
configure --with-xx=${STAGING}
http://jicknan.blogspot.com/2007/09/cross-compile-libtool.html
避免cross-compile的陷阱:libtool以前用 crossdev制作过工具链,还是保守点算了, eix 看看几个绿色的稳定版,手工指定得了,
http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml?part=4&chap=1 embedded上的文章
$ time sudo crossdev --gcc 4.3.2-r3 --libc 2.8_p20080602-r1 --binutils 2.18-r3 --target armv4tl-softfloat-linux-gnueabi
------------------------------------------------------------------------------------------------------------------------------
* Host Portage ARCH: x86
* Target Portage ARCH: arm
* Target System: armv4tl-softfloat-linux-gnueabi
* Stage: 4 (C/C++ compiler)
* binutils: binutils-2.18-r3
* gcc: gcc-4.3.2-r3
* headers: linux-headers-[latest]
* libc: glibc-2.8_p20080602-r1
* PORTDIR_OVERLAY: /usr/local/portage/layman/gentoo-china
* PORT_LOGDIR: /var/log/portage
* PKGDIR: /usr/portage/packages/cross/armv4tl-softfloat-linux-gnueabi
* PORTAGE_TMPDIR: /var/tmp/cross/armv4tl-softfloat-linux-gnueabi
_ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ - ~ - _ -
* Using sys-libs/glibc from /usr/local/portage/myportage instead of /usr/portage
* Forcing the latest versions of {binutils,gcc}-config/gnuconfig... [ ok ]
* Log: /var/log/portage/cross-armv4tl-softfloat-linux-gnueabi-binutils.log
* Emerging cross-binutils... [ ok ]
* Log: /var/log/portage/cross-armv4tl-softfloat-linux-gnueabi-linux-headers-quick.log
* Emerging cross-linux-headers-quick... [ ok ]
* Log: /var/log/portage/cross-armv4tl-softfloat-linux-gnueabi-glibc-headers.log
* Emerging cross-glibc-headers... [ ok ]
* Log: /var/log/portage/cross-armv4tl-softfloat-linux-gnueabi-gcc-stage1.log
* Emerging cross-gcc-stage1... [ ok ]
* Log: /var/log/portage/cross-armv4tl-softfloat-linux-gnueabi-linux-headers.log
* Emerging cross-linux-headers... [ ok ]
* Log: /var/log/portage/cross-armv4tl-softfloat-linux-gnueabi-glibc.log
* Emerging cross-glibc... [ ok ]
* Log: /var/log/portage/cross-armv4tl-softfloat-linux-gnueabi-gcc-stage2.log
* Emerging cross-gcc-stage2... [ ok ]
real 37m34.769s
user 26m21.665s
sys 8m38.630s
emerge crossdev-wrappers
emerge-wrapper --init
emerge-armv4tl-softfloat-linux-gnueabi 软链接到
/usr/bin/emerge-armv4tl-softfloat-linux-gnueabi: symbolic link to `emerge-wrapper'
看了一下脚本,比embedded上的xmerge方便多了
emerge-armv4tl-softfloat-linux-gnueabi coreutils后
[axlrose@ibmgentoo bin] $ file sqlite3
sqlite3: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, stripped
[axlrose@ibmgentoo bin] $ pwd
/usr/armv4tl-softfloat-linux-gnueabi/usr/bin
这玩意挺不错的,继续折腾中, 看来空了要啃一下gentoo developer手册了
看看能不能在构建交叉目标镜像中使用 portage-utils, genlop , gentoolkit, eix ...
$ wgetpaste /usr/armv4tl-softfloat-linux-gnueabi/tmp/portage/sys-devel/gettext-0.17/temp/build.log
Your paste can be seen here: http://dpaste.com/10607/
$ wgetpaste /usr/armv4tl-softfloat-linux-gnueabi/tmp/portage/sys-devel/gettext-0.17/temp/environment
Your paste can be seen here: http://dpaste.com/10610
编译gettext 出错,找到点资料
http://www.nabble.com/compilation-of-findutils-4.4.0-with-gcc-4.4.0-20090225----error-with-wctype.h-in-gnulib-code-td22248846.html
/usr/libexec/gcc/armv4tl-softfloat-linux-gnueabi/ld: skipping incompatible /lib/libcrack.so when searching for /lib/libcrack.
so
/usr/libexec/gcc/armv4tl-softfloat-linux-gnueabi/ld: cannot find /lib/libcrack.so
collect2: ld returned 1 exit status
make[3]: *** [pam_cracklib.la] 错误 1
make[3]: Leaving directory `/usr/armv4tl-softfloat-linux-gnueabi/tmp/portage/sys-libs/pam-1.0.1/work/Linux-PAM-1.0.1/modules/
pam_cracklib'
make[2]: *** [all-recursive] 错误 1
make[2]: Leaving directory `/usr/armv4tl-softfloat-linux-gnueabi/tmp/portage/sys-libs/pam-1.0.1/work/Linux-PAM-1.0.1/modules'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/usr/armv4tl-softfloat-linux-gnueabi/tmp/portage/sys-libs/pam-1.0.1/work/Linux-PAM-1.0.1'
make: *** [all] 错误 2
-------------------------
竟然又遇到ld找不到so的问题,
/usr/libexec/gcc/armv4tl-softfloat-linux-gnueabi/ld: cannot find /lib/libcrack.so
CFLAGS="-Os -pipe ${MARCH_TUNE} -fomit-frame-pointer -I${ROOT}usr/include/ -I${ROOT}include/"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-L${ROOT}usr/lib -L${ROOT}lib"
还是没明白怎么回事,
$ sudo emerge-armv4tl-softfloat-linux-gnueabi --info
Portage 2.1.6.7 (!../../../usr/local/portage/layman/openmoko/trunk/openmoko-target/profiles/openmoko, gcc-4.3.2, unavailable, 2.6.28-tuxonice-r4 i686)
=================================================================
System uname: Linux-2.6.28-tuxonice-r4-i686-Intel-R-_Core-TM-2_Duo_CPU_T8300_@_2.40GHz-with-glibc2.0
Timestamp of tree: Sun, 08 Mar 2009 21:45:01 +0000
ccache version 2.4 [disabled]
app-shells/bash: 3.2_p48-r1
dev-java/java-config: 1.3.7-r1, 2.1.7
dev-lang/python: 2.5.4-r2
dev-python/pycrypto: 2.0.1-r8
dev-util/ccache: 2.4-r8
dev-util/cmake: 2.6.3
sys-apps/baselayout: 2.0.0
sys-apps/openrc: 0.4.3-r1
sys-apps/sandbox: 1.3.9
sys-devel/autoconf: 2.13, 2.63
sys-devel/automake: 1.4_p6, 1.5, 1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils: 2.19.1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool: 2.2.6a
virtual/os-headers: 2.6.28-r1
ACCEPT_KEYWORDS="arm"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-Os -pipe -march=armv4t -mtune=arm920t -fomit-frame-pointer -I/usr/armv4tl-softfloat-linux-gnueabi/usr/include/ -I/usr/armv4tl-softfloat-linux-gnueabi/include/"
CHOST="armv4tl-softfloat-linux-gnueabi"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/terminfo"
CXXFLAGS="-Os -pipe -march=armv4t -mtune=arm920t -fomit-frame-pointer -I/usr/armv4tl-softfloat-linux-gnueabi/usr/include/ -I/usr/armv4tl-softfloat-linux-gnueabi/include/"
DISTDIR="/usr/portage/distfiles"
FEATURES="buildpkg distlocks fixpackages nodoc noinfo noman parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="zh_CN.UTF-8"
LDFLAGS="-L/usr/armv4tl-softfloat-linux-gnueabi/usr/lib -L/usr/armv4tl-softfloat-linux-gnueabi/lib"
LINGUAS="en"
MAKEOPTS="-j3"
PKGDIR="/usr/armv4tl-softfloat-linux-gnueabi/packages/"
PORTAGE_CONFIGROOT="/usr/armv4tl-softfloat-linux-gnueabi/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/usr/armv4tl-softfloat-linux-gnueabi/tmp/"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/openmoko/trunk/openmoko-target /usr/local/portage/layman/gentoo-china /usr/local/portage/layman/lxde /usr/local/portage/myportage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="arm bindist cracklib iconv kdrive make-symlinks midi minimal multicall ncurses nls pam python readline sqlite ssl tslib unicode zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse touchscreen" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="fbdev glamo dummy"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
========================================
$ cat make.conf
CHOST=armv4tl-softfloat-linux-gnueabi
CBUILD=i686-pc-linux-gnu
ARCH=arm
HOSTCC=i686-pc-linux-gnu-gcc
E_MACHINE=EM_ARM
ROOT=/usr/${CHOST}/
#ACCEPT_KEYWORDS="arm ~arm"
ACCEPT_KEYWORDS="arm" #add ~arm here if you know what you do
USE="${ARCH} zlib bindist make-symlinks minimal \
input_devices_keyboard input_devices_evdev \
video_cards_fbdev video_cards_dummy"
USE="tslib nls unicode ${USE}"
USE="${USE} pam"
MARCH_TUNE="-march=armv4t -mtune=arm920t" #for openmoko
#MARCH_TUNE="-march=armv4t -mtune=arm9tdmi" #arm-softfloat-linux-uclibc
#MARCH_TUNE="-march=armv5t -mtune=xscale" #armv5teb-softfloat-linux-gnueabi
CFLAGS="-Os -pipe ${MARCH_TUNE} -fomit-frame-pointer -I${ROOT}usr/include/ -I${ROOT}include/"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-L${ROOT}usr/lib -L${ROOT}lib"
FEATURES="-collision-protect sandbox buildpkg noman noinfo nodoc"
# Be sure we dont overwrite pkgs from another repo..
PKGDIR=${ROOT}packages/
PORTAGE_TMPDIR=${ROOT}tmp/
CLEAN_DELAY=0
EPAUSE_IGNORE=1
EBEEP_IGNORE=1
PORTAGE_WORKDIR_MODE=2775
PORTAGE_ECLASS_WARNING_ENABLE=0
VIDEO_CARDS="fbdev glamo dummy"
INPUT_DEVICES="evdev keyboard mouse touchscreen"
USE_EXPAND="video_cards input_devices"
PKG_CONFIG_PATH="${ROOT}usr/lib/pkgconfig/"
#PORTDIR_OVERLAY="/usr/portage/local/"
UCLIBC_CPU_DEFAULT="GENERIC_ARM"
MAKEOPTS=-j3
PORTDIR_OVERLAY="/usr/local/portage/layman/openmoko/trunk/openmoko-target /usr/local/portage/layman/gentoo-china /usr/local/portage/layman/lxde /usr/local/portage/myportage"
#LINGUAS="zh_CN zh en"
LINGUAS="en"
=============================
怀疑是 sys-devel/libtool 影响
Remerge python and libtool to get the cross-compile fixes emerge -1 python libtool