The error is always the same: llvm-ar: Unknown command line argument '-r'. Try: '/usr/lib/llvm/4/bin/llvm-ar -help' llvm-ar: Did you mean '-M'? llvm-ar: Unknown command line argument '-c'. Try: '/usr/lib/llvm/4/bin/llvm-ar -help' llvm-ar: Did you mean '-M'? switching to gnu binutils works packages affected (I suspect all the haskell packages) but for now: dev-haskell/cabal dev-haskell/hscolour dev-haskell/primitive dev-haskell/mtl dev-haskell/text dev-haskell/regex-base dev-haskell/vector dev-haskell/hashable dev-haskell/parsec dev-haskell/regex-posix dev-haskell/hashtables dev-haskell/regex-compat
Created attachment 473566 [details] info info
Your --info file does not describe how exactly you override AR and other vars. Do you have an example build.log for a faulty package?
(In reply to Sergei Trofimovich from comment #2) > Your --info file does not describe how exactly you override AR and other > vars. > Do you have an example build.log for a faulty package? I use an "llvmbinutils" env file containing: AR="llvm-ar" NM="llvm-nm" RANLIB="llvm-ranlib"
Created attachment 473732 [details] dev-haskell:regex-compat-0.95.1:20170522-014516.log example faulty emerge log
Aha, thank you! I think it's two bugs: - Cabal bug to call 'ar -r' instead of 'ar r' - minor llvm's infelicity to be not completely compatible with binutils' ar I've reproduced the error as: AR=llvm-ar HCFLAGS=-v CABAL_EXTRA_BUILD_FLAGS=-v emerge -1 regex-compat The output is: /usr/bin/llvm-ar -r dist/build/objs-24254/libHSregex-compat-0.95.1-Kazzd2jv476D4Ig45iYvjr.a dist/build/Text/Regex.o llvm-ar: Unknown command line argument '-r'. Try: '/usr/bin/llvm-ar -help' llvm-ar: Did you mean '-M'?
Filed bug upstream as: https://github.com/haskell/cabal/issues/4530
Created attachment 473740 [details, diff] cabal-1.24.2.0-llvm-ar.patch cabal-1.24.2.0-llvm-ar.patch fixes cabal. The patch will need to be applied both to cabal and ghc.
On the other hand opengroup documents specify only ar -r form: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ar.html I'll file a bug report to llvm.
Found existing bug from 2014: https://bugs.llvm.org/show_bug.cgi?id=21712
Over to llvm@ on how they want to handle the mismatch on their side. Exact command example that does not work for llvm on linux: /usr/bin/llvm-ar -r dist/build/<foo>.a dist/build/<bar>.o llvm-ar: Unknown command line argument '-r'. Try: '/usr/bin/llvm-ar -help' llvm-ar: Did you mean '-M'?
I don't think we really support using llvm-ar in place of ar. If you feel like it, please submit a patch upstream. Though I'm not convinced it's major enough issue to deserve backporting it, so probably RESO/UPST with fix in next LLVM release including it.
Upstream got the fix as: https://github.com/llvm-mirror/llvm/commit/af481e4f940025c84ce601e68fdedbc1bd22cdd2
As said before, this is fixed in newer LLVM versions. Feel free to reopen if you really need this backported to 4.