Bug#822820: gcl: FTBFS with compilers that default to -fPIE (patch attached)

2016-05-05 Thread Adam Conrad
On Wed, May 04, 2016 at 11:43:13AM -0400, Camm Maguire wrote:
> 
> I intend to sanitize this in the gcl configure script, as is already
> done on an ad-hoc basis for osx.  The problem is getting the semantics
> right for both gcc and clang interfaces to the linker.  With gcc,
> *appending* -no-pie to user supplied LDFLAGS works.  clang has no such
> switch, but does have -pie.  Furthermore, on linux, both 'clang -pie
> -Wl,-no_pie' and 'clang -Wl,-no_pie' fail, though the latter works on
> darwin.  

I suspect clang will follow suit with gcc and grow "-fno-pie -no-pie" at
some point, but that certainly won't work today.  That's why I fixed it
in the Debian packaging for now, since only shiny/new versions of GCC
have those flags, and you already specify gcc in your rules file.

I have to figure out similar configure magic for upstream glibc soon, so
if I come up with a good upstreamish solution, I'll recall this convo
and let you know, but for now, the debian/rules hack is better than no
change (and a constant reminder to fix it right later :P)

... Adam



Bug#822820: gcl: FTBFS with compilers that default to -fPIE (patch attached)

2016-05-04 Thread Camm Maguire
Greetings, and thanks!  I now understand the issue, and it is true that
GCL will never work with a position independent executable, as it uses
unexec to save memory images to disk for later restart.

I intend to sanitize this in the gcl configure script, as is already
done on an ad-hoc basis for osx.  The problem is getting the semantics
right for both gcc and clang interfaces to the linker.  With gcc,
*appending* -no-pie to user supplied LDFLAGS works.  clang has no such
switch, but does have -pie.  Furthermore, on linux, both 'clang -pie
-Wl,-no_pie' and 'clang -Wl,-no_pie' fail, though the latter works on
darwin.  

Any suggestions here?

Take care,

Adam Conrad  writes:

> On Tue, May 03, 2016 at 12:38:26PM -0400, Camm Maguire wrote:
>> 
>> Greetings!  I can add -fPIE without issue to the build flags used for
>> the failed target you report in an up-to-date Debian unstable chroot
>> (amd64). 
>
> Add "-fPIE -pie" (the latter being the linker command, the former should
> not be used without it), and watch the fireworks.
>
> ... Adam
>
>
>
>

-- 
Camm Maguirec...@maguirefamily.org
==
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah



Bug#822820: gcl: FTBFS with compilers that default to -fPIE (patch attached)

2016-05-03 Thread Adam Conrad
On Tue, May 03, 2016 at 12:38:26PM -0400, Camm Maguire wrote:
> 
> Greetings!  I can add -fPIE without issue to the build flags used for
> the failed target you report in an up-to-date Debian unstable chroot
> (amd64). 

Add "-fPIE -pie" (the latter being the linker command, the former should
not be used without it), and watch the fireworks.

... Adam



Bug#822820: gcl: FTBFS with compilers that default to -fPIE (patch attached)

2016-05-03 Thread Camm Maguire
tags 822820 unreproducible
thanks

Greetings!  I can add -fPIE without issue to the build flags used for
the failed target you report in an up-to-date Debian unstable chroot
(amd64). 

Take care, 

Adam Conrad  writes:

> Package: gcl
> Version: 2.6.12-32
> Severity: normal
> Tags: patch
> User: ubuntu-de...@lists.ubuntu.com
> Usertags: origin-ubuntu yakkety ubuntu-patch
>
>
>
> In Ubuntu, the attached patch was applied to achieve the following:
>
>   * Set CC to 'gcc -fno-pie -no-pie' to prevent FTBFS (LP: #1557236)
>
> The patch itself should be self-explanatory.  In Ubuntu, we now default
> to '-fPIE -pie' on amd64, ppc64el, and s390x.  Turns out that gcl, when
> compiled with -fPIE breaks rather spectacularly.
>
> This patch should be a no-op for Debian, but it's good future-proofing
> against a time when Debian may choose to change their defaults as well.
>
> Compare build resutls before:
>
> https://launchpad.net/ubuntu/+source/gcl/2.6.12-32
>
> And after:
>
> https://launchpad.net/ubuntu/+source/gcl/2.6.12-32ubuntu1
>
> ... Adam
>
> -- System Information:
> Debian Release: stretch/sid
>   APT prefers yakkety-updates
>   APT policy: (500, 'yakkety-updates'), (500, 'yakkety-security'), (500, 
> 'yakkety')
> Architecture: amd64 (x86_64)
> Foreign Architectures: i386
>
> Kernel: Linux 4.4.0-21-lowlatency (SMP w/4 CPU cores; PREEMPT)
> Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
>

-- 
Camm Maguirec...@maguirefamily.org
==
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah



Bug#822820: gcl: FTBFS with compilers that default to -fPIE (patch attached)

2016-04-27 Thread Adam Conrad
Package: gcl
Version: 2.6.12-32
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu yakkety ubuntu-patch



In Ubuntu, the attached patch was applied to achieve the following:

  * Set CC to 'gcc -fno-pie -no-pie' to prevent FTBFS (LP: #1557236)

The patch itself should be self-explanatory.  In Ubuntu, we now default
to '-fPIE -pie' on amd64, ppc64el, and s390x.  Turns out that gcl, when
compiled with -fPIE breaks rather spectacularly.

This patch should be a no-op for Debian, but it's good future-proofing
against a time when Debian may choose to change their defaults as well.

Compare build resutls before:

https://launchpad.net/ubuntu/+source/gcl/2.6.12-32

And after:

https://launchpad.net/ubuntu/+source/gcl/2.6.12-32ubuntu1

... Adam

-- System Information:
Debian Release: stretch/sid
  APT prefers yakkety-updates
  APT policy: (500, 'yakkety-updates'), (500, 'yakkety-security'), (500, 
'yakkety')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-21-lowlatency (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru gcl-2.6.12/debian/rules gcl-2.6.12/debian/rules
--- gcl-2.6.12/debian/rules	2016-04-05 18:13:43.0 -0600
+++ gcl-2.6.12/debian/rules	2016-04-27 14:33:26.0 -0600
@@ -12,6 +12,10 @@
 # This is the debhelper compatability version to use.
 ARCHT:=$(shell dpkg-architecture -qDEB_HOST_ARCH)
 
+# gcl breaks when built with a compiler that sets '-fPIE -pie' by default
+# so we explicitly set CC to "$(MCC) $(PIE)" to pretend we're not.
+PIE:=-fno-pie -no-pie
+
 MCC:=gcc
 # ifeq ($(ARCHT),alpha)
 # MCC:=gcc-4.6
@@ -87,7 +91,7 @@
 	[ "$*" != "trad" ] || FLAGS="--disable-ansi" ; \
 	[ "$*" != "gprof" ] || FLAGS="--disable-ansi --enable-gprof" ; \
 	[ "$*" != "ansi-gprof" ] || FLAGS="--enable-gprof" ; \
-	eval `dpkg-buildflags --export=sh` && CC=$(MCC) ./configure \
+	eval `dpkg-buildflags --export=sh` && CC="$(MCC) $(PIE)" ./configure \
 		--host=$$(dpkg-architecture -qDEB_HOST_GNU_TYPE) \
 		--disable-statsysbfd \
 		--disable-custreloc \