2020-05-08 05:25:55

by Valdis Klētnieks

[permalink] [raw]
Subject: linux-next 20200506 - build failure with net/bpfilter/bpfilter_umh

My kernel build came to a screeching halt with:

CHECK net/bpfilter/bpfilter_kern.c
CC [M] net/bpfilter/bpfilter_kern.o
CC [U] net/bpfilter/main.o
LD [U] net/bpfilter/bpfilter_umh
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.userprogs:36: net/bpfilter/bpfilter_umh] Error 1
make[1]: *** [scripts/Makefile.build:494: net/bpfilter] Error 2
make: *** [Makefile:1726: net] Error 2

The culprit is this commit:

commit 0592c3c367c4c823f2a939968e72d39360fce1f4
Author: Masahiro Yamada <[email protected]>
Date: Wed Apr 29 12:45:15 2020 +0900

bpfilter: use 'userprogs' syntax to build bpfilter_umh

and specifically, this line:

+userldflags += -static

At least on Fedora, this dies an ugly death unless you have the glibc-static RPM
installed (which is *not* part of the glibc-devel RPM). Not sure how to fix this, or
give a heads-up that there's a new requirement that might break the build.


Attachments:
(No filename) (849.00 B)

2020-05-09 03:48:10

by Masahiro Yamada

[permalink] [raw]
Subject: Re: linux-next 20200506 - build failure with net/bpfilter/bpfilter_umh

On Fri, May 8, 2020 at 2:22 PM Valdis Klētnieks <[email protected]> wrote:
>
> My kernel build came to a screeching halt with:
>
> CHECK net/bpfilter/bpfilter_kern.c
> CC [M] net/bpfilter/bpfilter_kern.o
> CC [U] net/bpfilter/main.o
> LD [U] net/bpfilter/bpfilter_umh
> /usr/bin/ld: cannot find -lc
> collect2: error: ld returned 1 exit status
> make[2]: *** [scripts/Makefile.userprogs:36: net/bpfilter/bpfilter_umh] Error 1
> make[1]: *** [scripts/Makefile.build:494: net/bpfilter] Error 2
> make: *** [Makefile:1726: net] Error 2
>
> The culprit is this commit:

Thanks. I will try to fix it,
but my commit is innocent because
it is just textual cleanups.
No functional change is intended.


This '-static' option has existed since
the day 1 of bpfilter umh support.
See commit d2ba09c17a0647f899d6c20a11bab9e6d3382f07



I built the mainline kernel in
Fedora running on docker.

I was able to reproduce the same issue.


