Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 674662 - >=sys-devel/llvm-8.0.0_rc2 fails to configure with Cmake Error: cannot find /usr/include/cblas.h
Summary: >=sys-devel/llvm-8.0.0_rc2 fails to configure with Cmake Error: cannot find /...
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: https://reviews.llvm.org/D59632
Whiteboard:
Keywords:
: 681326 681560 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-01-06 09:58 UTC by tt_1
Modified: 2019-04-05 05:13 UTC (History)
14 users (show)

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


Attachments
compressed build log (build.log.gz,4.22 KB, application/gzip)
2019-01-06 09:58 UTC, tt_1
Details
compressed tmp dir, includes build.log + environement (llvm-8.0.0_rc2.tar.xz,294.15 KB, application/x-xz)
2019-02-27 16:04 UTC, tt_1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tt_1 2019-01-06 09:58:17 UTC
Created attachment 560080 [details]
compressed build log

emerge -pv =llvm-9999

Calculating dependencies... done!
[ebuild  NS   *] sys-devel/llvm-9999:8::gentoo [6.0.1-r2:6::gentoo] USE="libffi ncurses xml -debug -doc -exegesis -gold -libedit -test -xar" ABI_X86="(64) -32 (-x32)" LLVM_TARGETS="AMDGPU ARM (X86) -AArch64 -AVR -BPF -Hexagon -Lanai -MSP430 -Mips -NVPTX -Nios2 -PowerPC -RISCV -Sparc -SystemZ -WebAssembly -XCore" 0 KiB

Total: 1 package (1 in new slot), Size of downloads: 0 KiB

 
the header in question can be installed by emerging sci-libs/cblas-reference, so a propper fix might be to add virtual/cblas in RDEPEND?
Comment 1 Nikos Chantziaras 2019-02-22 04:18:59 UTC
This error now affects sys-devel/llvm-8.0.0_rc*.
Comment 2 tt_1 2019-02-22 07:46:52 UTC
Adjusted the description accordingly. Is it sufficent for you to emerge virtual/cblas?
Comment 3 Nikos Chantziaras 2019-02-23 06:47:44 UTC
(In reply to tt_1 from comment #2)
> Is it sufficent for you to emerge virtual/cblas?
Yes. Builds fine after that.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-02-23 08:02:04 UTC
I'm sorry, did we come to any conclusion where this thing is coming from?
Comment 5 Nikos Chantziaras 2019-02-23 08:24:45 UTC
(In reply to Michał Górny from comment #4)
> I'm sorry, did we come to any conclusion where this thing is coming from?
No idea. A "grep -ri cblas" comes up empty, so that cblas code probably comes from some external .cmake file?
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-02-23 08:26:53 UTC
That's what I suspect as well.  Could you grep the build log after installing cblas to see where it's referenced?
Comment 7 Nikos Chantziaras 2019-02-23 09:06:55 UTC
grep -ri lapack /var/tmp/portage/sys-devel/llvm-8.0.0_rc2
/var/tmp/portage/sys-devel/llvm-8.0.0_rc2/temp/environment:declare -- CMAKE_REMOVE_MODULES_LIST="FindBLAS FindLAPACK"


Nothing else.
Comment 8 Nikos Chantziaras 2019-02-23 09:08:50 UTC
Wrong paste. I grepped for "blas":

$ grep -ri blas /var/tmp/portage/sys-devel/llvm-8.0.0_rc2
/var/tmp/portage/sys-devel/llvm-8.0.0_rc2/temp/environment:declare -- CMAKE_REMOVE_MODULES_LIST="FindBLAS FindLAPACK"
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-02-23 21:19:03 UTC
Build log, not environment.  If it's finding it, it should report something.  Maybe the context could suggest where it's coming from.

What I'm trying to figure out first, is whether cblas is a indirect dependency of something LLVM uses, or some random module interaction that really shouldn't happen.
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-02-23 21:19:55 UTC
Also, if we hurry and it's upstream issue, we may able to get the fix before 8.0.0 final.
Comment 11 Nikos Chantziaras 2019-02-24 08:09:12 UTC
(In reply to Michał Górny from comment #9)
> Build log, not environment. 

It's a "grep -ri". It searches everything. Build log included.
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-02-24 09:07:09 UTC
(In reply to Nikos Chantziaras from comment #11)
> (In reply to Michał Górny from comment #9)
> > Build log, not environment. 
> 
> It's a "grep -ri". It searches everything. Build log included.

Not necessarily.  It doesn't follow symlinks, and if you happen to use PORT_LOGDIR, build log is a symlink.  Also it wouldn't work if you used compressed build logs.
Comment 13 tt_1 2019-02-27 15:06:10 UTC
if virtual/cblas is emerged, there is no difference whatsoever in the build dir when grepping for 'cblas', see this grep for:

grep -ri blas /var/tmp/portage/sys-devel/llvm-8.0.0_rc2/

/var/tmp/portage/sys-devel/llvm-8.0.0_rc2/work/llvm-8.0.0rc2.src/lib/XRay/FDRTraceWriter.cpp:  // appear and that we expect, instead of blasting bytes of the struct through.
/var/tmp/portage/sys-devel/llvm-8.0.0_rc2/work/llvm-8.0.0rc2.src/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:// replace them with calls to BLAS (if linked in??).
/var/tmp/portage/sys-devel/llvm-8.0.0_rc2/work/llvm-8.0.0rc2.src/lib/IR/AsmWriter.cpp:  // If we didn't need any quotes, just write out the name in one blast.
/var/tmp/portage/sys-devel/llvm-8.0.0_rc2/work/llvm-8.0.0rc2.src/lib/Support/ErrorHandling.cpp:    // Blast the result out to stderr.  We don't try hard to make sure this
/var/tmp/portage/sys-devel/llvm-8.0.0_rc2/work/llvm-8.0.0rc2.src/lib/Passes/PassBuilder.cpp:  // Re-require GloblasAA here prior to function passes. This is particularly
/var/tmp/portage/sys-devel/llvm-8.0.0_rc2/temp/environment:declare -- CMAKE_REMOVE_MODULES_LIST="FindBLAS FindLAPACK"
Comment 14 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-02-27 15:12:31 UTC
I'm still waiting for the new build log.
Comment 15 tt_1 2019-02-27 16:04:01 UTC
Created attachment 566660 [details]
compressed tmp dir, includes build.log + environement

Ok, so I emerged with FEATURES="${FEATURES} keeptemp", the result is attached. virtual/cblas was emerged before the emerge of llvm.
Comment 16 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-02-27 19:33:05 UTC
This really looks like some deep internal CMake problem.  @kde, any ideas?
Comment 17 Georgy Yakovlev archtester gentoo-dev 2019-03-10 08:13:23 UTC
look at the patch we carry in rust for it's internal llvm - same problem, because rust's llvm is 7 + some commits on top.

https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-lang/rust/files/1.32.0-fix-configure-of-bundled-llvm.patch

which reverts 

https://github.com/llvm-mirror/llvm/commit/6fb010f388bb2cb2f00fe039123092308ac4865d

to me it looks like cmake finds stale/broken symlink and tries to links and fails if actual libs/headers are not present, I may be wrong tho.
Comment 18 tt_1 2019-03-10 08:22:48 UTC
The patch, with adjusted path for llvm standalone, applies cleanly and seems to solve to initial problem.
Comment 19 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-03-10 08:26:38 UTC
Yeah, I guess that'd make sense.

lib/Support/CMakeLists.txt has:

  ADDITIONAL_HEADER_DIRS
  [...]
  ${Backtrace_INCLUDE_DIRS}

where Backtrace_INCLUDE_DIRS is /usr/include.  Lemme try to figure out if scanning this directory is really expected here.
Comment 20 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-03-21 06:19:03 UTC
The patch from D59632 should take care of it.
Comment 21 Thomas Deutschmann (RETIRED) gentoo-dev 2019-03-21 16:16:05 UTC
You have orphan symlinks in /usr, see bug 675752.

For dev-lang/rust we did https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d50382655a40e343363d82b7c371a06660b9bdf8 to hide the problem but to be honest, we should drop the patch and people should fix /usr and of course, upstream should revert that patch. :)
Comment 22 Thomas Deutschmann (RETIRED) gentoo-dev 2019-03-21 16:17:12 UTC
Oh, Georgy already said that in comment #17, sorry :)
Comment 23 Nikos Chantziaras 2019-03-21 16:47:40 UTC
(In reply to Thomas Deutschmann from comment #21)
> people should fix /usr

These broken symlinks are left behind by the cblas package. When you emerge virtual/cblas, the symlinks are created by they don't belong to any package. When you unmerge/depclean, portage doesn't remove them since they don't belong to any package.
Comment 24 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-03-23 06:43:01 UTC
*** Bug 681326 has been marked as a duplicate of this bug. ***
Comment 25 rnddim 2019-03-24 06:10:10 UTC
I'm having a very similar problem on =sys-devel/llvm-8.0.0 with a broken symlink header, but for me it's /usr/include/pg_config_ext.h (which appears to be a postgresql thing). Is it related or should I file a separate bug? (If it is part of the same underlying issue, I'd suggest renaming the bug so it's clear it's not cblas-specific.)
Comment 26 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-03-24 15:32:34 UTC
*** Bug 681560 has been marked as a duplicate of this bug. ***
Comment 27 farmboy0 2019-03-25 18:34:23 UTC
I can confirm that removing stale symlinks for cblas and blas pgkconfig and headers makes this ebuild emergable again.
Comment 28 tt_1 2019-03-27 14:21:57 UTC
There is a file /usr/include/cblash.h on my system, but it doesn't belong to any package. Removing it, and the configure problem of llvm is solved.
Comment 29 László Szalma 2019-04-03 15:01:05 UTC
I confirm removing the stale symlink /usr/include/cblas.h solved the problem.

It hadn't belong to any package: equery b /usr/include/cblas.h

The broken symlink was from 2013 on my system by the way.
Comment 30 Alexey Skobkin 2019-04-03 17:20:18 UTC
Removing broken symlink fixed building for me too.
Comment 31 chris.murtagh1 2019-04-03 20:58:27 UTC
my system actually didn't even try to bring in cblas or any other and just outright failed..  after emergeing virtual/cblas 3.7 llvm was able to finish compiling..  

there were no previous symlinks that were broken on my system in this instance, just the missing packages.
Comment 32 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-04-04 14:20:22 UTC
I've pushed the change upstream.  If nothing breaks in the next hour or two, I'll push it to Gentoo as well.
Comment 33 Larry the Git Cow gentoo-dev 2019-04-05 05:13:30 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b6a6ed19f30f4f30af53b2426c57194626715e7

commit 4b6a6ed19f30f4f30af53b2426c57194626715e7
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2019-04-05 05:02:42 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2019-04-05 05:13:19 +0000

    sys-devel/llvm: Backport dangling symlink failure fix
    
    Closes: https://bugs.gentoo.org/674662
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 ...Add-additional-headers-only-if-they-exist.patch |  41 +++
 sys-devel/llvm/llvm-8.0.0-r1.ebuild                | 301 +++++++++++++++++++++
 2 files changed, 342 insertions(+)