public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
From: Per Arnold Blaasmo <per-arnold.blaasmo@atmel.com>
To: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: <crossgcc@sourceware.org>
Subject: Re: Canadian build and CT_TARGET fails
Date: Fri, 03 Aug 2012 06:38:00 -0000	[thread overview]
Message-ID: <501B71C4.8000406@atmel.com> (raw)
In-Reply-To: <501B6BA1.5050504@atmel.com>

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

On 03. aug. 2012 08:11, Per Arnold Blaasmo wrote:
> On 03. aug. 2012 00:20, Yann E. MORIN wrote:
>> Per-Arnold, All,
>>
>> On Thursday 02 August 2012 10:29:56 Per Arnold Blaasmo wrote:
>> [--SNIP--]
>>>>> I found for GCC in gcc/Makefile.in these lines that seems to cause the
>>>>> error:
>>>>>
>>>>>> # Dump a specs file to make -B./ read these specs over installed ones.
>>>>>> $(SPECS): xgcc$(exeext)
>>>>>>         $(GCC_FOR_TARGET) -dumpspecs > tmp-specs
>>>>>>         mv tmp-specs $(SPECS)
>>>>>
>>>>> It uses GCC_FOR _TARGET. Which is set to 'arm-non-eabi', but since we do
>>>>> not have that one ready yet at this point it will fail unless you have
>>>>> it in your path prebuilt.
>>
>> OK, now crosstool-NG always builds the core pass-1 core compiler.
>> I've oushed the changeset to the repos, now. Care to give it a whirl?
>>
>> I'll probably do the release to morrow evening (which is a 3-day delay from
>> the planned schedule. Shit happens, big deal).
>>
>> Thanks for the report and the digging! :-)
>>
>> Regards,
>> Yann E. MORIN.
>>
> Hi,
> I had to make more changes to make it work al the way trough..
> After the changes I made in gcc.sh I also had to make changes to the
> libc (newlib.sh) build and add do_libc_for_build() and do_libc_for_host().
> 
> I will make a patch set in the next hour so that you can see.
> I will upload it here.
> 
> Regards
> Per A.
> 
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
> 
> 
> 
Here is the patch I made yesterday to get to build to work with the
attached config file.

It is Building a toolchain for:
      build  = x86_64-unknown-linux-gnu
      host   = i686-pc-mingw32
      target = arm-none-eabi
with MULTILIB enabled.

Please see trough it and see if it is OK.
I have not tested it on other configs yet.

I will do some more testing today.

NB! this patch do not include the last changes you did yesterday (3
commits I think).

Regards
Per A.

