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.
Trac metadata
Trac field
Value
Version
7.7
Type
FeatureRequest
TypeOfFailure
OtherFailure
Priority
normal
Resolution
Unresolved
Component
Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related or that one is blocking others.
Learn more.
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...
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. 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.) This is the annoying bit. 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.
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).
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.
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" == ""
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)
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.