Bug 1658942 - [rawhide] Firefox fails to build with clang - unsupported SHT_GROUP format
Summary: [rawhide] Firefox fails to build with clang - unsupported SHT_GROUP format
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: clang
Version: rawhide
Hardware: armv7hl
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tom Stellard
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1669610
TreeView+ depends on / blocked
 
Reported: 2018-12-13 08:43 UTC by Martin Stransky
Modified: 2019-02-09 04:00 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
: 1669610 (view as bug list)
Environment:
Last Closed: 2019-02-09 04:00:25 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Output of configure. (14.84 KB, text/plain)
2019-02-04 08:48 UTC, Emilio Cobos Álvarez (:emilio)
no flags Details
config.log (64.52 KB, text/plain)
2019-02-04 08:49 UTC, Emilio Cobos Álvarez (:emilio)
no flags Details

Description Martin Stransky 2018-12-13 08:43:15 UTC
Description of problem:
https://kojipkgs.fedoraproject.org//work/tasks/171/31420171/build.log

 0:14.51 checking whether the C compiler (/usr/bin/clang -std=gnu99 -O2 -g -pipe  -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wformat-security -Wformat -Werror=format-security -fno-delete-null-pointer-checks -fPIC -Wl,-z,relro -Wl,-z,now  -fuse-ld=lld) works... no
 0:14.51 configure: error: installation or configuration problem: C compiler cannot create executables.
 0:14.51 DEBUG: <truncated - see config.log for full output>
 0:14.51 DEBUG: configure:852: checking build system type
 0:14.51 DEBUG: configure:974: checking for objcopy
 0:14.51 DEBUG: configure:2007: checking for gcc
 0:14.51 DEBUG: configure:2120: checking whether the C compiler (/usr/bin/clang -std=gnu99 -O2 -g -pipe  -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wformat-security -Wformat -Werror=format-security -fno-delete-null-pointer-checks -fPIC -Wl,-z,relro -Wl,-z,now  -fuse-ld=lld) works
 0:14.51 DEBUG: configure:2136: /usr/bin/clang -std=gnu99 -o conftest -O2 -g -pipe  -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wformat-security -Wformat -Werror=format-security -fno-delete-null-pointer-checks -fPIC -Wl,-z,relro -Wl,-z,now   -fuse-ld=lld conftest.c  1>&5
 0:14.51 DEBUG: clang-7: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Wunused-command-line-argument]
 0:14.51 DEBUG: clang-7: warning: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1' [-Wunused-command-line-argument]
 0:14.51 DEBUG: configure:2133:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
 0:14.51 DEBUG: main(){return(0);}
 0:14.51 DEBUG: ^
 0:14.51 DEBUG: 1 warning generated.
 0:14.51 DEBUG: ld.lld: error: /usr/bin/../lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o: unsupported SHT_GROUP format
 0:14.51 DEBUG: clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
 0:14.51 DEBUG: configure: failed program was:
 0:14.51 DEBUG:
 0:14.51 DEBUG: #line 2131 "configure"
 0:14.51 DEBUG: #include "confdefs.h"
 0:14.51 DEBUG:
 0:14.51 DEBUG: main(){return(0);}
 0:14.51 DEBUG: configure: error: installation or configuration problem: C compiler cannot create executables.
 0:14.51 ERROR: old-configure failed

Comment 1 Ron Lovell 2019-01-02 04:33:42 UTC
Yep, me too. Fails for every C/C++ program I try. lld 6 did work, but all lld 7 versions have failed.

Comment 2 Ron Lovell 2019-01-05 02:00:56 UTC
Some additional info:

The clang/clang++/lld 7 combination works on x86_64 Debian Sid (Unstable) and openSUSE Tumbleweed.
They both happen to have glibc 2.27, whereas Rawhide currently has 2.28.9000-* (is that a 2.29 prerelease?).
I mention that because the crt1.o relocatable comes from glibc-devel.

It seems I wasn't using the LLVM compilers much this Fall. The "all lld 7 versions" comment was an overstatement.
What I have from notes and logs:

02 Aug 2018 glibc upgraded to 2.28.1
11 Aug 2018 My clang/clang++/lld 6 tests ran okay
18 Aug 2018 clang/clang++/lld upgraded to 7.0.0 rc1
            Gee I wish I'd run some tests then!
21 Oct 2018 My clang/clang++/lld 7 tests failed.
            clang/clang++ with GNU ld run fine (leaving off -fuse-ld=lld option)

I've retried lld 7 a few times since, and it continues to fail.

Comment 3 Ron Lovell 2019-01-05 02:11:19 UTC
Correction: That was glibc 2.28-1 (not 2.28.1) on 02 Aug 2018.

Comment 4 Ron Lovell 2019-01-05 02:28:34 UTC
Another addition:

29 Nov 2018 glibc upgraded to 2.28 on Debian Sid, but clang/clang++/lld 7 combinations continue to work. Hmmm. Dunno.

Comment 5 serge_sans_paille 2019-01-07 09:27:48 UTC
I fail to reproduce the error with clang 7.0.0 from f29, same command line. Just in case can you provide a failing C file?

Comment 6 Martin Stransky 2019-01-07 09:30:52 UTC
(In reply to serge_sans_paille from comment #5)
> I fail to reproduce the error with clang 7.0.0 from f29, same command line.
> Just in case can you provide a failing C file?

It's not Fedora 29 but Fedora 30 - rawhide.

Comment 7 serge_sans_paille 2019-01-07 14:42:06 UTC
ok, I can reproduce, checking that.

Comment 8 serge_sans_paille 2019-01-07 18:21:21 UTC
Some extra bad news: even with master version of lld, the bug happens. For some reasons I still need to exactly determine, crt1.o contains group section formatted in an unsupported way.

Comment 9 serge_sans_paille 2019-01-08 14:42:24 UTC
follow-up here: https://reviews.llvm.org/D56437. Bascally gcc emits a construction not supported by lld.

Comment 10 serge_sans_paille 2019-01-09 13:45:22 UTC
Simple reproducer, involving annobin, gcc, clang and lld:

$ gcc -O2 -c a.c -fplugin=annobin
$ clang a.o -fuse-ld=lld

  <<a.c>>
  #include <stdio.h>
  
  int foo() __attribute__((cold));
  int foo() { return 0;}
  int main(int argc, char**argv) {
    if(argc == 1023) return foo();
    else return 0;
  }

Comment 11 serge_sans_paille 2019-01-28 16:09:29 UTC
The bug should be fixed with https://koji.fedoraproject.org/koji/buildinfo?buildID=1182117

Comment 12 Emilio Cobos Álvarez (:emilio) 2019-02-03 19:57:09 UTC
While the simple test-case does indeed work, Firefox configure still fails for me at least.

Comment 13 serge_sans_paille 2019-02-04 06:33:18 UTC
@emilio do you have a link / backtrace to share?

Comment 14 Emilio Cobos Álvarez (:emilio) 2019-02-04 08:48:46 UTC
Created attachment 1526694 [details]
Output of configure.

This is with lld-7.0.1-3.fc30.src.rpm installed, so should have the fix, and the minimal test-case there works clang can just be regular clang-7, doesn't need to be icecc.

Comment 15 Emilio Cobos Álvarez (:emilio) 2019-02-04 08:49:28 UTC
Created attachment 1526695 [details]
config.log

Hope it helps, let me know if you need something else.

Comment 16 serge_sans_paille 2019-02-04 11:44:11 UTC
That's super strange. I've been able to compile Python from source using the following, does that work for you?

  curl -s https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz | tar xz
  cd Python-3.7.2/
  mkdir _build
  cd _build
  ../configure CC=clang CFLAGS=-fuse-ld=lld LDFLAGS=-fuse-ld=lld
  make

Comment 17 Emilio Cobos Álvarez (:emilio) 2019-02-04 12:22:08 UTC
Yup, that works without issue.

Comment 18 serge_sans_paille 2019-02-04 12:40:49 UTC
how strange++.

In the attached logfile, There's a 

configure:4598: /usr/libexec/icecc/bin/clang -std=gnu99 -o conftest  -Qunused-arguments   -fuse-ld=lld conftest.c  1>&5
ld.lld: error: /usr/lib/gcc/x86_64-redhat-linux/9/../../../../lib64/crt1.o: unsupported SHT_GROUP format
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
configure: failed program was:
#line 4591 "configure"
#include "confdefs.h"

int main() {

; return 0; }
configure: error: compiler is incompatible with sanitize options

Do you reproduce the error when manually compiling the samefile, with the same confdefs.h? If so, can you attach this header to the bug?

Comment 19 Emilio Cobos Álvarez (:emilio) 2019-02-04 12:52:39 UTC
Ah, I see what's going wrong. It's picking the wrong ld.lld from the mozilla-distributed clang. Sorry for the noise.

Comment 20 Emilio Cobos Álvarez (:emilio) 2019-02-04 12:59:36 UTC
In particular they're prepending instead of appending to $PATH for some configure checks here: https://searchfox.org/mozilla-central/rev/60c4067b1cbb0f94d7dc2d7cdfa27ed579817fee/build/moz.configure/toolchain.configure#834. That's unfortunate.


Note You need to log in before you can comment on or make changes to this bug.