Skip to content

MI6&termux&clang-16 build failed #214

Open

Description

@HKL-Kevin
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

Activity

  1. krallin commented on Jul 1, 2023

    @krallin
    Owner

    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

  2. deckstose commented on Jul 20, 2023

    @deckstose

    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

  3. deckstose commented on Jun 8, 2025

    @deckstose

    Ok after re-reading the issue I think OP has a different problem then I had.

    My problem is solved as of Clang 20, which now works for me.

    Op seems to be lacking a recent enough Clang and static glibc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions