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: unassig...@gcc.gnu.org
ReportedBy: kevin.t...@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?