Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 506594 - sys-devel/llvm-3.4 fails to build for ABI=x32
Summary: sys-devel/llvm-3.4 fails to build for ABI=x32
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Clang Team (OBSOLETE)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: x32
  Show dependency tree
 
Reported: 2014-04-02 19:21 UTC by Luke-Jr
Modified: 2016-08-16 16:46 UTC (History)
3 users (show)

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


Attachments
emerge --info (emerge--info,19.47 KB, text/plain)
2014-04-02 19:23 UTC, Luke-Jr
Details
llvm-3.6.0_rc3 build failure (build.log.xz,158.34 KB, application/x-xz)
2015-02-23 05:14 UTC, Luke-Jr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke-Jr 2014-04-02 19:21:45 UTC
Seems to mostly compile fine, but clang has a very odd issue when it comes to making (intermediate?) libraries:
x86_64-pc-linux-gnux32-ranlib: /var/tmp/portage/sys-devel/llvm-3.4/work/llvm-3.4-x32/Release/lib/libclangASTMatchers.a: Memory exhausted

I have 16 GB RAM, and plenty of swap (which I'd have noticed if it got used), so I guess this is a virtual memory issue? On the other hand, I've built LLVM 3.4 on the regular x86_32 ABI just fine...
Comment 1 Luke-Jr 2014-04-02 19:23:28 UTC
Created attachment 374104 [details]
emerge --info
Comment 2 Luke-Jr 2014-04-02 19:39:58 UTC
Actually, clang is a separate ebuild, so I'm not clear on why the library name here has "clang" in it.
Comment 3 Bertrand Jacquin 2014-04-02 20:10:38 UTC
Maybe linked with #480378

And also http://llvm.org/bugs/show_bug.cgi?id=13666
Comment 4 Julian Ospald 2014-04-02 23:46:04 UTC
what does

file /usr/bin/clang

say?
Comment 5 Bertrand Jacquin 2014-04-02 23:59:30 UTC
(In reply to Julian Ospald (hasufell) from comment #4)
> what does
> 
> file /usr/bin/clang
> 
> say?

$ file /usr/bin/clang
/usr/bin/clang: ELF 32-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.4.0, stripped

$ objdump -f /usr/bin/clang
/usr/bin/clang:     file format elf32-x86-64
architecture: i386:x64-32, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x005c8fd8

$ qfile -v file /usr/bin/clang
sys-devel/clang-3.2 (/usr/bin/clang)
Comment 6 Luke-Jr 2014-04-03 01:41:01 UTC
Unsurprisingly:
  /usr/bin/clang: cannot open `/usr/bin/clang' (No such file or directory)

Can't get clang if LLVM won't build...?
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-04-14 15:23:21 UTC
Does it build for you with USE=-clang?
Comment 8 Bertrand Jacquin 2014-04-14 19:11:20 UTC
(In reply to Michał Górny from comment #7)
> Does it build for you with USE=-clang?

yes, sys-devel/llvm-3.4-r1 does
Comment 9 Luke-Jr 2014-04-15 00:33:51 UTC
(In reply to Michał Górny from comment #7)
> Does it build for you with USE=-clang?

Yes
Comment 10 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-04-15 05:40:55 UTC
(In reply to Luke-Jr from comment #9)
> (In reply to Michał Górny from comment #7)
> > Does it build for you with USE=-clang?
> 
> Yes

As an interim measure, we can disable USE=clang on x32 then, and mask everything clang-related until upstream fixes the build issues.
Comment 11 Bernard Cafarelli gentoo-dev 2015-02-20 15:57:50 UTC
Both llvm and clang finally build on x32 with upcoming 3.6 version :) (tested on a chroot with USE=clang and 3.6.0_rc3)
Comment 12 Luke-Jr 2015-02-20 20:18:11 UTC
(In reply to Bernard Cafarelli from comment #11)
> Both llvm and clang finally build on x32 with upcoming 3.6 version :)
> (tested on a chroot with USE=clang and 3.6.0_rc3)

How?

emerge: there are no ebuilds to satisfy "=sys-devel/clang-3.6.0_rc3-r100".
(dependency required by "sys-devel/llvm-3.6.0_rc3[clang]" [ebuild])
(dependency required by "=llvm-3.6.0_rc3" [argument])
Comment 13 Luke-Jr 2015-02-23 05:14:54 UTC
Created attachment 397288 [details]
llvm-3.6.0_rc3 build failure

Aside from aforementioned lack of a clang 3.6.0 ebuild, the llvm one does not build on x32.
Comment 14 Luke-Jr 2015-10-24 22:23:18 UTC
Seems that build failure is because llvm-3.6.0.src/projects/compiler-rt/make/platform/clang_linux.mk detects x86_64 via -m64

Adding a #include <features.h> to llvm-3.6.0.src/projects/compiler-rt/make/platform/clang_linux_test_input.c should I think fix that, but clang_linux.mk then needs to be extended to also support x32, which it presently does not.

After those two things are fixed, we counter the "Cannot select" issue Steven reported on the upstream bug: https://llvm.org/bugs/show_bug.cgi?id=13666

fatal error: error in backend: Cannot select: 0x3120d00: ch = brind 0x3120d90:1, 0x3124420 [ORD=1] [ID=11]
  0x3124420: i32 = add 0x3120d90, 0x3124d20 [ORD=1] [ID=10]
    0x3120d90: i32,ch = load 0x3120eb0:1, 0x31240c0, 0x3120250<LD4[JumpTable]> [ORD=1] [ID=9]
      0x31240c0: i32 = add 0x3120be0, 0x3124d20 [ORD=1] [ID=8]
        0x3120be0: i32 = shl 0x3120eb0, 0x3124030 [ORD=1] [ID=7]
          0x3120eb0: i32,ch = CopyFromReg 0x30f0198, 0x31206d0 [ORD=1] [ID=5]
            0x31206d0: i32 = Register %vreg173 [ID=1]
          0x3124030: i8 = Constant<2> [ID=4]
        0x3124d20: i32 = X86ISD::WrapperRIP 0x3124810 [ID=6]
          0x3124810: i32 = TargetJumpTable<0> [ID=3]
      0x3120250: i32 = undef [ID=2]
    0x3124d20: i32 = X86ISD::WrapperRIP 0x3124810 [ID=6]
      0x3124810: i32 = TargetJumpTable<0> [ID=3]
In function: _ZN11__sanitizer9VSNPrintfEPciPKcP13__va_list_tag
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 3.6.0 (tags/RELEASE_360/final)
Target: x86_64-pc-linux-gnux32
Thread model: posix
Comment 15 Luke-Jr 2015-10-25 02:34:24 UTC
FYI: llvm/clang-9999 does compile and work!
Comment 16 Bernard Cafarelli gentoo-dev 2015-11-04 10:45:50 UTC
Good news! Does 3.7.0-r2 fail?
Comment 17 Luke-Jr 2015-11-05 08:43:32 UTC
(In reply to Bernard Cafarelli from comment #16)
> Good news! Does 3.7.0-r2 fail?

Yes. I was able to hand-patch it to build successfully, but the result was still very unreliable.
Comment 18 Bernard Cafarelli gentoo-dev 2015-11-05 14:28:08 UTC
OK we will wait for 3.8 to mark this one fixed then :)
Comment 19 Dainius Masiliūnas 2016-02-23 12:30:12 UTC
llvm does *build* on 3.5, 3.7 and 3.8 (with -clang, at least), but whether it's performing correctly is debatable. At least it doesn't pass tests (about 170 failures, some segfaults) with FEATURES=test, even on 3.8.
Comment 20 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-16 16:46:03 UTC
Supposedly new versions build on x32.