Nothing builds on debian anymore.

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 3 10:32:34 PST 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?


More information about the Digitalmars-d mailing list