public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kevin.tian at intel dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/47256] New: "--sysroot" option is not passed to COLLECT_GCC_OPTIONS
Date: Tue, 11 Jan 2011 09:12:00 -0000	[thread overview]
Message-ID: <bug-47256-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47256

           Summary: "--sysroot" option is not passed to
                    COLLECT_GCC_OPTIONS
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kevin.tian@intel.com


I found that "--sysroot" option is not passed to COLLECT_GCC_OPTIONS:

$ echo '' | mips-poky-linux-g++ -v -E
--sysroot=/home/lulianhao/poky-build/mips/rootfs - 2>&1 | grep -E
'^(COLLECT_GCC_OPTIONS|gcc)'
gcc version 4.5.1 (GCC)
COLLECT_GCC_OPTIONS='-v' '-E' '-shared-libgcc' '-mllsc' '-mno-synci'
'-mno-shared'
COLLECT_GCC_OPTIONS='-v' '-E' '-shared-libgcc' '-mllsc' '-mno-synci'
'-mno-shared'

"-isysroot" does be passed which however is only for headers:

$echo '' | mips-poky-linux-g++ -v -E -isysroot
/home/lulianhao/poky-build/mips/rootfs - 2>&1 | grep -E
'^(COLLECT_GCC_OPTIONS|gcc)'
COLLECT_GCC_OPTIONS='-v' '-E' '-isysroot'
'/home/lulianhao/poky-build/mips/rootfs' '-shared-libgcc' '-mllsc' '-mno-synci'
'-mno-shared'
COLLECT_GCC_OPTIONS='-v' '-E' '-isysroot'
'/home/lulianhao/poky-build/mips/rootfs' '-shared-libgcc' '-mllsc' '-mno-synci'
'-mno-shared'

This brings trouble to our cross-toolchain usage. We generate a cross gcc
compiler, which has a default sysroot configured by "with-sysroot" when
building that cross gcc:
  * Simple usage: When users want to use our cross-toolchain for app
development, they have to extract the sysroot to the default path such as
"/opt/poky/". 
  * flexible usage: we want to relax the position of the sysroot, and thus use
a wrapper script to add a "--sysroot" option to cross gcc which is required to
run before app compilation. This then allows users to install their sysroots
any places.

It generatelly works for all C applications, but then face trouble with C++
projects which use templates and "-frepo". In latter case, collect2 triggers
recompilation to some .cpp files when there's requirement, and then the problem
comes: "--sysroot" is not passed to COLLECT_GCC_OPTIONS, and thus the
recompilation simply fails.

I checked 4.5.1 code, which does't save "--sysroot" to saved switches. Similar
issue may still exists in trunk, of which do_save flag is "false" for
OPTION__sysroot_.

So is there any rationale behind why "--sysroot" is not passed to collect2?


             reply	other threads:[~2011-01-11  7:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-11  9:12 kevin.tian at intel dot com [this message]
2011-01-20  8:54 ` [Bug c++/47256] " kevin.tian at intel dot com
2011-03-16  3:15 ` lianhao.lu at intel dot com
2011-10-10 16:32 ` paolo.carlini at oracle dot com
2021-11-25  3:48 ` pinskia at gcc dot gnu.org
2021-11-25 15:25 ` richard.purdie at linuxfoundation dot org

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=bug-47256-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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 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).