Thread overview
Nothing builds on debian anymore.
Mar 03, 2017
deadalnix
Mar 03, 2017
H. S. Teoh
Mar 03, 2017
H. S. Teoh
Mar 03, 2017
deadalnix
Mar 03, 2017
David Nadlinger
Re: Yes, building DMD on Debian works just fine
Mar 03, 2017
Seb
March 03, 2017
https://issues.dlang.org/show_bug.cgi?id=17236

Coming to you on ubuntu soon.
March 03, 2017
On Fri, Mar 03, 2017 at 06:11:29PM +0000, deadalnix via Digitalmars-d wrote:
> https://issues.dlang.org/show_bug.cgi?id=17236
> 
> Coming to you on ubuntu soon.

I just built dmd/druntime/phobos on Debian, and it works fine.  But then again, I'm using my -fPIC workaround, which has been officially turned down as a viable solution, so *shrug*.

For those who are interested, here's how to do it:

NOTE: this assumes you have a working bootstrap compiler installed in /usr/src/d/install/ (I use 2.069 for this purpose but it should probably work with other recent releases as well).

1) Create a g++ wrapper, say /usr/src/d/g++wrapper, with the following contents:

	#!/bin/sh
	# This is a temporary hack to workaround Phobos being
	# incompatible with gcc-6.2's PIE-by-default configuration in
	# Debian.
	CXX_FLAGS=-no-pie

	if [ "$1" = "--version" ] ; then
		# This is a workaround for posix.mak bogonity in parsing
		# the output of `g++ --version` for certain GCC
		# versions.
		echo g++
		exit 0
	fi
	/usr/bin/g++ $CXX_FLAGS "$@"

2) Build dmd:

	export HOST_DMD=/usr/src/d/install/linux/bin64/dmd
	cd dmd/src
	make -f posix.mak clean
	make -f posix.mak \
		HOST_CXX=/usr/src/d/g++wrapper \
		HOST_DMD="/usr/src/d/install/linux/bin64/dmd -conf=/usr/src/d/install/linux/bin64/dmd.conf" \
		MODEL=64 -j3

3) Build druntime/phobos with PIC=1:

	cd ../../druntime
	make -f posix.mak PIC=1 MODEL=64

	cd ../phobos
	make -f posix.mak PIC=1 MODEL=64

Yes, this makes druntime/phobos PIC, even for static linking, which may introduce performance degradation.  But I'd rather suffer a slight performance degradation than to be unable to use D at all.

Now, if there was a way to coax dmd to invoke g++ with -no-pie (besides using the g++wrapper hack above), I'd be all ears, 'cos that would mean we can build druntime/phobos without PIC=1, and simply have dmd always emit non-PIC / non-PIE code.  However, the last time I tried this, I still ran into problems with dmd-personality / g++-personality symbols that for whatever reason are still incompatible with PIE.

Besides, even if somebody could figure out how to make this work, this still defeats the purpose of PIE-by-default on Debian, so the REAL solution is to implement emitting PIE (but not necessarily PIC) code in dmd.

I hate to say it, knowing how busy Walter/Andrei and the rest of the dmd devs are, but losing Debian/Ubuntu means losing a pretty significant chunk of our userbase, so implementing PIE support in dmd should be a pretty high priority.  But, sorry to say, I doubt anything will happen on this front unless Walter was forced to use Debian for the next 6 months and has to personally face the frustration of being unable to build dmd due to PIE-by-default.


T

-- 
Leather is waterproof.  Ever see a cow with an umbrella?
March 03, 2017
On Fri, Mar 03, 2017 at 10:32:34AM -0800, H. S. Teoh via Digitalmars-d wrote:
> On Fri, Mar 03, 2017 at 06:11:29PM +0000, deadalnix via Digitalmars-d wrote:
> > https://issues.dlang.org/show_bug.cgi?id=17236
> > 
> > Coming to you on ubuntu soon.
> 
> I just built dmd/druntime/phobos on Debian, and it works fine.  But then again, I'm using my -fPIC workaround, which has been officially turned down as a viable solution, so *shrug*.
[...]

Actually, I just tested on a freshly-cloned copy of dmd/druntime/phobos, it seems that building on Debian does work. Digging into the git log, it appears that commit 78cd023 *should* have added -fPIC to the makefiles.

So how come it's still not working for you?  Are you using an older bootstrap compiler? (If so, the g++wrapper trick I posted should solve that problem -- you can skip the PIC=1 hacks for druntime/phobos as this is apparently already merged into git master.)


T

-- 
Almost all proofs have bugs, but almost all theorems are true. -- Paul Pedersen
March 03, 2017
On Friday, 3 March 2017 at 18:11:29 UTC, deadalnix wrote:
> https://issues.dlang.org/show_bug.cgi?id=17236
>
> Coming to you on ubuntu soon.

I'm pretty sure that would still work with LDC. So not exactly "nothing". ;)

 – David
March 03, 2017
On Friday, 3 March 2017 at 18:11:29 UTC, deadalnix wrote:
> https://issues.dlang.org/show_bug.cgi?id=17236
>
> Coming to you on ubuntu soon.

I started a new Docker instance and tried this:

```
docker run -i -t ubuntu:16.10 /bin/bash
apt-get update
apt-get install git curl gcc g++ unzip
git clone https://github.com/dlang/dmd
git clone https://github.com/dlang/druntime
git clone https://github.com/dlang/phobos
cd dmd
make -j8 -f posix.mak  AUTO_BOOTSTRAP=1
cd ../phobos
make -j8 -f posix.mak
```

Everything builds just fine!
As mentioned on a different ticket of yours, I believe it's still an issue with your setup and most likely an outdated DMD binary in `dmd`.
In case you think this isn't the case, please provide a proper bug report.

Moreover, as Martin has stated it before ranting here isn't a nice behavior, especially if it's _not_ our fault and "nothing" just refers to your build setup.
March 03, 2017
On Friday, 3 March 2017 at 18:47:53 UTC, H. S. Teoh wrote:
> Actually, I just tested on a freshly-cloned copy of dmd/druntime/phobos, it seems that building on Debian does work. Digging into the git log, it appears that commit 78cd023 *should* have added -fPIC to the makefiles.
>
> So how come it's still not working for you?  Are you using an older bootstrap compiler? (If so, the g++wrapper trick I posted should solve that problem -- you can skip the PIC=1 hacks for druntime/phobos as this is apparently already merged into git master.)
>
>
> T

I blasted everything away, reinstalled everything and now it builds....

Something must be broken with make clean then.
March 03, 2017
On 3/3/17 6:27 PM, deadalnix wrote:
> On Friday, 3 March 2017 at 18:47:53 UTC, H. S. Teoh wrote:
>> Actually, I just tested on a freshly-cloned copy of
>> dmd/druntime/phobos, it seems that building on Debian does work.
>> Digging into the git log, it appears that commit 78cd023 *should* have
>> added -fPIC to the makefiles.
>>
>> So how come it's still not working for you?  Are you using an older
>> bootstrap compiler? (If so, the g++wrapper trick I posted should solve
>> that problem -- you can skip the PIC=1 hacks for druntime/phobos as
>> this is apparently already merged into git master.)
>>
>>
>> T
>
> I blasted everything away, reinstalled everything and now it builds....
>
> Something must be broken with make clean then.

Good to hear, could you please update (if reproducible) or close the issue. Thanks! -- Andrei