Building a custom GCC
Phil Muldoon
pmuldoon@redhat.com
Thu Aug 14 17:04:00 GMT 2008
Tom Tromey wrote:
>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
>>>>>>
>
> Phil> So I need to get GCC source, build, install (in a
> Phil> buildroot), and build my inferiors against -O0 GCC libraries. I know
> Phil> there are some GCC folks around here, and they may have a script or a
> Phil> baked set of instructions that would make this easier. Anyone?
>
> There are reasonably extensive instructions here:
>
> http://gcc.gnu.org/install/
>
FWIW here are my specific steps taken from above. They worked for me,
they might work for others. Writing them out here for posterity and comment.
Download GCC 4.3 (or whatever version) from here:
http://gcc.gnu.org/gcc-4.3/
Create build environment:
tar jxvf gcc-4.3.0.tar.bz2
mkdir gcc_obj
mkdir gcc_root
Run configure without a relative path, build with flags:
/home/builduser/gcc-4.3.0/configure --prefix=/home/builduser/gcc_root/
--exec-prefix=/home/builduser/gcc_root --disable-bootstrap
--enable-languages=c,c++ && make CFLAGS="-g3 -O0" CPPFLAGS="-g3 -O0"
CXXFLAGS="-g3 -O0"
(Note 1: I specify -O0 even though it is the default. I've no idea what
is in the GCC makefile, so pedantically setting)
(Note 2: Not sure if --exec-prefix is needed when --prefix is set, but
pedantically setting it)
(Note 3: Did not set -j as I ran into problems with GCC build
obliterating my laptop ;) )
make install
Then to build my test-case:
export PATH=/home/builduser/gcc_root/bin:$PATH
export
LD_LIBRARY_PATH=/home/builduser/gcc_root/lib:/home/builduser/gcc_root/lib64
[localhost testcases]$ which g++
~/gcc_root/bin/g++
[localhost testcases]$ g++ -g3 throw_testcase.cxx -o throw_testcase
[localhost testcases]$ ldd throw_testcase
linux-vdso.so.1 => (0x00007fff9b9ff000)
libstdc++.so.6 => /home/builduser/gcc_root/lib64/libstdc++.so.6
(0x0000000000602000)
libm.so.6 => /lib64/libm.so.6 (0x0000003c4a200000)
libgcc_s.so.1 => /home/builduser/gcc_root/lib64/libgcc_s.so.1
(0x0000000000110000)
libc.so.6 => /lib64/libc.so.6 (0x0000003c49e00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003c49a00000)
More information about the Archer
mailing list