Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 619138 - =sys-devel/llvm-4.0.0-r2: llvm-ar does not support 'ar -r' (and friends)
Summary: =sys-devel/llvm-4.0.0-r2: llvm-ar does not support 'ar -r' (and friends)
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: LLVM support project
URL: https://bugs.llvm.org/show_bug.cgi?id...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-21 04:42 UTC by Alessandro Barbieri
Modified: 2018-03-14 14:02 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
info (info,12.88 KB, text/plain)
2017-05-21 04:43 UTC, Alessandro Barbieri
Details
dev-haskell:regex-compat-0.95.1:20170522-014516.log (dev-haskell:regex-compat-0.95.1:20170522-014516.log,10.45 KB, text/plain)
2017-05-22 01:47 UTC, Alessandro Barbieri
Details
cabal-1.24.2.0-llvm-ar.patch (cabal-1.24.2.0-llvm-ar.patch,1.02 KB, patch)
2017-05-22 08:24 UTC, Sergei Trofimovich (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Barbieri 2017-05-21 04:42:25 UTC
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
Comment 1 Alessandro Barbieri 2017-05-21 04:43:11 UTC
Created attachment 473566 [details]
info

info
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2017-05-22 00:16:29 UTC
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?
Comment 3 Alessandro Barbieri 2017-05-22 01:46:19 UTC
(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"
Comment 4 Alessandro Barbieri 2017-05-22 01:47:38 UTC
Created attachment 473732 [details]
dev-haskell:regex-compat-0.95.1:20170522-014516.log

example faulty emerge log
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2017-05-22 07:41:20 UTC
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'?
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2017-05-22 07:47:58 UTC
Filed bug upstream as: https://github.com/haskell/cabal/issues/4530
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2017-05-22 08:24:25 UTC
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.
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2017-05-22 08:41:52 UTC
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.
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2017-05-22 08:51:18 UTC
Found existing bug from 2014: https://bugs.llvm.org/show_bug.cgi?id=21712
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2017-05-22 08:55:23 UTC
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'?
Comment 11 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-05-22 09:19:20 UTC
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.
Comment 12 Sergei Trofimovich (RETIRED) gentoo-dev 2017-11-03 20:41:37 UTC
Upstream got the fix as: https://github.com/llvm-mirror/llvm/commit/af481e4f940025c84ce601e68fdedbc1bd22cdd2
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-03-14 14:02:14 UTC
As said before, this is fixed in newer LLVM versions. Feel free to reopen if you really need this backported to 4.