Hi,
I am new to LFS. During chapter 5 GCC pass 2 I stumbled across the
following issue:
Building with the instructions from the book just worked, but I thought
instead of specifying all programs on the command line, configuring
binutils pass 2 and gcc pass 2 with
--target=$LFS_TGT --host=$LFS_TGT --build=$([...]/config.guess)
could be a good idea as gcc pass 1 is a cross compiler. Indeed, this did
the expected changes in the Makefile, but ...
GCC (more precisely libstdc++-v3) failed to compile.
-- Output --------------------------------------------------------------
[...]
Checking multilib configuration for libstdc++-v3...
mkdir -p -- x86_64-source-linux/libstdc++-v3
Configuring in x86_64-source-linux/libstdc++-v3
configure: creating cache ./config.cache
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-source-linux-gnu
checking target system type... x86_64-source-linux-gnu
configure: x86_64-unknown-linux-gnu / x86_64-source-linux-gnu /
x86_64-source-linux-gnu / x86_64-source-linux / x86_64-source-linux
[...]
checking how to run the C++ preprocessor... /lib/cpp
checking whether the x86_64-source-linux-c++ linker
(x86_64-source-linux-ld -m elf_x86_64) supports shared libraries... yes
libtool.m4: error: problem compiling CXX test program
checking for x86_64-source-linux-c++ option to produce PIC... -DPIC
checking if x86_64-source-linux-c++ PIC flag -DPIC works... no
checking if x86_64-source-linux-c++ static flag works... no
checking if x86_64-source-linux-c++ supports -c -o file.o... no
checking if x86_64-source-linux-c++ supports -c -o file.o...
(cached) no
checking whether the x86_64-source-linux-c++ linker
(x86_64-source-linux-ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... unsupported
checking for exception model to use... configure: error: unable to
detect exception model
make[1]: *** [configure-target-libstdc++-v3] Error 1
make[1]: Leaving directory `/mnt/source/usr/src/gcc-4.7.2-build'
make: *** [all] Error 2
------------------------------------------------------------------------
-- config.log ----------------------------------------------------------
[...]
configure:14935: checking for exception model to use
configure:14976: x86_64-source-linux-c++ -c -S conftest.cpp >&5
/mnt/source/usr/src/gcc-4.7.2/libstdc++-v3/configure: line 14977:
x86_64-source-linux-c++: command not found
[...]
------------------------------------------------------------------------
This shows that libstdc++-v3 needs a C++ compiler, which obviously
cannot be found in this case. I assume that when using the book
instructions the C++ compiler of the host system is used, but wouldn't
that defeat the goal of leaving the host system?
I actually wanted to use these configure switches (maybe this is just
personal preference) and ensure that no host compiler is used at this
point. After I already solved this, I found the following thread on a
related topic.
http://thread.gmane.org/gmane.linux.lfs.devel/13574
It explains two possible ways of building GCC with C++. Because both
methods have a few drawbacks, I thought of posting my solution, too.
This solution involves a bit more compile time, but I think it is a
fairly clean way of leaving the host system behind.
1. Binutils pass 1, GCC pass 1, Linux headers and Glibc are built as
instructed in the book.
2. A second cross GCC is built this time with C++ enabled, linking
already against the new Glibc.
3. Binutils and GCC are built both with the --target,--host,--build
configure switches (obsoleting the environment variables and
--disable-bootstrap).
This worked quite well for me until the end of chapter 6 (all I did up
to now).
Just wanted to let you know of this possible (probably harmless)
contamination of the toolchain through the C++ compiler of the host.
Best regards,
Maurice
PS: appended is a patch for the broken .texi files.
diff -urN gcc-4.7.2.orig/gcc/doc/cppopts.texi gcc-4.7.2/gcc/doc/cppopts.texi
--- gcc-4.7.2.orig/gcc/doc/cppopts.texi 2011-12-20 21:44:13.000000000 +0100
+++ gcc-4.7.2/gcc/doc/cppopts.texi 2013-03-04 01:51:41.030051618 +0100
@@ -803,7 +803,7 @@
Enable special code to work around file systems which only permit very
short file names, such as MS-DOS@.
-@itemx --help
+@item --help
@itemx --target-help
@opindex help
@opindex target-help
diff -urN gcc-4.7.2.orig/gcc/doc/extend.texi gcc-4.7.2/gcc/doc/extend.texi
--- gcc-4.7.2.orig/gcc/doc/extend.texi 2012-05-30 16:51:54.000000000 +0200
+++ gcc-4.7.2/gcc/doc/extend.texi 2013-03-04 01:57:10.260048816 +0100
@@ -1251,10 +1251,10 @@
instruction. Pointers to this address space are 16 bits wide.
@item __flash1
-@item __flash2
-@item __flash3
-@item __flash4
-@item __flash5
+@itemx __flash2
+@itemx __flash3
+@itemx __flash4
+@itemx __flash5
@cindex @code{__flash1} AVR Named Address Spaces
@cindex @code{__flash2} AVR Named Address Spaces
@cindex @code{__flash3} AVR Named Address Spaces
diff -urN gcc-4.7.2.orig/gcc/doc/generic.texi gcc-4.7.2/gcc/doc/generic.texi
--- gcc-4.7.2.orig/gcc/doc/generic.texi 2011-12-23 23:07:16.000000000 +0100
+++ gcc-4.7.2/gcc/doc/generic.texi 2013-03-04 01:58:31.540048128 +0100
@@ -1415,13 +1415,13 @@
not matter. The type of the operands and that of the result are
always of @code{BOOLEAN_TYPE} or @code{INTEGER_TYPE}.
-@itemx POINTER_PLUS_EXPR
+@item POINTER_PLUS_EXPR
This node represents pointer arithmetic. The first operand is always
a pointer/reference type. The second operand is always an unsigned
integer type compatible with sizetype. This is the only binary
arithmetic operand that can operate on pointer types.
-@itemx PLUS_EXPR
+@item PLUS_EXPR
@itemx MINUS_EXPR
@itemx MULT_EXPR
These nodes represent various binary arithmetic operations.
diff -urN gcc-4.7.2.orig/gcc/doc/invoke.texi gcc-4.7.2/gcc/doc/invoke.texi
--- gcc-4.7.2.orig/gcc/doc/invoke.texi 2012-09-14 22:45:27.000000000 +0200
+++ gcc-4.7.2/gcc/doc/invoke.texi 2013-03-04 02:37:39.980028151 +0100
@@ -1592,7 +1592,7 @@
this will become the default. The name @samp{gnu9x} is deprecated.
@item gnu11
-@item gnu1x
+@itemx gnu1x
GNU dialect of ISO C11. Support is incomplete and experimental. The
name @samp{gnu1x} is deprecated.
@@ -5179,7 +5179,7 @@
e.g. With -fdbg-cnt=dce:10,tail_call:0
dbg_cnt(dce) will return true only for first 10 invocations
-@itemx -fenable-@var{kind}-@var{pass}
+@item -fenable-@var{kind}-@var{pass}
@itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
@opindex fdisable-
@opindex fenable-
@@ -5327,11 +5327,11 @@
@option{-fdump-rtl-ce3} enable dumping after the three
if conversion passes.
-@itemx -fdump-rtl-cprop_hardreg
+@item -fdump-rtl-cprop_hardreg
@opindex fdump-rtl-cprop_hardreg
Dump after hard register copy propagation.
-@itemx -fdump-rtl-csa
+@item -fdump-rtl-csa
@opindex fdump-rtl-csa
Dump after combining stack adjustments.
@@ -5342,11 +5342,11 @@
@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
the two common sub-expression elimination passes.
-@itemx -fdump-rtl-dce
+@item -fdump-rtl-dce
@opindex fdump-rtl-dce
Dump after the standalone dead code elimination passes.
-@itemx -fdump-rtl-dbr
+@item -fdump-rtl-dbr
@opindex fdump-rtl-dbr
Dump after delayed branch scheduling.
@@ -5391,7 +5391,7 @@
@opindex fdump-rtl-initvals
Dump after the computation of the initial value sets.
-@itemx -fdump-rtl-into_cfglayout
+@item -fdump-rtl-into_cfglayout
@opindex fdump-rtl-into_cfglayout
Dump after converting to cfglayout mode.
@@ -5421,7 +5421,7 @@
@opindex fdump-rtl-rnreg
Dump after register renumbering.
-@itemx -fdump-rtl-outof_cfglayout
+@item -fdump-rtl-outof_cfglayout
@opindex fdump-rtl-outof_cfglayout
Dump after converting from cfglayout mode.
@@ -5433,7 +5433,7 @@
@opindex fdump-rtl-postreload
Dump after post-reload optimizations.
-@itemx -fdump-rtl-pro_and_epilogue
+@item -fdump-rtl-pro_and_epilogue
@opindex fdump-rtl-pro_and_epilogue
Dump after generating the function prologues and epilogues.
@@ -10494,10 +10494,10 @@
The default is @option{-mfp-mode=caller}
@item -mnosplit-lohi
+@itemx -mno-postinc
+@itemx -mno-postmodify
@opindex mnosplit-lohi
-@item -mno-postinc
@opindex mno-postinc
-@item -mno-postmodify
@opindex mno-postmodify
Code generation tweaks that disable, respectively, splitting of 32-bit
loads, generation of post-increment addresses, and generation of
@@ -11409,7 +11409,7 @@
memory and if @code{-mshort-calls} is not set.
@item __AVR_HAVE_EIJMP_EICALL__
-@item __AVR_3_BYTE_PC__
+@itemx __AVR_3_BYTE_PC__
The device has the @code{EIJMP} and @code{EICALL} instructions.
This is the case for devices with more than 128@tie{}KiB of program memory.
This also means that the program counter
@@ -11420,13 +11420,13 @@
with up to 128@tie{}KiB of program memory.
@item __AVR_HAVE_8BIT_SP__
-@item __AVR_HAVE_16BIT_SP__
+@itemx __AVR_HAVE_16BIT_SP__
The stack pointer (SP) register is treated as 8-bit respectively
16-bit register by the compiler.
The definition of these macros is affected by @code{-mtiny-stack}.
@item __AVR_HAVE_SPH__
-@item __AVR_SP8__
+@itemx __AVR_SP8__
The device has the SPH (high part of stack pointer) special function
register or has an 8-bit stack pointer, respectively.
The definition of these macros is affected by @code{-mmcu=} and
@@ -11434,9 +11434,9 @@
by @code{-msp8}.
@item __AVR_HAVE_RAMPD__
-@item __AVR_HAVE_RAMPX__
-@item __AVR_HAVE_RAMPY__
-@item __AVR_HAVE_RAMPZ__
+@itemx __AVR_HAVE_RAMPX__
+@itemx __AVR_HAVE_RAMPY__
+@itemx __AVR_HAVE_RAMPZ__
The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
@code{RAMPZ} special function register, respectively.
@@ -17971,7 +17971,7 @@
@option{-mhitachi} is given.
@item -mieee
-@item -mno-ieee
+@itemx -mno-ieee
@opindex mieee
@opindex mnoieee
Control the IEEE compliance of floating-point comparisons, which affects the
diff -urN gcc-4.7.2.orig/gcc/doc/md.texi gcc-4.7.2/gcc/doc/md.texi
--- gcc-4.7.2.orig/gcc/doc/md.texi 2012-08-27 20:51:44.000000000 +0200
+++ gcc-4.7.2/gcc/doc/md.texi 2013-03-04 02:15:16.020039583 +0100
@@ -4405,8 +4405,8 @@
@cindex @code{ior@var{m}3} instruction pattern
@cindex @code{xor@var{m}3} instruction pattern
@item @samp{ssadd@var{m}3}, @samp{usadd@var{m}3}
-@item @samp{sub@var{m}3}, @samp{sssub@var{m}3}, @samp{ussub@var{m}3}
-@item @samp{mul@var{m}3}, @samp{ssmul@var{m}3}, @samp{usmul@var{m}3}
+@itemx @samp{sub@var{m}3}, @samp{sssub@var{m}3}, @samp{ussub@var{m}3}
+@itemx @samp{mul@var{m}3}, @samp{ssmul@var{m}3}, @samp{usmul@var{m}3}
@itemx @samp{div@var{m}3}, @samp{ssdiv@var{m}3}
@itemx @samp{udiv@var{m}3}, @samp{usdiv@var{m}3}
@itemx @samp{mod@var{m}3}, @samp{umod@var{m}3}
diff -urN gcc-4.7.2.orig/gcc/doc/sourcebuild.texi gcc-4.7.2/gcc/doc/sourcebuild.texi
--- gcc-4.7.2.orig/gcc/doc/sourcebuild.texi 2011-07-25 18:44:22.000000000 +0200
+++ gcc-4.7.2/gcc/doc/sourcebuild.texi 2013-03-04 02:15:48.800039305 +0100
@@ -676,7 +676,7 @@
@code{lang_checks}.
@table @code
-@itemx all.cross
+@item all.cross
@itemx start.encap
@itemx rest.encap
FIXME: exactly what goes in each of these targets?
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page