All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3/9] Add support for multilib external toolchains
Date: Sat, 18 Oct 2008 01:40:24 +0900	[thread overview]
Message-ID: <48F8BFF8.2050509@ruby.dti.ne.jp> (raw)
In-Reply-To: <20081016203230.15826.93873.stgit@localhost.localdomain>

Hi Grant,

Grant Likely wrote:
> However, buildroot needs copy the correct version of the libraries to
> match the flags used to compile the applications.

Right.  External toolchain + Multilib support has been one of buildroot
problems.  I also have some hacks on this , but could not make it into
good shape.

I gave it a try, and it works fine; appropriate libraries are copied to
rootfs.  Here's a log with MIPS toolchain (Sourcery G++ Lite):

----------------------------------------------------------------
mkdir -p /home/skuribay/devel/buildroot/project_build_mips/uclibc/root/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libc.so.0 dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libuClibc-0.9.29.so dst=/lib
for libs in ld-uClibc.so.0 libcrypt.so.0 libdl.so.0 libgcc_s.so libm.so.0 libnsl.so.0 libpthread.so.0 libresolv.so.0 librt.so.0 libutil.so.0; do \
                LIB="$libs"; DST="/lib"; STRIP="y"; LIB_DIR=`/opt/codesourcery/mips-4.2/bin/mips-linux-gnu-gcc -Os -pipe -muclibc -msoft-float -print-file-name=${LIB} | sed -e "s,/${LIB}\$,,"`; MULTILIB=`/opt/codesourcery/mips-4.2/bin/mips-linux-gnu-gcc -Os -pipe -muclibc -msoft-float -print-multi-directory`; if test -z "${LIB_DIR}"; then echo "copy_toolchain_lib_root: lib=${LIB} not found"; exit -1; fi; LIB="$libs"; for FILE in `find ${LIB_DIR} -maxdepth 1 -type l -name "${LIB}*"`; do LIB=`basename ${FILE}`; while test \! -z "${LIB}"; do echo "copy_toolchain_lib_root multilib=${MULTILIB} lib=${LIB} dst=${DST}"; rm -fr /home/skuribay/devel/buildroot/project_build_mips/uclibc/root${DST}/${LIB}; mkdir -p /home/skuribay/devel/buildroot/project_build_mips/uclibc/root${DST}; if test -h ${LIB_DIR}/${LIB}; then cp -d ${LIB_DIR}/${LIB} /home/skuribay/devel/buildroot/project_build_mips/uclibc/root${DST}/; elif test -f ${LIB_DIR}/${LIB}; then cp ${LIB_DIR}/${LIB} /home/skuribay/devel/b
uildroot/project_build_mips/uclibc/root${DST}/${LIB}; case "${STRIP}" in (0 | n | no) ;; (*) /opt/codesourcery/mips-4.2/bin/mips-linux-gnu-strip "/home/skuribay/devel/buildroot/project_build_mips/uclibc/root${DST}/${LIB}"; ;; esac; else exit -1; fi; LIB="`readlink ${LIB_DIR}/${LIB}`"; done; done; echo -n; \
        done
copy_toolchain_lib_root multilib=uclibc/soft-float lib=ld-uClibc.so.0 dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=ld-uClibc-0.9.29.so dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libcrypt.so.0 dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libcrypt-0.9.29.so dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libdl.so.0 dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libdl-0.9.29.so dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libgcc_s.so dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libgcc_s.so.1 dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libm.so.0 dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libm-0.9.29.so dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libnsl.so.0 dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libnsl-0.9.29.so dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libpthread.so.0 dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libpthread-0.9.29.so dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libresolv.so.0 dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libresolv-0.9.29.so dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=librt.so.0 dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=librt-0.9.29.so dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libutil.so.0 dst=/lib
copy_toolchain_lib_root multilib=uclibc/soft-float lib=libutil-0.9.29.so dst=/lib
*** Using kernel-headers generated from kernel source
rm -rf /home/skuribay/devel/buildroot/toolchain_build_mips/linux
[ -d /home/skuribay/devel/buildroot/toolchain_build_mips ] || /usr/bin/install -d /home/skuribay/devel/buildroot/toolchain_build_mips
bzcat /home/skuribay/devel/buildroot/dl/linux-2.6.27.tar.bz2 | tar -C /home/skuribay/devel/buildroot/toolchain_build_mips   -xf -
make: *** [/home/skuribay/devel/buildroot/toolchain_build_mips/linux-2.6.27/.unpacked] Interrupt

skuribay at ubuntu:~/devel/buildroot$ 
skuribay at ubuntu:~/devel/buildroot$ mips-linux-gnu-gcc --version
mips-linux-gnu-gcc (Sourcery G++ Lite 4.2-177) 4.2.3
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

skuribay at ubuntu:~/devel/buildroot$ 
----------------------------------------------------------------

So, ack.

Acked-by: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>

> diff --git a/toolchain/external-toolchain/ext-tool.mk b/toolchain/external-toolchain/ext-tool.mk
> index bbf430c..ba10dc7 100644
> --- a/toolchain/external-toolchain/ext-tool.mk
> +++ b/toolchain/external-toolchain/ext-tool.mk
> @@ -10,7 +10,8 @@ copy_toolchain_lib_root = \
>  	DST="$(strip $2)"; \
>  	STRIP="$(strip $3)"; \
>   \
> -	LIB_DIR=`$(TARGET_CC) -print-file-name=$${LIB} | sed -e "s,/$${LIB}\$$,,"`; \
> +	LIB_DIR=`$(TARGET_CC) $(subst ",,$(BR2_TARGET_OPTIMIZATION)) -print-file-name=$${LIB} | sed -e "s,/$${LIB}\$$,,"`; \
> +	MULTILIB=`$(TARGET_CC) $(subst ",,$(BR2_TARGET_OPTIMIZATION)) -print-multi-directory`; \

By the way,
I have to mention about one more known problem.  External toolchain +
Software-floating-point-option also doesn't work.  So, we have to give
`-msoft-float' option to $(BR2_TARGET_OPTIMIZATION) directly.

The curprit is package/Makefile.in.  $(BR2_SOFT_FLOAT) is only effective
when buildroot toolchain is selected.  This is not soft-float-point only
issue, but also applied to other remaining menu-options of external
toolchain.  Nothing is handled with external toolchains as below:

(package/Makefile.in)-------------------------------------------
# else it's an external toolchain
#########################################################################
else
TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) -I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include -I$(TOOLCHAIN_EXTERNAL_PATH)/$(TOOLCHAIN_EXTERNAL_PREFIX)/include
TARGET_CXXFLAGS=$(TARGET_CFLAGS)
TARGET_LDFLAGS=-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib
endif
#########################################################################
----------------------------------------------------------------

If someone has some patches on this, we'd like to see them.

Thanks,

  Shinya

  reply	other threads:[~2008-10-17 16:40 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-16 20:32 [Buildroot] [PATCH 1/9] Typo fix in toolchain/external-toolchain/ext-tool.mk Grant Likely
2008-10-16 20:32 ` [Buildroot] [PATCH 2/9] Fix link flags of mtdutils Grant Likely
2008-10-16 20:51   ` Thomas Petazzoni
2008-10-16 21:15     ` hartleys
2008-10-16 21:22       ` Bernhard Reutner-Fischer
2008-10-16 21:38       ` Thomas Petazzoni
2008-10-16 21:47         ` Thomas Petazzoni
2008-10-16 20:32 ` [Buildroot] [PATCH 3/9] Add support for multilib external toolchains Grant Likely
2008-10-17 16:40   ` Shinya Kuribayashi [this message]
2010-01-12 11:06   ` Thomas Petazzoni
2010-01-12 19:15     ` Grant Likely
2008-10-16 20:32 ` [Buildroot] [PATCH 4/9] Add Xilinx UARTLITE and MPC5200 PSC device files (serial ports) Grant Likely
2008-10-17 10:24   ` Peter Korsgaard
2008-10-16 20:32 ` [Buildroot] [PATCH 5/9] Refactor invocation of make for kernel compiles Grant Likely
2008-10-16 21:55   ` Markus Heidelberg
2008-10-16 23:03     ` Grant Likely
2008-10-16 20:32 ` [Buildroot] [PATCH 6/9] Ask the kernel source where it will install modules Grant Likely
2008-10-30  9:52   ` [Buildroot] [PATCH 6/9] Ask the kernel source where it will installmodules Hans-Christian Egtvedt
2008-10-30 11:57     ` Hans-Christian Egtvedt
2008-10-30 13:20   ` [Buildroot] [PATCH 6/9] Ask the kernel source where it will install modules Thomas Petazzoni
2008-10-30 13:23     ` Grant Likely
2008-10-30 13:44       ` Thomas Petazzoni
2008-10-30 13:27     ` Hans-Christian Egtvedt
2008-10-30 14:04     ` Hans-Christian Egtvedt
2008-10-16 20:32 ` [Buildroot] [PATCH 7/9] Add last resort setting of $(LINUX26_BINLOC) for kernel image filename Grant Likely
2008-10-16 20:32 ` [Buildroot] [PATCH 8/9] RFC: Remove HOSTCFLAGS from kernel compile Grant Likely
2008-10-16 21:09   ` Bernhard Reutner-Fischer
2008-10-16 23:11     ` Grant Likely
2008-10-16 20:33 ` [Buildroot] [PATCH 9/9] Add support for cloning Linux git trees Grant Likely
2008-10-16 21:14   ` Bernhard Reutner-Fischer
2008-10-16 23:09     ` Grant Likely
2008-10-17  7:38       ` Bernhard Reutner-Fischer
2008-10-17 10:20 ` [Buildroot] [PATCH 1/9] Typo fix in toolchain/external-toolchain/ext-tool.mk Peter Korsgaard

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=48F8BFF8.2050509@ruby.dti.ne.jp \
    --to=skuribay@ruby.dti.ne.jp \
    --cc=buildroot@busybox.net \
    /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.