[-- Attachment #2: .config --]
[-- Type: application/x-config, Size: 9447 bytes --]

[-- Attachment #3: ct-ng-atmel-canadian-patch.diff --]
[-- Type: text/x-patch, Size: 7771 bytes --]

# HG changeset patch
# User pablaasmo
# Date 1343974985 -7200
# Branch crosstool-ng-atmel
# Node ID 83eb78ed9d01dc2322f5b6f20730a91850e123f6
# Parent  9bf1030384c048073fd8dbb330ec1135e30451d0
gcc.sh: changed handling of CANADIAN build so that correct compiler is used when building compiler for build.
<libc>.sh: added functions do_libc_for_build and dor_libc_for_host so that building newlib works in CANADIAN builds.
steps.mk: removed step libc, and replaced with libc_for_build and libc_for host

diff -r 9bf1030384c0 -r 83eb78ed9d01 scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh	Thu Aug 02 14:36:01 2012 +0200
+++ b/scripts/build/cc/gcc.sh	Fri Aug 03 08:23:05 2012 +0200
@@ -420,8 +420,13 @@
         # compilers for canadian build and use the defaults on other
         # configurations.
         if [ "${CT_BARE_METAL},${CT_CANADIAN}" = "y,y" ]; then
-            repair_cc="CC_FOR_BUILD=${CT_BUILD}-gcc \
+            # If we are building the core C compiler it should be on native platform
+            if [ "${host}" = "${CT_BUILD}" ]; then
+            	repair_cc="CC_FOR_BUILD=${CT_BUILD}-gcc"
+            else
+            	repair_cc="CC_FOR_BUILD=${CT_BUILD}-gcc \
                        GCC_FOR_TARGET=${CT_TARGET}-gcc"
+            fi
         else
             repair_cc=""
         fi
@@ -459,8 +464,15 @@
     CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}"
 
     if [ "${CT_MULTILIB}" = "y" ]; then
-        multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib   \
-                       |tail -n +2 ) )
+    	if [ "${CT_CANADIAN}" = "y" ] && [ "${host}" != "${CT_BUILD}" ]; then
+            # If we do CANADIAN build and are building the host C compiler  
+            # we should use build platforms executables
+            multilibs=( $( "${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-gcc" -print-multi-lib   \
+                           |tail -n +2 ) )
+	 	else
+            multilibs=( $( "${prefix}/bin/${CT_TARGET}-gcc" -print-multi-lib   \
+                           |tail -n +2 ) )
+        fi
         if [ ${#multilibs[@]} -ne 0 ]; then
             CT_DoLog EXTRA "gcc configured with these multilibs (besides the default):"
             for i in "${multilibs[@]}"; do
@@ -540,6 +552,14 @@
         final_backend=do_cc_backend
     fi
 
+	# We can not use system zlib from build on host when
+	# doing a CANADIAN build unless we also build it first
+	# for the host.
+    if [ "${CT_CANADIAN}" = "y" ]; then
+	CT_DoStep INFO "Unsetting CT_CC_GCC_SYSTEM_ZLIB"
+        unset CT_CC_GCC_SYSTEM_ZLIB
+    fi
+    
     CT_DoStep INFO "Installing final compiler"
     CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-final"
 
diff -r 9bf1030384c0 -r 83eb78ed9d01 scripts/build/libc/glibc-eglibc.sh-common
--- a/scripts/build/libc/glibc-eglibc.sh-common	Thu Aug 02 14:36:01 2012 +0200
+++ b/scripts/build/libc/glibc-eglibc.sh-common	Fri Aug 03 08:23:05 2012 +0200
@@ -60,6 +60,20 @@
     do_libc_backend libc_mode=startfiles
 }
 
+# Builds a libc for the build platform
+do_libc_for_build {
+	# Not really necessary here but for compatibility 
+	# with the api of other c-lib scripts 
+	:
+}
+
+# Builds a libc for the host platform
+do_libc_for_host {
+	# Not really necessary here but for compatibility 
+	# with the api of other c-lib scripts 
+	do_libc
+}
+
 # This function builds and install the full C library
 do_libc() {
     do_libc_backend libc_mode=final
diff -r 9bf1030384c0 -r 83eb78ed9d01 scripts/build/libc/mingw.sh
--- a/scripts/build/libc/mingw.sh	Thu Aug 02 14:36:01 2012 +0200
+++ b/scripts/build/libc/mingw.sh	Fri Aug 03 08:23:05 2012 +0200
@@ -53,6 +53,20 @@
     CT_EndStep
 }
 
+# Builds a libc for the build platform
+do_libc_for_build {
+	# Not really necessary here but for compatibility 
+	# with the api of other c-lib scripts 
+	:
+}
+
+# Builds a libc for the host platform
+do_libc_for_host {
+	# Not really necessary here but for compatibility 
+	# with the api of other c-lib scripts 
+	do_libc
+}
+
 do_libc() {
     CT_DoStep INFO "Building MinGW files"
 
diff -r 9bf1030384c0 -r 83eb78ed9d01 scripts/build/libc/newlib.sh
--- a/scripts/build/libc/newlib.sh	Thu Aug 02 14:36:01 2012 +0200
+++ b/scripts/build/libc/newlib.sh	Fri Aug 03 08:23:05 2012 +0200
@@ -52,14 +52,57 @@
     :
 }
 
+do_libc_for_build() {
+    local -a build_final_opts
+    local build_final_backend
+    
+    # In case we're canadian or cross-native, it seems that a
+    # real, complete compiler is needed?!? WTF? Sigh...
+    # Otherwise, there is nothing to do.
+    case "${CT_TOOLCHAIN_TYPE}" in
+        native|cross)   return 0;;
+    esac
+
+    build_final_opts+=( "host=${CT_BUILD}" )
+    build_final_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+
+    CT_DoStep INFO "Installing C library for build"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-build"
+
+    do_libc "${build_final_opts[@]}"
+ 
+    CT_Popd
+    CT_EndStep
+}
+
+do_libc_for_host() {
+    local -a build_final_opts
+    local build_final_backend
+    
+    final_opts+=( "host=${CT_HOST}" )
+    final_opts+=( "prefix=${CT_PREFIX_DIR}" )
+
+    CT_DoStep INFO "Installing C library for host"
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-libc-final"
+
+    do_libc "${final_opts[@]}"
+ 
+    CT_Popd
+    CT_EndStep
+}
+
 do_libc() {
     local -a newlib_opts
+    local host
+    local prefix
+    local arg
+
+    for arg in "$@"; do
+        eval "${arg// /\\ }"
+    done
 
     CT_DoStep INFO "Installing C library"
 
-    mkdir -p "${CT_BUILD_DIR}/build-libc"
-    cd "${CT_BUILD_DIR}/build-libc"
-
     CT_DoLog EXTRA "Configuring C library"
 
     if [ "${CT_LIBC_NEWLIB_IO_C99FMT}" = "y" ]; then
@@ -102,9 +145,9 @@
     AR=${CT_TARGET}-ar                                  \
     RANLIB=${CT_TARGET}-ranlib                          \
     "${CT_SRC_DIR}/newlib-$(libc_newlib_version)/configure" \
-        --host=${CT_BUILD}                              \
+		--host=${host}                                  \
         --target=${CT_TARGET}                           \
-        --prefix=${CT_PREFIX_DIR}                       \
+		--prefix=${prefix}                              \
         "${newlib_opts[@]}"                             \
         "${CT_LIBC_NEWLIB_EXTRA_CONFIG_ARRAY[@]}"
 
diff -r 9bf1030384c0 -r 83eb78ed9d01 scripts/build/libc/none.sh
--- a/scripts/build/libc/none.sh	Thu Aug 02 14:36:01 2012 +0200
+++ b/scripts/build/libc/none.sh	Fri Aug 03 08:23:05 2012 +0200
@@ -18,6 +18,14 @@
     :
 }
 
+do_libc_for_build() {
+	:
+}
+
+do_libc_for_host() {
+	:
+}
+
 do_libc() {
     :
 }
diff -r 9bf1030384c0 -r 83eb78ed9d01 scripts/build/libc/uClibc.sh
--- a/scripts/build/libc/uClibc.sh	Thu Aug 02 14:36:01 2012 +0200
+++ b/scripts/build/libc/uClibc.sh	Fri Aug 03 08:23:05 2012 +0200
@@ -154,6 +154,20 @@
     CT_EndStep
 }
 
+# Builds a libc for the build platform
+do_libc_for_build {
+	# Not really necessary here but for compatibility 
+	# with the api of other c-lib scripts 
+	:
+}
+
+# Builds a libc for the host platform
+do_libc_for_host {
+	# Not really necessary here but for compatibility 
+	# with the api of other c-lib scripts 
+	do_libc
+}
+
 # This function build and install the full uClibc
 do_libc() {
     CT_DoStep INFO "Installing C library"
diff -r 9bf1030384c0 -r 83eb78ed9d01 steps.mk
--- a/steps.mk	Thu Aug 02 14:36:01 2012 +0200
+++ b/steps.mk	Fri Aug 03 08:23:05 2012 +0200
@@ -40,8 +40,9 @@
             kernel_headers      \
             libc_start_files    \
             cc_core_pass_2      \
-            libc                \
+            libc_for_build      \
             cc_for_build        \
+            libc_for_host       \
             cc_for_host         \
             libc_finish         \
             libelf_for_target   \


[-- Attachment #4: Type: text/plain, Size: 71 bytes --]

--
For unsubscribe information see http://sourceware.org/lists.html#faq

  reply	other threads:[~2012-08-03  6:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01  6:31 Per Arnold Blaasmo
2012-08-01  6:40 ` Yann E. MORIN
2012-08-01  6:41   ` Per Arnold Blaasmo
2012-08-01 14:11     ` Per Arnold Blaasmo
2012-08-01 17:14       ` Yann E. MORIN
2012-08-02  8:30         ` Per Arnold Blaasmo
2012-08-02 22:21           ` Yann E. MORIN
2012-08-03  6:12             ` Per Arnold Blaasmo
2012-08-03  6:38               ` Per Arnold Blaasmo [this message]
2012-08-03 20:58                 ` Yann E. MORIN
2012-08-04 21:47                   ` Yann E. MORIN

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=501B71C4.8000406@atmel.com \
    --to=per-arnold.blaasmo@atmel.com \
    --cc=crossgcc@sourceware.org \
    --cc=yann.morin.1998@free.fr \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).