www.digitalmars.com         C & C++   DMDScript  

D.gnu - Building GDC on Ubuntu

reply edam <edam waxworlds.org> writes:
Hi there,

I'm trying to follow the instructions at
https://bitbucket.org/goshawk/gdc/wiki/Home to build GDC from the mercurial
repos, but I've not been successful. Not being familiar with the GCC build
process myself, I was wondering if anyone could shed a bit of light on the
problem?

I should state ahead of time that I ran ./gcc/d/setup-gcc.sh with -v2 and my
system is x86_64 running Ubuntu 10.10.

It fouls up during compilation of libphobos. I get this:

gcc -g -O2 -g -Wall -I ../../../../libphobos/../include -c -o config/x3.o
../../../../libphobos/config/x3.c
In file included from ../../../../libphobos/config/x3.c:1:
/usr/include/string.h:34: fatal error: stddef.h: No such file or directory
compilation terminated.

I have tried sticking a '-v' in to that call to gcc and found this:

gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5) 
COLLECT_GCC_OPTIONS='-v' '-g' '-O2' '-g' '-Wall' '-I'
'../../../../libphobos/../include' '-c' '-o' 'config/x3.o' '-mtune=generic'
 /usr/lib/gcc/x86_64-linux-gnu/4.4.5/cc1 -quiet -v -I
../../../../libphobos/../include -iprefix
/mnt/data/home/packages/gdc/dev/gcc-4.4.5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/x86
64-linux-gnu/4.4.5/ ../../../../libphobos/config/x3.c -D_FORTIFY_SOURCE=2
-quiet -dumpbase x3.c -mtune=generic -auxbase-strip config/x3.o -g -g -O2 -Wall
-version -fstack-protector -o /tmp/ccakn1ji.s
ignoring nonexistent directory
"/mnt/data/home/packages/gdc/dev/gcc-4.4.5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/x86_64-linux-gnu/4.4.5/include"
ignoring nonexistent directory
"/mnt/data/home/packages/gdc/dev/gcc-4.4.5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/x86_64-linux-gnu/4.4.5/include-fixed"
ignoring nonexistent directory
"/mnt/data/home/packages/gdc/dev/gcc-4.4.5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/x86_64-linux-gnu/4.4.5/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/mnt/data/home/packages/gdc/dev/gcc-4.4.5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/4.4.5/include"
ignoring nonexistent directory
"/mnt/data/home/packages/gdc/dev/gcc-4.4.5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/4.4.5/include-fixed"
ignoring nonexistent directory
"/mnt/data/home/packages/gdc/dev/gcc-4.4.5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/4.4.5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 ../../../../libphobos/../include
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.

Which explains why it can't find
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/include/stddef.h (which does exist).

Anyone know what I'm doing wrong?
Apr 19 2011
next sibling parent reply =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
edam wrote:
 Hi there,
=20
 I'm trying to follow the instructions at https://bitbucket.org/goshawk/=
gdc/wiki/Home to build GDC from the mercurial repos, but I've not been su= ccessful. Not being familiar with the GCC build process myself, I was won= dering if anyone could shed a bit of light on the problem?
=20
 I should state ahead of time that I ran ./gcc/d/setup-gcc.sh with -v2 a=
nd my system is x86_64 running Ubuntu 10.10.
=20
 It fouls up during compilation of libphobos. I get this:
=20
 gcc -g -O2 -g -Wall -I ../../../../libphobos/../include -c -o config/x3=
=2Eo ../../../../libphobos/config/x3.c
 In file included from ../../../../libphobos/config/x3.c:1:
 /usr/include/string.h:34: fatal error: stddef.h: No such file or direct=
ory
 compilation terminated.
=20
 I have tried sticking a '-v' in to that call to gcc and found this:
=20
 gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)=20
 COLLECT_GCC_OPTIONS=3D'-v' '-g' '-O2' '-g' '-Wall' '-I' '../../../../li=
bphobos/../include' '-c' '-o' 'config/x3.o' '-mtune=3Dgeneric'
  /usr/lib/gcc/x86_64-linux-gnu/4.4.5/cc1 -quiet -v -I ../../../../libph=
obos/../include -iprefix /mnt/data/home/packages/gdc/dev/gcc-4.4.5/objdir= /x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/x86_64-linux-gnu/4.4.5/= ../../../../libphobos/config/x3.c -D_FORTIFY_SOURCE=3D2 -quiet -dumpbase= x3.c -mtune=3Dgeneric -auxbase-strip config/x3.o -g -g -O2 -Wall -versio= n -fstack-protector -o /tmp/ccakn1ji.s
 ignoring nonexistent directory "/mnt/data/home/packages/gdc/dev/gcc-4.4=
=2E5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/x86_64-linux= -gnu/4.4.5/include"
 ignoring nonexistent directory "/mnt/data/home/packages/gdc/dev/gcc-4.4=
=2E5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/x86_64-linux= -gnu/4.4.5/include-fixed"
 ignoring nonexistent directory "/mnt/data/home/packages/gdc/dev/gcc-4.4=
=2E5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/x86_64-linux= -gnu/4.4.5/../../../../x86_64-linux-gnu/include"
 ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
 ignoring nonexistent directory "/mnt/data/home/packages/gdc/dev/gcc-4.4=
=2E5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/../../lib/gc= c/x86_64-linux-gnu/4.4.5/include"
 ignoring nonexistent directory "/mnt/data/home/packages/gdc/dev/gcc-4.4=
=2E5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/../../lib/gc= c/x86_64-linux-gnu/4.4.5/include-fixed"
 ignoring nonexistent directory "/mnt/data/home/packages/gdc/dev/gcc-4.4=
=2E5/objdir/x86_64-unknown-linux-gnu/32/libphobos/../lib/gcc/../../lib/gc= c/x86_64-linux-gnu/4.4.5/../../../../x86_64-linux-gnu/include"
 #include "..." search starts here:
 #include <...> search starts here:
  ../../../../libphobos/../include
  /usr/local/include
  /usr/include/x86_64-linux-gnu
  /usr/include
 End of search list.
=20
 Which explains why it can't find /usr/lib/gcc/x86_64-linux-gnu/4.4.5/in=
clude/stddef.h (which does exist).
=20
 Anyone know what I'm doing wrong?
I am going to take a bet that you have "." in your path. If that is the case, you need to add "CC=3D$(which gcc)" to your configure command line (and it is not something you are doing wrong, it is a bug in gcc). Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Apr 20 2011
parent edam <edam waxworlds.org> writes:
Jérôme M. Berger Wrote:
 	I am going to take a bet that you have "." in your path. If that is
 the case, you need to add "CC=$(which gcc)" to your configure
 command line (and it is not something you are doing wrong, it is a
 bug in gcc).
That worked! Jérôme, you are a star! Thank you so much. I've been trying to compile this for 2 days straight! :o)
Apr 20 2011
prev sibling parent reply Don <dailey.don gmail.com> writes:
I really want to use D but I'm constantly frustrated by issues just
like this.

I get the same error message on 64 bit Ubunutu 10.10 as well.

I do plan to stick with it and when D is within 5% of the speed of gcc
for my type of application (computer chess) I'm switching.

Sorry I cannot be of more help to you.   I was hoping to at least find
a binary distribution that is up to date but I have not been able to
do so.    I wonder if this will compile on a 32 bit box?  I may try it
with virtual-box when I get time and that would my only suggestion.

GDC is in the repository for Ubuntu but it's an ancient version and I
don't know if it produces 64 bit executables.    It's my understanding
that GDC runs as a 32 bit application but that later version do
produce 64 bit binaries which is important to me since I rely on 64
bit data structures for high performance.
May 22 2011
next sibling parent reply Trass3r <un known.com> writes:
What about Iain's ppa: https://launchpad.net/~ibuclaw/+archive/ppa
May 23 2011
parent Adam Burton <adz21c gmail.com> writes:
Trass3r wrote:

 What about Iain's ppa: https://launchpad.net/~ibuclaw/+archive/ppa
I've not tested it but these looks like D1 packages rather than D2 (based on the contents of std in libphobos packages).
May 23 2011
prev sibling next sibling parent Adam Burton <adz21c gmail.com> writes:
Don wrote:

 I really want to use D but I'm constantly frustrated by issues just
 like this.
 
 I get the same error message on 64 bit Ubunutu 10.10 as well.
 
 I do plan to stick with it and when D is within 5% of the speed of gcc
 for my type of application (computer chess) I'm switching.
 
 Sorry I cannot be of more help to you.   I was hoping to at least find
 a binary distribution that is up to date but I have not been able to
 do so.    I wonder if this will compile on a 32 bit box?  I may try it
 with virtual-box when I get time and that would my only suggestion.
 
 GDC is in the repository for Ubuntu but it's an ancient version and I
 don't know if it produces 64 bit executables.    It's my understanding
 that GDC runs as a 32 bit application but that later version do
 produce 64 bit binaries which is important to me since I rely on 64
 bit data structures for high performance.
I spent Sunday evening tackling the issue you are speaking of for my own use. I have attached a patch I created yesterday, for the ubuntu package from the repository, that should make the package build D2. It contains everything I have done so far. I haven't tested it much but some simple tests show it works (so far limited to opening a window with xcb, a writefln hello world and a simple immutable test to make sure I was dealing with D2). I essentially wanted a gdc install that I could remove or upgrade without fuss :-). I am using 11.04 not 10.10 so you might need to tweak the patch for the older version (the changelog shows recent changes despite the age of the gdc version). Follow the below instructions. 1. Execute "sudo apt-get build-dep gdc-4.4" (you might need to install some of the deb tools and fakeroot if it doesn't, I can't remember the package names but I can try and figure them out if needed) 2. Execute "apt-get source gdc-4.4" 3. Rename new directory to gdc-4.4-2.052-4.4.5 (not sure if this is necessary but it is at least a convention and more accurately represents what I am creating :-) ) 4. Apply the patch to gdc-4.4-2.052-4.4.5 5. Delete the archive inside gdc-4.4-2.052-4.4.5. 6. Pull gdc from repo. 7. Compress the "d" directory to an archive named gdc-20110517.orig.tar.gz (replace the date if you want, just what I called it). Make sure "d" is the root directory inside the tar. I had issues using KDE's ark to compress too tar.xz, it wouldn't decompress on build, but it works with tar.gz too so I went that route. 8. Place the new archive inside gdc-4.4-2.052-4.4.5. 9. Open a terminal in gdc-4.4-2.052-4.4.5. 10. Execute "dpkg-buildpackage -rfakeroot" 11. Go have a snack while it compiles. 12. Should have a gdc-4.4 and libphobos2-dev package sitting in the directory above gdc-4.4-2.052-4.4.5. (it might ask you to sign it, not strictly necessary). Install them. You should then be able to compile with gdc-4.4 -I/usr/include/d2/4.4 -I/usr/include/d2/4.4/x86_64-linux-gnu -o <output> <files.d> Hope that helps :-). p.s. I can provide my compiled package if people want them. They are 64bit.
May 23 2011
prev sibling parent =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
Don wrote:
 I really want to use D but I'm constantly frustrated by issues just
 like this.
=20
 I get the same error message on 64 bit Ubunutu 10.10 as well.
=20
Have you tried adding "CC=3D$(which gcc)" to your configure command line? Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
May 24 2011