<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/86460>86460</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang 17.0.6 and 18.1.2 fail to build libwebp-1.3.2 and harfbuzz-8.3.0 on ppc32/musl: "clang: error: clang frontend command failed with exit code 139"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ernsteiswuerfel
</td>
</tr>
</table>
<pre>
I get this at building libwebp-1.3.2 on my Talos II (ppc32 chroot, musl) with clang 17.0.6 or 18.1.2:
```
[...]
libtool: compile: clang -DHAVE_CONFIG_H -I. -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc -I../../src/webp -DNDEBUG -I../.. -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2 -fvisibility=hidden -Wall -Wconstant-conversion -Wdeclaration-after-statement -Wextra -Wfloat-conversion -Wformat -Wformat-nonliteral -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wold-style-definition -Wparentheses-equality -Wshadow -Wshorten-64-to-32 -Wundef -Wunreachable-code-aggressive -Wunreachable-code -Wunused-but-set-variable -Wunused -Wvla -O2 -mcpu=7450 -mtune=7450 -pipe -c /var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc/backward_references_cost_enc.c -fPIC -DPIC -o .libs/libwebpencode_la-backward_references_cost_enc.o
/bin/sh ../../libtool --tag=CC --mode=compile clang -DHAVE_CONFIG_H -I. -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc -I../../src/webp -DNDEBUG -I../.. -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2 -fvisibility=hidden -Wall -Wconstant-conversion -Wdeclaration-after-statement -Wextra -Wfloat-conversion -Wformat -Wformat-nonliteral -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wold-style-definition -Wparentheses-equality -Wshadow -Wshorten-64-to-32 -Wundef -Wunreachable-code-aggressive -Wunreachable-code -Wunused-but-set-variable -Wunused -Wvla -O2 -mcpu=7450 -mtune=7450 -pipe -c -o libwebpencode_la-backward_references_enc.lo `test -f 'backward_references_enc.c' || echo '/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc/'`backward_references_enc.c
libtool: compile: clang -DHAVE_CONFIG_H -I. -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc -I../../src/webp -DNDEBUG -I../.. -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2 -fvisibility=hidden -Wall -Wconstant-conversion -Wdeclaration-after-statement -Wextra -Wfloat-conversion -Wformat -Wformat-nonliteral -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wold-style-definition -Wparentheses-equality -Wshadow -Wshorten-64-to-32 -Wundef -Wunreachable-code-aggressive -Wunreachable-code -Wunused-but-set-variable -Wunused -Wvla -O2 -mcpu=7450 -mtune=7450 -pipe -c /var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc/backward_references_enc.c -fPIC -DPIC -o .libs/libwebpencode_la-backward_references_enc.o
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang -DHAVE_CONFIG_H -I. -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc -I../../src/webp -DNDEBUG -I../.. -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2 -fvisibility=hidden -Wall -Wconstant-conversion -Wdeclaration-after-statement -Wextra -Wfloat-conversion -Wformat -Wformat-nonliteral -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wold-style-definition -Wparentheses-equality -Wshadow -Wshorten-64-to-32 -Wundef -Wunreachable-code-aggressive -Wunreachable-code -Wunused-but-set-variable -Wunused -Wvla -O2 -mcpu=7450 -mtune=7450 -pipe -c /var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc/backward_references_enc.c -fPIC -DPIC -o .libs/libwebpencode_la-backward_references_enc.o
1. /var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc/backward_references_enc.c:345:3: current parser token 'chain'
2. /var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc/backward_references_enc.c:262:62: parsing function body 'VP8LHashChainFill'
3. /var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc/backward_references_enc.c:262:62: in compound statement ('{}')
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 18.1.2
Target: powerpc-gentoo-linux-musl
Thread model: posix
InstalledDir: /usr/lib/llvm/18/bin
Configuration file: /etc/clang/powerpc-gentoo-linux-musl-clang.cfg
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/tmp/portage/media-libs/libwebp-1.3.2/temp/backward_references_enc-f8155e.c
clang: note: diagnostic msg: /var/tmp/portage/media-libs/libwebp-1.3.2/temp/backward_references_enc-f8155e.sh
clang: note: diagnostic msg:
********************
make[2]: *** [Makefile:546: libwebpencode_la-backward_references_enc.lo] Error 1
make[2]: Leaving directory '/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2-.ppc/src/enc'
make[1]: *** [Makefile:602: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2-.ppc/src'
make: *** [Makefile:428: all-recursive] Error 1
```
I get a similar error (`clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)`) when building harfbuzz-8.3.0.
I tried to run the relevant command in gdb but that wasn't very conclusive (for me):
```
# gdb --args clang "-DHAVE_CONFIG_H -I. -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc -I../../src/webp -DNDEBUG -I../.. -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2 -fvisibility=hidden -Wall -Wconstant-conversion -Wdeclaration-after-statement -Wextra -Wfloat-conversion -Wformat -Wformat-nonliteral -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wold-style-definition -Wparentheses-equality -Wshadow -Wshorten-64-to-32 -Wundef -Wunreachable-code-aggressive -Wunreachable-code -Wunused-but-set-variable -Wunused -Wvla -O2 -mcpu=7450 -mtune=7450 -pipe -c /var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc/backward_references_enc.c -fPIC -DPIC -o .libs/libwebpencode_la-backward_references_enc.o"
GNU gdb (Gentoo 14.1 vanilla) 14.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "powerpc-gentoo-linux-musl".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from clang...
(No debugging symbols found in clang)
(gdb) set follow-fork-mode child
(gdb) run
Starting program: /usr/lib/llvm/18/bin/clang -DHAVE_CONFIG_H\ -I.\ -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc\ -I../../src/webp\ -DNDEBUG\ -I../..\ -I/var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2\ -fvisibility=hidden\ -Wall\ -Wconstant-conversion\ -Wdeclaration-after-statement\ -Wextra\ -Wfloat-conversion\ -Wformat\ -Wformat-nonliteral\ -Wformat\ -Wformat-security\ -Wmissing-declarations\ -Wmissing-prototypes\ -Wold-style-definition\ -Wparentheses-equality\ -Wshadow\ -Wshorten-64-to-32\ -Wundef\ -Wunreachable-code-aggressive\ -Wunreachable-code\ -Wunused-but-set-variable\ -Wunused\ -Wvla\ -O2\ -mcpu=7450\ -mtune=7450\ -pipe\ -c\ /var/tmp/portage/media-libs/libwebp-1.3.2/work/libwebp-1.3.2/src/enc/backward_references_enc.c\ -fPIC\ -DPIC\ -o\ .libs/libwebpencode_la-backward_references_enc.o
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
[Attaching after process 5411 vfork to child process 5414]
[New inferior 2 (process 5414)]
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
[Detaching vfork parent process 5411 after child exec]
[Inferior 1 (process 5411) detached]
process 5414 is executing new program: /usr/lib/llvm/18/bin/ld.lld
[New LWP 5415]
[New LWP 5416]
[New LWP 5417]
[New LWP 5418]
[New LWP 5419]
[New LWP 5420]
[New LWP 5421]
[New LWP 5422]
[New LWP 5423]
[New LWP 5424]
[New LWP 5425]
[New LWP 5426]
ld.lld: error: undefined symbol: main
>>> referenced by /usr/lib/Scrt1.o:(.got2+0x8)
[New LWP 5427]
[New LWP 5428]
[New LWP 5429]
[LWP 5429 exited]
[LWP 5428 exited]
[LWP 5427 exited]
[LWP 5426 exited]
[LWP 5425 exited]
[LWP 5424 exited]
[LWP 5423 exited]
[LWP 5422 exited]
[LWP 5421 exited]
[LWP 5420 exited]
[LWP 5419 exited]
[LWP 5418 exited]
[LWP 5417 exited]
[LWP 5416 exited]
[LWP 5415 exited]
[Inferior 2 (process 5414) exited with code 01]
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
If I use binutils bfd as linker I get the same "undefined symbol: main".
I don't think there is a general problem of clang/lld not working on musl/ppc32 as other packages like lz4 or pigz build just fine with clang and run fine.
Build.log and the 2 files mentioned in the backtrace attached.
[libwebp-1.3.2:20240324-224754.log](https://github.com/llvm/llvm-project/files/14737151/libwebp-1.3.2.20240324-224754.log)
[backward_references.zip](https://github.com/llvm/llvm-project/files/14737152/backward_references.zip)
[harfbuzz-8.3.0:20240324-230857.log](https://github.com/llvm/llvm-project/files/14737156/harfbuzz-8.3.0.20240324-230857.log)
[hb-static.zip](https://github.com/llvm/llvm-project/files/14737167/hb-static.zip)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWltv47qu_jXuC2EjlnN96EPbNDMBemaKma5dnKeBbDO2dhXJR5KTyfz6A0rOrSte15k9C9gFitQmZYmkRX4kLW6tqBTidTS6jUbzK966WptrNMo6FHbbolmhvMp1ubteQoUOXC0scAd5K2QpVAVS5FvMmzhNsoSBVrDewROX2sJyCRGbNk2RMShqo7WL2B2sWysjNoOtcDUUkqsK0kkySMagDaTTJE1YlN1Eg3k0uInGg-4v3I5ukySJRvNwK0XutJZRdgOFXjdCIl12c8bz9zf_uv9y9_HDYvnuy3uIlwnEy4gtNtxEbOHWTcQWjTaOVxixxRpLwWMpchuxxZlKEVtstXm5QLamiNgCVUGTJxFb-J9ApYEQzz_M729_eXfkf1cRIF5thBW5kMLtomxei7JEBfEzlxLi50Ir67hycaHVBo0VmnglFpIb7oRWMV85NLF13OEalYP4Gb86wyF-XknNXz240mbN3eEiVlpJ4dBweYFpsWiNcDuIn9fCWqGq-GRhe0JujHba7RokopZlbN1OYlziSijhwtINN6hcjRZtjP_XchlmtjUv9dZfaONQxeNh7HScMYifW1Xiyv83yIua5xLjQpcY86oyaK3Y4AWuJ7UWyzhvSQkXb7gRxD5wIH7eSA7xRwbxumjaKJtPhqMBxGvXKjzcNaJBiAv4MRsuYoucFy9bbsovBldoUBVovxTaui-oiqSAePW4vIN47n81JOcLoSJtv0ge_-Y0unM7tsiFovVrOO7zzvsA4tjxKsrmd3dAN2tdkhk6j_wHeeObO_6XuyP5Y6zhD_kAbX-pIRoPHFoH8QoiNukbWERsAtHkLprcARa1prE_zPFp7vGgX5Q3aHzzxX--L_6nofHvo-IJID4-3N98vgfb5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