www.digitalmars.com         C & C++   DMDScript  

D.gnu - Need help building GDC on 64-bit Debian

reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
Hi all,

I spent almost the whole day trying to get GDC to build on my 64-bit
Debian system, only to fail miserably. Are there any steps /
configurations that are known to work??

Here's what I figured out so far: Debian's multiarch directory structure
breaks the pristine gcc sources (due to stuff being moved to
/usr/include/$arch/* from /usr/include/*, ditto for /usr/lib). To remedy
this, I installed Debian's gcc sources (apt-get source gcc-4.7) and ran:

	debian/rules clean
	debian/rules patch

which applies a whole bunch of Debian patches that, presumably, fix the
gcc sources to be able to deal with multiarch directory structure.

So after running that, I cd to the GDC git sources and run update-gcc.sh
to link the D stuff into the source tree, then I ran configure and make.
This got a lot farther than when I was building directly from the
upstream GCC sources (due to the multiarch issue), but it still failed
miserably in various places, depending on which configure options I
tried. I still get:

	configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.

I did manage to get gcc itself to build, by using Debian's build script
(dpkg-buildpackage -rfakeroot), but I just can't figure out how exactly
the script is configuring the build -- it's a gigantic labyrinth of
scripts calling each other.

So anyway, for starters, I'd like to be able to at least get GDC to
build externally; eventually I'd like to figure out how to make it build
as a Debian package and maybe even upload it -- the current gdc in the
Debian archive is very old. Any help along those lines would be greatly
appreciated. :)


T

-- 
Doubtless it is a good thing to have an open mind, but a truly open mind should
be open at both ends, like the food-pipe, with the capacity for excretion as
well as absorption. -- Northrop Frye
Oct 19 2012
next sibling parent reply "Timo Sintonen" <t.sintonen luukku.com> writes:
I can not help you in this case, but this is a general problem in 
compiling gcc package, specially when making a cross compiler. 
The message is a bit misleading and is not related to the test 
which generates it.
Somewhere at the beginning, configure tests if it is possible to 
compile and link an executable program. If this fails, configure 
sets this variable telling that linking executables is not 
possible for this configuration. If some later test wants to test 
some feature by compiling and linking a test program, configure 
gives this error message. All tests would fail anyway, because it 
is not possible to make any kind of executable.
To make an executable we need headers, a working compiler, 
working binutils and working libraries for the target system. 
Even if the target system is the same ( I assume you are not 
making a cross-compiler) configure may give a different target 
name. In my Slackware the default configuration is 
x86_64-slackware-linux but the guessed configuration is 
x86_64-unknown-linux-gnu. Configure will not find all stuff for 
the guessed target and fails.
You have to look config.log at the directory make was when the 
error came. In somewhere near the beginning of the file there is 
something like "checking if gcc can produce executables" and you 
should look there what went wrong.
In my opinion configure should report an error and stop here, but 
I am not expert of that script either.
Oct 19 2012
next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Sat, Oct 20, 2012 at 08:38:23AM +0200, Timo Sintonen wrote:
[...]
 To make an executable we need headers, a working compiler, working
 binutils and working libraries for the target system. Even if the
 target system is the same ( I assume you are not making a
 cross-compiler) configure may give a different target name. In my
 Slackware the default configuration is x86_64-slackware-linux but
 the guessed configuration is x86_64-unknown-linux-gnu. Configure
 will not find all stuff for the guessed target and fails.
You're right, I get x86_64-unknown-linux-gnu too. How to fix this? (I assume it needs fixing, as I'm on a Debian system so it shouldn't be unknown?)
 You have to look config.log at the directory make was when the error
 came. In somewhere near the beginning of the file there is something
 like "checking if gcc can produce executables" and you should look
 there what went wrong.
 In my opinion configure should report an error and stop here, but I
 am not expert of that script either.
Thanks for the tip, I'll try it again and look for the real source of the error. T -- Caffeine underflow. Brain dumped.
Oct 20 2012
prev sibling next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
Huh, weird, I tried compiling again this morning and somehow it works
now!! I think it may have to do with the configure options: I tried a
different configuration this time:

	/usr/src/gcc-4.7/gcc-4.7-4.7.2/src/configure \
	--enable-languages=d --disable-bootstrap \
	--prefix=/usr/src/d/gdcroot/ --enable-checking=yes \
	--disable-nls --disable-libgomp --disable-libmudflap \
	--disable-ld --disable-gold --disable-multilib \
	--disable-libquadmath

Anyway, now I have a different problem: how do I find out what are gdc's
default search paths for imports? I installed it in a non-default
directory and now obviously it can't find druntime/phobos, etc.. But I
don't know where to put the files so that gdc can find them.

Also, I seem to remember reading somewhere that libphobos needs to be
specially built for gdc? Where can I find instructions on how to build
it?

Thanks in advance for the help!


T

-- 
All men are mortal. Socrates is mortal. Therefore all men are Socrates.
Oct 20 2012
prev sibling parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
On 20 October 2012 18:14, H. S. Teoh <hsteoh quickfur.ath.cx> wrote:
 Huh, weird, I tried compiling again this morning and somehow it works
 now!! I think it may have to do with the configure options: I tried a
 different configuration this time:

         /usr/src/gcc-4.7/gcc-4.7-4.7.2/src/configure \
         --enable-languages=d --disable-bootstrap \
         --prefix=/usr/src/d/gdcroot/ --enable-checking=yes \
         --disable-nls --disable-libgomp --disable-libmudflap \
         --disable-ld --disable-gold --disable-multilib \
         --disable-libquadmath

 Anyway, now I have a different problem: how do I find out what are gdc's
 default search paths for imports? I installed it in a non-default
 directory and now obviously it can't find druntime/phobos, etc.. But I
 don't know where to put the files so that gdc can find them.

 Also, I seem to remember reading somewhere that libphobos needs to be
 specially built for gdc? Where can I find instructions on how to build
 it?

 Thanks in advance for the help!
If you compiled gdc - it should have also include libphobos in the build... unless you did something strange and omitted it. :) -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
Oct 21 2012
parent reply "Timo Sintonen" <t.sintonen luukku.com> writes:
On Sunday, 21 October 2012 at 13:14:25 UTC, Iain Buclaw wrote:

 If you compiled gdc - it should have also include libphobos in 
 the
 build... unless you did something strange and omitted it. :)
The old update script did it wrong sometimes. When the sources were parallel, like /usr/local/src/gcc and /ust/local/src/gdc , the script pacthed gcc to make gdc, but failed with the patches to makefiles for the library. So gdc was built but the library did not compile at all. This error was very hard to notice. The new script that came a week ago works, the only thig was that it did not have the executable bit set by default.
Oct 21 2012
next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Mon, Oct 22, 2012 at 07:48:52AM +0200, Timo Sintonen wrote:
 On Sunday, 21 October 2012 at 13:14:25 UTC, Iain Buclaw wrote:
 
If you compiled gdc - it should have also include libphobos in the
build... unless you did something strange and omitted it. :)
The old update script did it wrong sometimes. When the sources were parallel, like /usr/local/src/gcc and /ust/local/src/gdc , the script pacthed gcc to make gdc, but failed with the patches to makefiles for the library. So gdc was built but the library did not compile at all. This error was very hard to notice. The new script that came a week ago works, the only thig was that it did not have the executable bit set by default.
Hmm. This is probably my problem, as I'm using gcc-4.7.2, so I'm on the gdc-4.7 branch. I did notice that 'libphobos' doesn't appear anywhere in the Makefile generated by configure, or anywhere in the build log. :) How do I fix this? I just tried building with gdc master, but it dies horribly in idgen.c with screens of compile errors (I think caused by missing struct definition somewhere, but why this happened I've no idea. Now I'm trying again with the 4.7 branch). T -- Windows: the ultimate triumph of marketing over technology. -- Adrian von Bidder
Oct 22 2012
prev sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Mon, Oct 22, 2012 at 09:29:01AM -0700, H. S. Teoh wrote:
 On Mon, Oct 22, 2012 at 07:48:52AM +0200, Timo Sintonen wrote:
 On Sunday, 21 October 2012 at 13:14:25 UTC, Iain Buclaw wrote:
 
If you compiled gdc - it should have also include libphobos in the
build... unless you did something strange and omitted it. :)
The old update script did it wrong sometimes. When the sources were parallel, like /usr/local/src/gcc and /ust/local/src/gdc , the script pacthed gcc to make gdc, but failed with the patches to makefiles for the library. So gdc was built but the library did not compile at all. This error was very hard to notice. The new script that came a week ago works, the only thig was that it did not have the executable bit set by default.
Hmm. This is probably my problem, as I'm using gcc-4.7.2, so I'm on the gdc-4.7 branch. I did notice that 'libphobos' doesn't appear anywhere in the Makefile generated by configure, or anywhere in the build log. :)
[...] Update: build is now successful!! The problem was indeed the failure to apply the patches in gcc/d/patches/. I submitted a pull request to fix update-gcc.sh to apply the 4.7.x patches (since this is the 4.7.x branch I think it's OK to hard-code the 4.7.x patches): https://github.com/D-Programming-GDC/GDC/pull/33 Thanks for all the help! T -- Ph.D. = Permanent head Damage
Oct 22 2012
prev sibling parent reply "Brad Lanam" <brad.lanam.comp -NOSPAM-gmail.com> writes:
On Saturday, 20 October 2012 at 05:37:20 UTC, H. S. Teoh wrote:
 	configure: error: Link tests are not allowed after 
 GCC_NO_EXECUTABLES.
Had this problem many, many times... IIRC I think this is the piece you need, which isn't documented well. if [[ $(uname -m) == "x86_64" ]]; then export LD_LIBRARY_PATH=/lib/i386-linux-gnu/ export CPATH=/usr/include/i386-linux-gnu fi I used: ../configure \ --prefix=/opt/${d} \ --enable-languages=d \ --disable-shared \ --disable-nls \ --disable-bootstrap \ --with-bugurl="https://bitbucket.org/goshawk/gdc/issues" \ --enable-checking=assert,runtime,misc,tree,gimple,types,rtlflag \ --disable-libgomp \ --disable-lbmudflap I haven't tried this in a long time, hope this helps.
Oct 21 2012
parent Iain Buclaw <ibuclaw ubuntu.com> writes:
On 21 October 2012 21:31, Brad Lanam <brad.lanam.comp -nospam-gmail.com> wrote:
 On Saturday, 20 October 2012 at 05:37:20 UTC, H. S. Teoh wrote:
         configure: error: Link tests are not allowed after
 GCC_NO_EXECUTABLES.
Had this problem many, many times... IIRC I think this is the piece you need, which isn't documented well. if [[ $(uname -m) == "x86_64" ]]; then export LD_LIBRARY_PATH=/lib/i386-linux-gnu/ export CPATH=/usr/include/i386-linux-gnu fi
LD_LIBRARY_PATH / CPATH should be x86_64-linux-gnu on x86_64 systems, not i386. -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
Oct 21 2012