Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 591690 - sys-devel/llvm: we should not change llvm-config output
Summary: sys-devel/llvm: we should not change llvm-config output
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-19 15:40 UTC by William Hubbs
Modified: 2016-08-21 20:16 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description William Hubbs gentoo-dev 2016-08-19 15:40:13 UTC
Currently, the output of llvm-config is different from the way upstream
behaves, and I have heard that upstream does not plan to accept our
changes.

Our changes mean that dev-lang/rust must be built with its bundled llvm
instead of the one we provide.

I am opening this bug to discuss why we modify llvm-config and attempt
to find another way to get the same result.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-19 16:58:36 UTC
No. This is just stupid FUD made by one person who was too lazy/arrogant to even bother trying to ask what's up and instead went all the way 'you made my toy stop working, I'm going to do a huge QA violation to prove something stupid'.

That said, someone should bother telling us what's wrong with rust first. Because really telling 'it uses this unsupported option, we must start supporting it immediately' is not anywhere close to helpful.
Comment 2 Dirkjan Ochtman (RETIRED) gentoo-dev 2016-08-19 18:52:54 UTC
This is the error I got from rust-1.11.0 (it worked fine in 1.10.0):

llvm-config: sources not installed, --obj-root not available
CMake Error at CMakeLists.txt:100 (message):
  llvm-config failed with status 1


-- Configuring incomplete, errors occurred!
See also "/var/tmp/portage/dev-lang/rust-1.11.0/work/rustc-1.11.0/x86_64-unknown-linux-gnu/rt/compiler-rt/CMakeFiles/CMakeOutput.log".
/var/tmp/portage/dev-lang/rust-1.11.0/work/rustc-1.11.0/mk/rt.mk:465: recipe for target 'x86_64-unknown-linux-gnu/rt/libcompiler-rt.a' failed
make: *** [x86_64-unknown-linux-gnu/rt/libcompiler-rt.a] Error 1
make: *** Waiting for unfinished jobs....

Full build log is here: https://dirkjan.ochtman.nl/files/build.log

It's worth noting that upstream stopped using compiler-rt's CMake build system after branching the 1.11.0 release. I tried to backport their patch for this, but that didn't seem to solve the problem.

Still, it would sure be nice if we can use the system LLVM to build rust.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-19 19:00:30 UTC
It still does not explain why rust needs --obj-root. That directory does not exist on installed LLVM.
Comment 4 Dirkjan Ochtman (RETIRED) gentoo-dev 2016-08-19 19:02:30 UTC
It's not rust that needs it, it's compiler-rt's build system. Apparently it has a reputation for being particularly shitty.

https://github.com/rust-lang/rust/commit/ee6011fc71e02485f2dffcc25be64631c2008775
Comment 5 Dirkjan Ochtman (RETIRED) gentoo-dev 2016-08-19 19:03:37 UTC
I talked to some people in #llvm earlier today. They told me that it's probably not possible to build compiler-rt outside of an LLVM build without hacking the build system. They said it's probably not too hard to hack it to do that, although running the tests would be a completely different story.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-19 19:25:05 UTC
Why is rust building compiler-rt when LLVM installs one already?
Comment 7 Dirkjan Ochtman (RETIRED) gentoo-dev 2016-08-20 05:54:20 UTC
I don't know exactly. When I asked, they said it's because not every platform has it (e.g. Windows). Anyway, maybe it would be more productive if you talk to the Rust developers directly, it doesn't seem very efficient for me to be a go-between.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-20 09:54:48 UTC
Well, if they are bundling compiler-rt on Linux because Windows may not have it, you may guess what the fix is. Besides, I heard there were some improvements in compiler-rt build system, so it may eventually be fixed on that side as well.

That said, I can look at rust when I have time. However, I have little time and my current focus is splitting clang again. This will take quite a while, and require some patching. It may also find problems with compiler-rt itself.
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-20 10:05:59 UTC
The easy way out would be to output known-wrong paths. Maybe /dev/null for both. This will get ENOTDIR when they actually try to do something, and most of the build systems seem to handle checking subpaths for existence first.
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-21 09:49:15 UTC
Ok, looked into it more and it looks like upstream is actually relying on --obj-root returning prefix when installed, however stupid that is. So --obj-root back to /usr, and --src-root to /dev/null.

Do we find this important enough to warrant a revbump right now? Or do we have some other changes to apply?
Comment 11 Dirkjan Ochtman (RETIRED) gentoo-dev 2016-08-21 11:23:29 UTC
Well, I would really like to version bump to the latest stable Rust compiler in the tree. Not sure whether you consider that important enough...
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-21 16:56:21 UTC
Good news, 3.8.1-r1 is still p.masked, so I guess I can add this and unmask it.
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-21 18:54:44 UTC
commit bf383aa2d04fcd952e797cb872eb08096061c307
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: Sun Aug 21 20:34:41 2016
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: Sun Aug 21 20:50:44 2016

    sys-devel/llvm: Improve llvm-config upstream compatibility, #591690
    
    Improve the llvm-config installed by 3.8.1-r1 (masked) and the live
    ebuild to match upstream behavior better, and be more compatible with
    packages. Restore --obj-root to return prefix on installed package, and
    make --src-root return invalid /dev/null path instead of failing.
    
    Bug: https://bugs.gentoo.org/591690


Please try against llvm-3.8.1-r2.
Comment 14 Dirkjan Ochtman (RETIRED) gentoo-dev 2016-08-21 19:42:09 UTC
Thanks! This seems to work for the rust-1.11.0 build. What are your plans regarding unmasking 3.8.1?
Comment 15 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-21 20:16:17 UTC
(In reply to Dirkjan Ochtman from comment #14)
> Thanks! This seems to work for the rust-1.11.0 build. What are your plans
> regarding unmasking 3.8.1?

It's live already, though it lost few keywords on less common arches due to libcxx.