Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MI6&termux&clang-16 build failed #214

Open
HKL-Kevin opened this issue Jun 30, 2023 · 2 comments
Open

MI6&termux&clang-16 build failed #214

HKL-Kevin opened this issue Jun 30, 2023 · 2 comments

Comments

@HKL-Kevin
Copy link

make -j8
[ 50%] Built target tini
[ 75%] Linking C executable tini-static
ld.lld: error: unable to find library -lc
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/tini-static.dir/build.make:97: tini-static] Error 1
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/tini-static.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
@krallin
Copy link
Owner

krallin commented Jul 1, 2023

I think you'd have to give a little more in the way of repro instructions here. Looks like you don't have a libc the linker can find? You'll need to install one

@imwints
Copy link

imwints commented Jul 20, 2023

Observing the same issue

[1/4] /usr/lib/llvm/16/bin/clang  -I/var/tmp/portage/sys-process/tini-0.19.0-r1/work/tini-0.19.0_build  -O2 -pipe -march=native -flto=thin -std=gnu99 -Wextra -Wall -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -MD -MT CMakeFiles/tini.dir/src/tini.c.o -MF CMakeFiles/tini.dir/src/tini.c.o.d -o CMakeFiles/tini.dir/src/tini.c.o -c /var/tmp/portage/sys-process/tini-0.19.0-r1/work/tini-0.19.0/src/tini.c
[2/4] /usr/lib/llvm/16/bin/clang  -I/var/tmp/portage/sys-process/tini-0.19.0-r1/work/tini-0.19.0_build  -O2 -pipe -march=native -flto=thin -std=gnu99 -Wextra -Wall -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -MD -MT CMakeFiles/tini-static.dir/src/tini.c.o -MF CMakeFiles/tini-static.dir/src/tini.c.o.d -o CMakeFiles/tini-static.dir/src/tini.c.o -c /var/tmp/portage/sys-process/tini-0.19.0-r1/work/tini-0.19.0/src/tini.c
[3/4] : && /usr/lib/llvm/16/bin/clang -O2 -pipe -march=native -flto=thin -std=gnu99 -Wextra -Wall -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wl,--as-needed -Wl,-Bsymbolic-functions -Wl,-z,relro     -rdynamic CMakeFiles/tini.dir/src/tini.c.o -o tini   && :
[4/4] : && /usr/lib/llvm/16/bin/clang -O2 -pipe -march=native -flto=thin -std=gnu99 -Wextra -Wall -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wl,--as-needed -Wl,-Bsymbolic-functions -Wl,-z,relro     -rdynamic -Wl,--no-export-dynamic -static CMakeFiles/tini-static.dir/src/tini.c.o -o tini-static   && :
FAILED: tini-static
: && /usr/lib/llvm/16/bin/clang -O2 -pipe -march=native -flto=thin -std=gnu99 -Wextra -Wall -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wl,--as-needed -Wl,-Bsymbolic-functions -Wl,-z,relro     -rdynamic -Wl,--no-export-dynamic -static CMakeFiles/tini-static.dir/src/tini.c.o -o tini-static   && :
ld.lld: error: undefined symbol: __unordtf2
>>> referenced by printf_fphex.c:123 (../stdio-common/printf_fphex.c:123)
>>>               printf_fphex.o:(__printf_fphex_buffer) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/libc.a
>>> referenced by printf_fphex.c:123 (../stdio-common/printf_fphex.c:123)
>>>               printf_fphex.o:(__printf_fphex_buffer) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/libc.a
>>> referenced by printf_fp.c:222 (/var/tmp/portage/sys-libs/glibc-2.37-r3/work/glibc-2.37/stdio-common/printf_fp.c:222)
>>>               printf_fp.o:(__printf_fp_buffer_1.isra.0) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/libc.a
>>> referenced 1 more times

ld.lld: error: undefined symbol: __letf2
>>> referenced by printf_fphex.c:123 (../stdio-common/printf_fphex.c:123)
>>>               printf_fphex.o:(__printf_fphex_buffer) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/libc.a
>>> referenced by printf_fp.c:222 (/var/tmp/portage/sys-libs/glibc-2.37-r3/work/glibc-2.37/stdio-common/printf_fp.c:222)
>>>               printf_fp.o:(__printf_fp_buffer_1.isra.0) in archive /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../lib64/libc.a
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

https://discourse.llvm.org/t/compiler-rt-with-soft-float-support/4936
https://discourse.llvm.org/t/static-linking-with-compiler-rt-and-libc-2-31-does-not-work/4960
seem to be related.

Statically linking glibc with clang is currently not possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants