[GHC] #7661: GHC build system does not detect opt-3.0 and friends

#7661: GHC build system does not detect opt-3.0 and friends --------------------------------+------------------------------------------- Reporter: singpolyma | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Building GHC failed | Blockedby: Blocking: | Related: --------------------------------+------------------------------------------- It is common to install LLVM tools with a version suffix (such as opt-3.0, llc-3.0, etc) so that multiple versions may co-exist. For example, the Debian package llvm-3.0 does this. It would be nice if the build system could detect such tools without needing `--with-opt`, etc, specifically. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends --------------------------------+------------------------------------------- Reporter: singpolyma | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Building GHC failed | Blockedby: Blocking: | Related: --------------------------------+------------------------------------------- Comment(by dterei): So I'm not that familiar with the build system and m4 but looking at this. However, wouldn't a user typically install llvm on Debian by installing the 'llvm' package. This installs the tools without version suffixes. Its arguable that in the case of a user installing llvm-3.0 package and not the llvm package we shouldn't be trying to handle this for them. My concern is that I'll only be able to detect opt-3.0 or opt-2.7 or opt-3.2 by enumerating different version possibilities in the configure.ac. Which seems ugly... -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends --------------------------------+------------------------------------------- Reporter: singpolyma | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Building GHC failed | Blockedby: Blocking: | Related: --------------------------------+------------------------------------------- Comment(by thoughtpolice): Well, those distributions typically make the GHC package (which you may use for a bootstrap compiler) depend specifically on llvm-3.0, for those co-existence reasons. And they're patched to specifically invoke those versions, just to be extra sure. So out of the box, you're not necessarily aware that you need the llvm package, or that it's even there! This is very much the case on my ARM/Linux installs (Ubuntu 12.10.) In general I just fix this by symlinking appropriately into my $HOME/bin. I think you could probably encapsulate most of the hairy machinery in an m4 macro to search for 'llc-X.Y' and 'opt-X.Y' variants, after looking for non-suffixed versions. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends --------------------------------+------------------------------------------- Reporter: singpolyma | Owner: dterei Type: feature request | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Building GHC failed | Blockedby: Blocking: | Related: --------------------------------+------------------------------------------- Changes (by dterei): * owner: => dterei Comment: Interesting. What do you mean by co-existence reasons sorry? This reason seems fairly compelling to me, just checked the ghc package on Ubuntu then. I'll sleep on it and write out the m4 macro tomorrow. (the ugliness of the macro isn't the concern, that is trivial, it's the maintenance of it for future llvm versions. Easy but annoying). -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends --------------------------------+------------------------------------------- Reporter: singpolyma | Owner: dterei Type: feature request | Status: new Priority: normal | Component: Compiler Version: 7.7 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Building GHC failed | Blockedby: Blocking: | Related: --------------------------------+------------------------------------------- Comment(by singpolyma): In my case I'm using llvm-3.0 because default llvm is 3.1, which has regressions when it comes to ARM. I'd suggest searching for opt-* and then checking if llc-samething exists and using both if found. Hardcoding a list of known suffixes seems bad. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends
--------------------------------+-------------------------------------------
Reporter: singpolyma | Owner: dterei
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: 7.7 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Building GHC failed | Blockedby:
Blocking: | Related:
--------------------------------+-------------------------------------------
Comment(by davidterei@…):
commit 64aaaa19aa32c69a13daa375c8316041a44eed5c
{{{
Author: David Terei

#7661: GHC build system does not detect opt-3.0 and friends ---------------------------------+------------------------------------------ Reporter: singpolyma | Owner: dterei Type: feature request | Status: closed Priority: normal | Component: Compiler Version: 7.7 | Resolution: fixed Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by dterei): * status: new => closed * resolution: => fixed -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends ---------------------------------+------------------------------------------ Reporter: singpolyma | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler Version: 7.7 | Resolution: Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by kgardas): * owner: dterei => * status: closed => new * resolution: fixed => Comment: Hi David, unfortunately this is not working on my Ubuntu 12.04.2 LTS on pandaboard. I do have both llc-3.0 and opt-3.0 in /usr/bin and in PATH: {{{ $ which llc-3.0 /usr/bin/llc-3.0 $ which opt-3.0 /usr/bin/opt-3.0 }}} but GHC's configure does not detect them. Configuring with simple ./configure ends with: {{{ Configure completed successfully. Building GHC version : 7.7.20130214 Build platform : arm-unknown-linux Host platform : arm-unknown-linux Target platform : arm-unknown-linux Bootstrapping using : /usr/bin/ghc which is version : 7.4.1 Using gcc : /usr/bin/gcc which is version : 4.6.3 Building a cross compiler : NO ld : /usr/bin/ld Happy : /usr/bin/happy (1.18.9) Alex : /usr/bin/alex (3.0.1) Perl : /usr/bin/perl dblatex : xsltproc : Using LLVM tools llc : opt : HsColour was not found; documentation will not contain source links }}} and settings file looks: {{{ $ cat settings [("GCC extra via C opts", " -fwrapv"), ("C compiler command", "/usr/bin/gcc"), ("C compiler flags", " -fno-stack-protector -Wl,--hash-size=31 -Wl ,--reduce-memory-overheads"), ("ld command", "/usr/bin/ld"), ("ld flags", " --hash-size=31 --reduce-memory-overheads"), ("ld supports compact unwind", "YES"), ("ld supports build-id", "YES"), ("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"), ("perl command", "/usr/bin/perl"), ("target os", "OSLinux"), ("target arch", "ArchARM {armISA = ARMv7, armISAExt = [VFPv3,NEON], armABI = HARD}"), ("target word size", "4"), ("target has GNU nonexec stack", "False"), ("target has .ident directive", "True"), ("target has subsections via symbols", "False"), ("Unregisterised", "NO"), ("LLVM llc command", "llc"), ("LLVM opt command", "opt") ] }}} There are two issues with this patch I'm able to see now. 1) in aclocal.m4 in FIND_LLVM_PROG you use {{{ if test "$1" == ""; then }}} but this should be: {{{ if test "$$1" == ""; then }}} to result in for example "$LLC" == "" instead of "LLC" == "" 2) Ubuntu (and Debian probably does the same), installs LLVM-3.0 package into /usr/lib/llvm-3.0 directory and creates a links to opt/llc into /usr/bin with the prefixes -3.0. That means: {{{ $ ls -la /usr/bin/llc-3.0 lrwxrwxrwx 1 root root 23 Dec 11 2011 /usr/bin/llc-3.0 -> ../lib/llvm-3.0/bin/llc }}} The result is that your find test where you find for file will not work as this is not a file, but link. You will also need to find for link (i.e. -type l) Both issues are fixed by attached patch. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends ---------------------------------+------------------------------------------ Reporter: singpolyma | Owner: dterei Type: feature request | Status: new Priority: normal | Component: Compiler Version: 7.7 | Resolution: Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by kgardas): * owner: => dterei -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends ---------------------------------+------------------------------------------ Reporter: singpolyma | Owner: dterei Type: feature request | Status: patch Priority: normal | Component: Compiler Version: 7.7 | Resolution: Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by kgardas): * status: new => patch -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends ---------------------------------+------------------------------------------ Reporter: singpolyma | Owner: dterei Type: feature request | Status: closed Priority: normal | Component: Compiler Version: 7.7 | Resolution: fixed Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by dterei): * status: patch => closed * resolution: => fixed Comment: Thanks Karel! I went with a slightly modified version of your patch as I want configure to find the highest version of the llvm tools regardless if the some of the binaries are files or links. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends
---------------------------------+------------------------------------------
Reporter: singpolyma | Owner: dterei
Type: feature request | Status: closed
Priority: normal | Component: Compiler
Version: 7.7 | Resolution: fixed
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: Building GHC failed
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by davidterei@…):
commit c043732145c274476f904d9b4387740b2a47b401
{{{
Author: David Terei

#7661: GHC build system does not detect opt-3.0 and friends
---------------------------------+------------------------------------------
Reporter: singpolyma | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: 7.7 | Resolution:
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: Building GHC failed
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Changes (by singpolyma):
* owner: dterei =>
* status: closed => new
* resolution: fixed =>
Comment:
This has regressed. Bisect sez:
{{{
355002c40254f27bb5ca817d7d2664fa58e9640c is the first bad commit
commit 355002c40254f27bb5ca817d7d2664fa58e9640c
Author: David Terei

#7661: GHC build system does not detect opt-3.0 and friends ---------------------------------+------------------------------------------ Reporter: singpolyma | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler Version: 7.7 | Resolution: Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Comment(by singpolyma): The following fixes this regression: {{{ diff --git a/aclocal.m4 b/aclocal.m4 index 2ab4ad5..dab7438 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2022,7 +2022,7 @@ AC_DEFUN([FIND_LLVM_PROG],[ for p in ${PATH}; do if test -d "${p}"; then $1=`${FindCmd} "${p}" -type f -perm +111 -maxdepth 1 -regex '. - if test -n "$1"; then + if test -n "$$1"; then break fi fi }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends ---------------------------------+------------------------------------------ Reporter: singpolyma | Owner: dterei Type: feature request | Status: new Priority: normal | Component: Compiler Version: 7.7 | Resolution: Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by singpolyma): * owner: => dterei -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends ---------------------------------+------------------------------------------ Reporter: singpolyma | Owner: dterei Type: feature request | Status: patch Priority: normal | Component: Compiler Version: 7.7 | Resolution: Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by singpolyma): * status: new => patch -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7661: GHC build system does not detect opt-3.0 and friends
---------------------------------+------------------------------------------
Reporter: singpolyma | Owner: dterei
Type: feature request | Status: patch
Priority: normal | Component: Compiler
Version: 7.7 | Resolution:
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: Building GHC failed
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by davidterei@…):
commit f2c477e6c2e7753997947bb0395be99faca169b9
{{{
Author: David Terei

#7661: GHC build system does not detect opt-3.0 and friends ---------------------------------+------------------------------------------ Reporter: singpolyma | Owner: dterei Type: feature request | Status: closed Priority: normal | Component: Compiler Version: 7.7 | Resolution: fixed Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Building GHC failed Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by dterei): * status: patch => closed * resolution: => fixed Comment: Thanks, pushed. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7661#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (2)
-
GHC
-
GHC