[masahiro@ed7f2ae1915f linux]$ git log --oneline -1
0e698dfa2822 (HEAD, tag: v5.7-rc4) Linux 5.7-rc4
[masahiro@ed7f2ae1915f linux]$ make defconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
*** Default configuration is based on 'x86_64_defconfig'
#
# configuration written to .config
#
[masahiro@ed7f2ae1915f linux]$ scripts/config -e BPFILTER
[masahiro@ed7f2ae1915f linux]$ scripts/config -e BPFILTER_UMH
[masahiro@ed7f2ae1915f linux]$ make -j24 net/bpfilter/
scripts/kconfig/conf --syncconfig Kconfig
SYSTBL arch/x86/include/generated/asm/syscalls_32.h
SYSHDR arch/x86/include/generated/asm/unistd_32_ia32.h
SYSHDR arch/x86/include/generated/asm/unistd_64_x32.h
SYSTBL arch/x86/include/generated/asm/syscalls_64.h
SYSHDR arch/x86/include/generated/uapi/asm/unistd_32.h
SYSHDR arch/x86/include/generated/uapi/asm/unistd_64.h
SYSHDR arch/x86/include/generated/uapi/asm/unistd_x32.h
WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h
WRAP arch/x86/include/generated/uapi/asm/errno.h
WRAP arch/x86/include/generated/uapi/asm/ioctl.h
WRAP arch/x86/include/generated/uapi/asm/ioctls.h
WRAP arch/x86/include/generated/uapi/asm/fcntl.h
WRAP arch/x86/include/generated/uapi/asm/param.h
WRAP arch/x86/include/generated/uapi/asm/ipcbuf.h
WRAP arch/x86/include/generated/uapi/asm/resource.h
WRAP arch/x86/include/generated/uapi/asm/poll.h
WRAP arch/x86/include/generated/uapi/asm/socket.h
WRAP arch/x86/include/generated/uapi/asm/sockios.h
WRAP arch/x86/include/generated/uapi/asm/termbits.h
WRAP arch/x86/include/generated/uapi/asm/termios.h
WRAP arch/x86/include/generated/uapi/asm/types.h
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
WRAP arch/x86/include/generated/asm/export.h
WRAP arch/x86/include/generated/asm/early_ioremap.h
WRAP arch/x86/include/generated/asm/dma-contiguous.h
WRAP arch/x86/include/generated/asm/mcs_spinlock.h
WRAP arch/x86/include/generated/asm/mm-arch-hooks.h
WRAP arch/x86/include/generated/asm/mmiowb.h
HOSTCC scripts/kallsyms
HOSTCC scripts/sorttable
HOSTCC scripts/asn1_compiler
UPD include/config/kernel.release
DESCEND objtool
HOSTCC scripts/selinux/mdp/mdp
HOSTCC scripts/selinux/genheaders/genheaders
UPD include/generated/utsrelease.h
scripts/kallsyms.c: In function ‘read_symbol’:
scripts/kallsyms.c:222:2: warning: ‘strcpy’ writing between 1 and 128
bytes into a region of size 0 [-Wstringop-overflow=]
222 | strcpy(sym_name(sym), name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
HOSTCC /home/masahiro/ref/linux/tools/objtool/fixdep.o
HOSTLD arch/x86/tools/relocs
HOSTLD /home/masahiro/ref/linux/tools/objtool/fixdep-in.o
LINK /home/masahiro/ref/linux/tools/objtool/fixdep
CC /home/masahiro/ref/linux/tools/objtool/builtin-check.o
CC /home/masahiro/ref/linux/tools/objtool/builtin-orc.o
CC /home/masahiro/ref/linux/tools/objtool/check.o
CC /home/masahiro/ref/linux/tools/objtool/orc_gen.o
CC /home/masahiro/ref/linux/tools/objtool/orc_dump.o
CC /home/masahiro/ref/linux/tools/objtool/elf.o
GEN /home/masahiro/ref/linux/tools/objtool/arch/x86/lib/inat-tables.c
CC /home/masahiro/ref/linux/tools/objtool/special.o
CC /home/masahiro/ref/linux/tools/objtool/objtool.o
CC /home/masahiro/ref/linux/tools/objtool/libstring.o
CC /home/masahiro/ref/linux/tools/objtool/libctype.o
CC /home/masahiro/ref/linux/tools/objtool/str_error_r.o
CC /home/masahiro/ref/linux/tools/objtool/librbtree.o
CC /home/masahiro/ref/linux/tools/objtool/exec-cmd.o
CC /home/masahiro/ref/linux/tools/objtool/help.o
CC /home/masahiro/ref/linux/tools/objtool/pager.o
CC /home/masahiro/ref/linux/tools/objtool/parse-options.o
CC /home/masahiro/ref/linux/tools/objtool/run-command.o
CC /home/masahiro/ref/linux/tools/objtool/sigchain.o
CC /home/masahiro/ref/linux/tools/objtool/arch/x86/decode.o
CC /home/masahiro/ref/linux/tools/objtool/subcmd-config.o
LD /home/masahiro/ref/linux/tools/objtool/arch/x86/objtool-in.o
LD /home/masahiro/ref/linux/tools/objtool/libsubcmd-in.o
AR /home/masahiro/ref/linux/tools/objtool/libsubcmd.a
CC scripts/mod/devicetable-offsets.s
CC scripts/mod/empty.o
MKELF scripts/mod/elfconfig.h
HOSTCC scripts/mod/sumversion.o
HOSTCC scripts/mod/modpost.o
UPD scripts/mod/devicetable-offsets.h
HOSTCC scripts/mod/file2alias.o
LD /home/masahiro/ref/linux/tools/objtool/objtool-in.o
LINK /home/masahiro/ref/linux/tools/objtool/objtool
HOSTLD scripts/mod/modpost
CC kernel/bounds.s
CALL scripts/atomic/check-atomics.sh
UPD include/generated/timeconst.h
UPD include/generated/bounds.h
CC arch/x86/kernel/asm-offsets.s
UPD include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
HOSTCC net/bpfilter/main.o
CC net/bpfilter/bpfilter_kern.o
HOSTLD net/bpfilter/bpfilter_umh
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host:112: net/bpfilter/bpfilter_umh] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [scripts/Makefile.build:488: net/bpfilter] Error 2
make: *** [Makefile:1722: net] Error 2









>
> commit 0592c3c367c4c823f2a939968e72d39360fce1f4
> Author: Masahiro Yamada <[email protected]>
> Date: Wed Apr 29 12:45:15 2020 +0900
>
> bpfilter: use 'userprogs' syntax to build bpfilter_umh
>
> and specifically, this line:
>
> +userldflags += -static
>
> At least on Fedora, this dies an ugly death unless you have the glibc-static RPM
> installed (which is *not* part of the glibc-devel RPM). Not sure how to fix this, or
> give a heads-up that there's a new requirement that might break the build.
>


--
Best Regards
Masahiro Yamada

2020-05-09 04:57:33

by Valdis Klētnieks

[permalink] [raw]
Subject: Re: linux-next 20200506 - build failure with net/bpfilter/bpfilter_umh

On Sat, 09 May 2020 12:45:22 +0900, Masahiro Yamada said:

> > LD [U] net/bpfilter/bpfilter_umh
> > /usr/bin/ld: cannot find -lc
> > collect2: error: ld returned 1 exit status
> > make[2]: *** [scripts/Makefile.userprogs:36: net/bpfilter/bpfilter_umh] Error 1
> > make[1]: *** [scripts/Makefile.build:494: net/bpfilter] Error 2
> > make: *** [Makefile:1726: net] Error 2
> >
> > The culprit is this commit:
>
> Thanks. I will try to fix it,
> but my commit is innocent because
> it is just textual cleanups.
> No functional change is intended.

Hmm... 'git show' made it look like a totally new line...

Proposed patch following in separate email...



Attachments:
(No filename) (849.00 B)