[GHC] #13771: ghc fails to build on openSUSE

#13771: ghc fails to build on openSUSE --------------------------------------+--------------------------------- Reporter: msuchanek | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Keywords: | Operating System: Linux Architecture: x86_64 (amd64) | Type of failure: None/Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: --------------------------------------+--------------------------------- The gcc on openSUSE defaults to -pie and reverting that fixes the build. The gcc does not set any define with -pie or -no-pie. The -no-pie flag is detected but the build fails nonetheless. Adding the PIC flag does not help: {{{ @@ -3650,6 +3650,7 @@ default_PIC :: Platform -> [GeneralFlag] default_PIC platform = case (platformOS platform, platformArch platform) of (OSDarwin, ArchX86_64) -> [Opt_PIC] + (OSLinux, ArchX86_64) -> [Opt_PIC] (OSOpenBSD, ArchX86_64) -> [Opt_PIC] -- Due to PIE support in -- OpenBSD since 5.3 release -- (1 May 2013) we need to }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13771 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13771: ghc fails to build on openSUSE ---------------------------------+-------------------------------------- Reporter: msuchanek | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by msuchanek): * Attachment "_log.txt.xz" added. log of failed build -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13771 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13771: ghc fails to build on openSUSE ---------------------------------+-------------------------------------- Reporter: msuchanek | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by bgamari):
The -no-pie flag is detected but the build fails nonetheless.
How in particular are you confirming that `-no-pie` is detected? What does the `settings` file look like in the root of the source tree? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13771#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13771: ghc fails to build on openSUSE ---------------------------------+-------------------------------------- Reporter: msuchanek | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by msuchanek): [ 48s] checking whether GCC supports -no-pie... yes settings (from different machine, unfortunately) - the original machine has been upgraded to gcc7 which fails to build in-tree ghc-pwd during configure and produces no settings anymore. This happens at most once in five years ;-) {{{ [("GCC extra via C opts", " -fwrapv -fno-builtin"), ("C compiler command", "/usr/bin/gcc"), ("C compiler flags", " -fno-stack-protector"), ("C compiler link flags", ""), ("C compiler supports -no-pie", "YES"), ("Haskell CPP command","/usr/bin/gcc"), ("Haskell CPP flags","-E -undef -traditional"), ("ld command", "/usr/bin/ld"), ("ld flags", ""), ("ld supports compact unwind", "YES"), ("ld supports build-id", "YES"), ("ld supports filelist", "NO"), ("ld is GNU ld", "YES"), ("ar command", "/usr/bin/ar"), ("ar flags", "q"), ("ar supports at file", "YES"), ("touch command", "touch"), ("dllwrap command", "/bin/false"), ("windres command", "/bin/false"), ("libtool command", "libtool"), ("perl command", "/usr/bin/perl"), ("cross compiling", "NO"), ("target os", "OSLinux"), ("target arch", "ArchX86_64"), ("target word size", "8"), ("target has GNU nonexec stack", "True"), ("target has .ident directive", "True"), ("target has subsections via symbols", "False"), ("Unregisterised", "NO"), ("LLVM llc command", "llc"), ("LLVM opt command", "opt") ] }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13771#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13771: ghc fails to build on openSUSE
---------------------------------+--------------------------------------
Reporter: msuchanek | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64 (amd64)
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
---------------------------------+--------------------------------------
Comment (by msuchanek):
ok, so as I understand the issue distributions are moving towards
compiling with -fPIE -pie or whatever is the current flag for whatever
reason. It seems on SUSE these flags are added to rpm flags on the build
service meaning system binaries are built with them but locally compiled
binaries are not.
Adding these flags requires that object files must be built with -fPIC and
gcc complains if it is not the case and refuses to link binaries.
== Issue: gcc started using PIE on system with ghc installed
==== simulation:
{{{
# mv /usr/bin/gcc /usr/bin/gcc.real
cat > /usr/bin/gcc <
participants (1)
-
GHC