diff mbox

libstdc++ configuration error, ct-ng v1.16.0

Message ID CAM=EW8by9g=0xyB=71PcZpYYv1JJeyhuurjTH8AT6Cu6JPrUig@mail.gmail.com
State Superseded
Headers show

Commit Message

David Holsgrove Oct. 4, 2012, 6:18 a.m. UTC
Hi Mike, All

On 2 September 2012 03:05, Michael Franklin <mfranklin@comfile.co.kr> wrote:
> Hello,
>
> I'm having trouble understanding an error I'm receiving in the 'Installing
> final compiler for build' stage.  It occurs when configuring libstdc++.  I'm
> hoping one of you swell folks would be willing to help me decipher it and
> maybe suggest a solution.  (See build log below)
>
> I'm trying a Canadian Cross, and here's my setup
> Build machine:  Linux Mint 64 (resident GCC)
> Host: x86_64-w64-mingw32 (mingw-w64 packages installed with Synaptic Package
> Manager)
> Target: arm-none-eabi
>
> I've installed just about all packages with mingw and w64 in the name, so I
> think I have all the necessary tools, headers, and libraries.  Also I've
> already built an arm-none-eabi Linux Mint compiler without any trouble
> (Thanks to the crosstools-ng community for making it so easy)
>
> It appears to me I'm missing some headers, but I think the headers just
> can't be found.  Maybe one of you can help me understand a little better.
>
> Thanks,
> Mike
>
>
> Here's out output from the build.log.
> **************************************************************************
[SNIP]
> [ERROR]    checking for the value of EOF... configure: error: computing EOF
> failed
> [ERROR]    make[1]: *** [configure-target-libstdc++-v3] Error 1

I recently ran into the same error, with a similar canadian cross
setup with a baremetal target.

I hacked / worked around it with the patch below - I'd be interested
to see if this is roughly the right approach, and if it's something we
can include in CT-NG?

thanks,
David


# HG changeset patch
# User David Holsgrove <david.holsgrove@xilinx.com>
# Date 1348552500 -36000
# Node ID 2df8f5a184b721e66a24db1aef61529691195393
# Parent  43ace4bb005eef085437e3d4fbaef528ef0ef005
scripts/gcc.sh: Add copyheaders section for baremetal canadian

Canadian Cross compile for baremetal fails with error;

  checking for the value of EOF... configure: error: computing EOF failed

which is due to libstdc++ configure not being able to find stdio.h

We can copy the required headers from the newlib source into the prefix
include directory - to ensure both the final compiler for build and final
compiler for host have access.

Signed-off-by: "David Holsgrove" <david.holsgrove@xilinx.com>

'static', 'shared' or 'baremetal', not '${mode:-(empty)}'"
@@ -221,8 +221,13 @@
     fi

     if [ "${copy_headers}" = "y" ]; then
-        CT_DoLog DEBUG "Copying headers to install area of bootstrap
gcc, so it can build libgcc2"
-        CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}"
"${prefix}/${CT_TARGET}/include"
+        if [ "${mode}" = "baremetal" ]; then
+            CT_DoLog DEBUG "Copying headers from newlib source to
install area of bootstrap gcc, so it can build libstdc++"
+            CT_DoExecLog ALL cp -a
"${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/newlib/libc/include/."
"${prefix}/${CT_TARGET}/include"
+        else
+            CT_DoLog DEBUG "Copying headers to install area of
bootstrap gcc, so it can build libgcc2"
+            CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}"
"${prefix}/${CT_TARGET}/include"
+        fi
     fi

     for tmp in ARCH ABI CPU TUNE FPU FLOAT; do

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

Comments

Yann E. MORIN Oct. 13, 2012, 4:21 p.m. UTC | #1
David, All,

On Thursday 04 October 2012 08:18:21 David Holsgrove wrote:
> # HG changeset patch
> # User David Holsgrove <david.holsgrove@xilinx.com>
> # Date 1348552500 -36000
> # Node ID 2df8f5a184b721e66a24db1aef61529691195393
> # Parent  43ace4bb005eef085437e3d4fbaef528ef0ef005
> scripts/gcc.sh: Add copyheaders section for baremetal canadian
[--SNIP--]
> @@ -221,8 +221,13 @@
>      fi
> 
>      if [ "${copy_headers}" = "y" ]; then
> -        CT_DoLog DEBUG "Copying headers to install area of bootstrap
> gcc, so it can build libgcc2"
> -        CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}"
> "${prefix}/${CT_TARGET}/include"
> +        if [ "${mode}" = "baremetal" ]; then
> +            CT_DoLog DEBUG "Copying headers from newlib source to
> install area of bootstrap gcc, so it can build libstdc++"
> +            CT_DoExecLog ALL cp -a
> "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/newlib/libc/include/."
> "${prefix}/${CT_TARGET}/include"
> +        else
> +            CT_DoLog DEBUG "Copying headers to install area of
> bootstrap gcc, so it can build libgcc2"
> +            CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}"
> "${prefix}/${CT_TARGET}/include"
> +        fi
>      fi
> 
>      for tmp in ARCH ABI CPU TUNE FPU FLOAT; do

Your mailer mangles the patches you send. I've been bitten by this when
trying to apply your canadian-multilib patch, and I missed half of it.

Regards,
Yann E. MORIN.
David Holsgrove Oct. 15, 2012, 1:39 a.m. UTC | #2
Yann, All,

On 14 October 2012 02:21, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> David, All,
>
> On Thursday 04 October 2012 08:18:21 David Holsgrove wrote:
>> # HG changeset patch
>> # User David Holsgrove <david.holsgrove@xilinx.com>
>> # Date 1348552500 -36000
>> # Node ID 2df8f5a184b721e66a24db1aef61529691195393
>> # Parent  43ace4bb005eef085437e3d4fbaef528ef0ef005
>> scripts/gcc.sh: Add copyheaders section for baremetal canadian
> [--SNIP--]
>> @@ -221,8 +221,13 @@
>>      fi
>>
>>      if [ "${copy_headers}" = "y" ]; then
>> -        CT_DoLog DEBUG "Copying headers to install area of bootstrap
>> gcc, so it can build libgcc2"
>> -        CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}"
>> "${prefix}/${CT_TARGET}/include"
>> +        if [ "${mode}" = "baremetal" ]; then
>> +            CT_DoLog DEBUG "Copying headers from newlib source to
>> install area of bootstrap gcc, so it can build libstdc++"
>> +            CT_DoExecLog ALL cp -a
>> "${CT_SRC_DIR}/newlib-${CT_LIBC_VERSION}/newlib/libc/include/."
>> "${prefix}/${CT_TARGET}/include"
>> +        else
>> +            CT_DoLog DEBUG "Copying headers to install area of
>> bootstrap gcc, so it can build libgcc2"
>> +            CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}"
>> "${prefix}/${CT_TARGET}/include"
>> +        fi
>>      fi
>>
>>      for tmp in ARCH ABI CPU TUNE FPU FLOAT; do
>
> Your mailer mangles the patches you send. I've been bitten by this when
> trying to apply your canadian-multilib patch, and I missed half of it.
>

Apologies Yann, I've attached the patch to this mail, hadnt realised
it was mangled.

thanks,
David

> Regards,
> Yann E. MORIN.
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
>
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
>
--
For unsubscribe information see http://sourceware.org/lists.html#faq
Yann E. MORIN Oct. 15, 2012, 4:50 p.m. UTC | #3
David, All,

On Monday 15 October 2012 David Holsgrove wrote:
> On 14 October 2012 02:21, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > On Thursday 04 October 2012 08:18:21 David Holsgrove wrote:
> >> # HG changeset patch
> >> # User David Holsgrove <david.holsgrove@xilinx.com>
> >> # Date 1348552500 -36000
> >> # Node ID 2df8f5a184b721e66a24db1aef61529691195393
> >> # Parent  43ace4bb005eef085437e3d4fbaef528ef0ef005
> >> scripts/gcc.sh: Add copyheaders section for baremetal canadian
> > [--SNIP--]
> > Your mailer mangles the patches you send. I've been bitten by this when
> > trying to apply your canadian-multilib patch, and I missed half of it.
> 
> Apologies Yann, I've attached the patch to this mail, hadnt realised
> it was mangled.

No problem, I've already fixed it here.

However, I'm not too fond of a component (here, gcc) having to deal with
the internals of another compoent (here, newlib), so I'm pondering another
change to fix this:
  - have newlib install its headers in libc_start_files, as the other C
    libraries do;
  - always copy the headers;
  - get rid of ${copy_headers} altogether.

What do you think about this?

Regards,
Yann E. MORIN.
David Holsgrove Oct. 16, 2012, 4:48 a.m. UTC | #4
Hi Yann,

[--SNIP--]
>> Apologies Yann, I've attached the patch to this mail, hadnt realised
>> it was mangled.
>
> No problem, I've already fixed it here.
>
> However, I'm not too fond of a component (here, gcc) having to deal with
> the internals of another compoent (here, newlib), so I'm pondering another
> change to fix this:
>   - have newlib install its headers in libc_start_files, as the other C
>     libraries do;
>   - always copy the headers;
>   - get rid of ${copy_headers} altogether.
>
> What do you think about this?

Sounds good to me - adding a copy of the newlib headers inside gcc.sh
was a quick way to test this but I agree it should match the behaviour
of other libc components.

I've attached two patches, one for newlib which adds a copy of the
headers in its libc_start_files stage, and a second patch for gcc
which removes the ${copyheaders} toggle and instead always does the
copy in do_cc_core_backend.

thanks again,
David

>
> Regards,
> Yann E. MORIN.
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
>
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
>
--
For unsubscribe information see http://sourceware.org/lists.html#faq
diff mbox

Patch

diff -r 43ace4bb005e -r 2df8f5a184b7 scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/build/cc/gcc.sh	Tue Sep 25 15:55:00 2012 +1000
@@ -207,7 +207,7 @@ 
             extra_config+=("--with-newlib")
             extra_config+=("--enable-threads=no")
             extra_config+=("--disable-shared")
-            copy_headers=n
+            copy_headers=y
             ;;
         *)
             CT_Abort "Internal Error: 'mode' must be one of: