Thread overview
trouble building gdc-0.23
Mar 06, 2007
Neal Becker
Mar 06, 2007
Neal Becker
Mar 06, 2007
Neal Becker
Jul 11, 2007
Ingo Oeser
Mar 07, 2007
David Friedman
Mar 07, 2007
Neal Becker
March 06, 2007
I'm having trouble trying to build gdc-0.23 on x86_64 (fc6).  I need to do this to get libgphobos built with -fPIC.

Here's what I tried:

1. tar xjf gcc-4.1.1.tar.bz2
2. cd gcc-4.1.1/gcc
3. tar xjf ~/gdc-0.23-src.tar.bz2
4. cd ..
5. ./gcc/d/setup-gcc.sh
6. ./configure --prefix=/opt/gdc --enable-languages=c,d,c++ && make
[chug...]
checking
If /home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/gdc -B/home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/ -B/opt/gdc/x86_64-unknown-linux-gnu/bin/ -B/opt/gdc/x86_64-unknown-linux-gnu/lib/ -isystem /opt/gdc/x86_64-unknown-linux-gnu/include -isystem /opt/gdc/x86_64-unknown-linux-gnu/sys-include
can compile D
sources... /home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/cc1d: /home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/libgcc_s.so.1:
version `GCC_4.2.0' not found (required by /usr/lib64/libstdc++.so.6)
no
configure: error: can't compile D sources!
make[1]: *** [configure-target-libphobos] Error 1

That 'GCC_4.2.0' sounds suspicious.  I'm guessing it picked up the system gcc and libstdc++ instead of the one from the build tree.

What did I do wrong?
March 06, 2007
Neal Becker wrote:

> I'm having trouble trying to build gdc-0.23 on x86_64 (fc6).  I need to do
> this to get libgphobos built with -fPIC.
[...]
> That 'GCC_4.2.0' sounds suspicious.  I'm guessing it picked up the system
> gcc and libstdc++ instead of the one from the build tree.
> 
> What did I do wrong?

It seems to have built OK on Fedora Core 5, so maybe your
system compiler is too new to support building GDC with ?

"An existing C++ compiler (even if you use make bootstrap)."
seems to indicate it will use the system libstdc++, but it
would be nice to have this clarified... (and perhaps lifted,
if you build the C++ language in addition to just C and D ?)

Otherwise I guess we'll just have to wait for GCC 4.2 support.

--anders
March 06, 2007
Anders F Björklund wrote:

> Neal Becker wrote:
> 
>> I'm having trouble trying to build gdc-0.23 on x86_64 (fc6).  I need to do this to get libgphobos built with -fPIC.
> [...]
>> That 'GCC_4.2.0' sounds suspicious.  I'm guessing it picked up the system gcc and libstdc++ instead of the one from the build tree.
>> 
>> What did I do wrong?
> 
> It seems to have built OK on Fedora Core 5, so maybe your system compiler is too new to support building GDC with ?
> 
> "An existing C++ compiler (even if you use make bootstrap)." seems to indicate it will use the system libstdc++, but it would be nice to have this clarified... (and perhaps lifted, if you build the C++ language in addition to just C and D ?)
> 
> Otherwise I guess we'll just have to wait for GCC 4.2 support.
> 
> --anders

Darn.  If someone would build gdc-0.23 on linux x86_64 with -fPIC libgphobos, I wouldn't have to go through this.
March 06, 2007
Anders F Björklund wrote:

> Neal Becker wrote:
> 
>> I'm having trouble trying to build gdc-0.23 on x86_64 (fc6).  I need to do this to get libgphobos built with -fPIC.
> [...]
>> That 'GCC_4.2.0' sounds suspicious.  I'm guessing it picked up the system gcc and libstdc++ instead of the one from the build tree.
>> 
>> What did I do wrong?
> 
> It seems to have built OK on Fedora Core 5, so maybe your system compiler is too new to support building GDC with ?
> 
> "An existing C++ compiler (even if you use make bootstrap)." seems to indicate it will use the system libstdc++, but it would be nice to have this clarified... (and perhaps lifted, if you build the C++ language in addition to just C and D ?)
> 
> Otherwise I guess we'll just have to wait for GCC 4.2 support.
> 

I installed
compat-gcc-34-c++-3.4.6-4
compat-libstdc++-33-3.2.3-61
compat-gcc-34-3.4.6-4

Then (with clean gcc-4.1.1 source) ran:

CC=gcc34 CXX=g++34 ./configure --prefix=/opt/gdc --enable-languages=c,d,c++ && make

This should have picked up the gcc34 compiler and libstdc++, but it didn't.
It still gave the same failure.  It still refers to
(required by /usr/lib64/libstdc++.so.)
which it should not have used.

March 07, 2007
Neal Becker wrote:
> I'm having trouble trying to build gdc-0.23 on x86_64 (fc6).  I need to do
> this to get libgphobos built with -fPIC.
> 
> Here's what I tried:
> 
> 1. tar xjf gcc-4.1.1.tar.bz2 2. cd gcc-4.1.1/gcc
> 3. tar xjf ~/gdc-0.23-src.tar.bz2 4. cd ..
> 5. ./gcc/d/setup-gcc.sh 6. ./configure --prefix=/opt/gdc --enable-languages=c,d,c++ && make
> [chug...]
> checking
> If /home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/gdc -B/home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/ -B/opt/gdc/x86_64-unknown-linux-gnu/bin/ -B/opt/gdc/x86_64-unknown-linux-gnu/lib/ -isystem /opt/gdc/x86_64-unknown-linux-gnu/include -isystem /opt/gdc/x86_64-unknown-linux-gnu/sys-include
> can compile D
> sources... /home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/cc1d: /home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/libgcc_s.so.1:
> version `GCC_4.2.0' not found (required by /usr/lib64/libstdc++.so.6)
> no
> configure: error: can't compile D sources!
> make[1]: *** [configure-target-libphobos] Error 1
> 
> That 'GCC_4.2.0' sounds suspicious.  I'm guessing it picked up the system
> gcc and libstdc++ instead of the one from the build tree.
> 
> What did I do wrong?

For whatever reason, the cc1d executable is picking up the built version of libgcc.so instead of the system libgcc.so.  The build scripts may be messing with LD_LIBRARY_PATH.

Try building GCC outside of the source directory:

cd ..
mkdir BUILD
cd BUILD
../gcc-4.1.1/configure ... && make

David
March 07, 2007
David Friedman wrote:

> Neal Becker wrote:
>> I'm having trouble trying to build gdc-0.23 on x86_64 (fc6).  I need to do this to get libgphobos built with -fPIC.
>> 
>> Here's what I tried:
>> 
>> 1. tar xjf gcc-4.1.1.tar.bz2
>> 2. cd gcc-4.1.1/gcc
>> 3. tar xjf ~/gdc-0.23-src.tar.bz2
>> 4. cd ..
>> 5. ./gcc/d/setup-gcc.sh
>> 6. ./configure --prefix=/opt/gdc --enable-languages=c,d,c++ && make
>> [chug...]
>> checking
>> If /home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/gdc
>> -B/home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/
>> -B/opt/gdc/x86_64-unknown-linux-gnu/bin/
>> -B/opt/gdc/x86_64-unknown-linux-gnu/lib/ -isystem
>> /opt/gdc/x86_64-unknown-linux-gnu/include -isystem
>> /opt/gdc/x86_64-unknown-linux-gnu/sys-include can compile D sources...
>> /home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/cc1d:
>> /home/nbecker/gcc-4.1.1/host-x86_64-unknown-linux-gnu/gcc/libgcc_s.so.1:
>> version `GCC_4.2.0' not found (required by /usr/lib64/libstdc++.so.6) no
>> configure: error: can't compile D sources! make[1]: ***
>> [configure-target-libphobos] Error 1
>> 
>> That 'GCC_4.2.0' sounds suspicious.  I'm guessing it picked up the system gcc and libstdc++ instead of the one from the build tree.
>> 
>> What did I do wrong?
> 
> For whatever reason, the cc1d executable is picking up the built version of libgcc.so instead of the system libgcc.so.  The build scripts may be messing with LD_LIBRARY_PATH.
> 
> Try building GCC outside of the source directory:
> 
> cd ..
> mkdir BUILD
> cd BUILD
> ../gcc-4.1.1/configure ... && make
> 
> David

Doesn't help.  Not only that, but this time I tried building on a FC5 x86_64 machine.  I got the same result.  What am I doing that's different then the way gdc-0.23-x86_64-linux-gcc-4.1.1.tar.bz2 was built?
July 11, 2007
Anders F Björklund wrote:

> Neal Becker wrote:
> 
>> I'm having trouble trying to build gdc-0.23 on x86_64 (fc6).  I need to do this to get libgphobos built with -fPIC.
> [...]
>> That 'GCC_4.2.0' sounds suspicious.  I'm guessing it picked up the system gcc and libstdc++ instead of the one from the build tree.

> It seems to have built OK on Fedora Core 5, so maybe your system compiler is too new to support building GDC with ?

Run into the same problem.

Workaround is:
- backup existing libstc++ from /usr/lib/ && ldconfig
- move the just built libstdc++  there && ldconfig
- build and install/package gdc
- move backed up libstdc++ back to /usr/lib && ldconfig

> Otherwise I guess we'll just have to wait for GCC 4.2 support.

Just beating the compiler to do that at the moment :-)

My steps so far:
- started with gdc-0.23-devel branch
- fixed line-endings as Gregor suggested :-)
- used DMD 1.018 patch from Gregor and

- ported patches from David to gcc-4.2
- replaces various instanced of build() with build2() or build3()
- used common option framework in GCC

Latest problem: "gdc: unknown spec function 'd-all-sources'" when
gdc tries to built libphobos. Can I built the d-all-sources functionality
with "-combine" in newer gcc?

Any help is appreciated. I'll publish my changes as patches like David provides later. I run Linux/Ubuntu Feisty Fawn.

Best Regards

Ingo Oeser