Thread (8 messages) 8 messages, 3 authors, 2021-02-16

Re: [PATCH] scripts: Fix linking extract-cert against libcrypto

From: Rolf Eike Beer <hidden>
Date: 2021-02-11 10:33:05
Also in: linux-kbuild, lkml

Am Dienstag, 9. Februar 2021, 09:44:33 CET schrieb Rolf Eike Beer:
Am Dienstag, 9. Februar 2021, 05:59:56 CET schrieb Daniel Díaz:
quoted
When compiling under OpenEmbedded, the following error is seen

as of recently:
  /srv/oe/build/tmp/hosttools/ld: cannot find /lib/libc.so.6 inside /
  /srv/oe/build/tmp/hosttools/ld: cannot find /usr/lib/libc_nonshared.a

inside / /srv/oe/build/tmp/hosttools/ld: cannot find
/lib/ld-linux-x86-64.so.2 inside / collect2: error: ld returned 1 exit
status

  make[2]: *** [scripts/Makefile.host:95: scripts/extract-cert] Error 1
[...]
quoted
As per `make`'s documentation:
  LDFLAGS
  
    Extra flags to give to compilers when they are supposed to
    invoke the linker, ‘ld’, such as -L. Libraries (-lfoo)
    should be added to the LDLIBS variable instead.
  
  LDLIBS
  
    Library flags or names given to compilers when they are
    supposed to invoke the linker, ‘ld’. LOADLIBES is a
    deprecated (but still supported) alternative to LDLIBS.
    Non-library linker flags, such as -L, should go in the
    LDFLAGS variable.
Correct. And the patch I use for my local 4.19 build actually uses LDLIBS,
so it must have gone wrong in some rebase for one of the intermediate
versions.

Acked-by: Rolf Eike Beer <redacted>
Ok, now actually with proper testing: no, your patch doesn't work. When 
changing LDLIBS to LDFLAGS things do not show up on the commandline at all.

LDLIBS:

  gcc -Wp,-MMD,scripts/.sign-file.d -Wall -Wmissing-prototypes -Wstrict-
prototypes -O2 -fomit-frame-pointer -std=gnu89      -I/opt/emlix/test/include 
-I ./scripts   -o scripts/sign-file /tmp/e2/build/linux-kernel/scripts/sign-
file.c   -L/opt/emlix/test/lib -lcrypto -lz -ldl -pthread

LDFLAGS:

  gcc -Wp,-MMD,scripts/.sign-file.d -Wall -Wmissing-prototypes -Wstrict-
prototypes -O2 -fomit-frame-pointer -std=gnu89      -I/opt/emlix/test/include 
-I ./scripts   -o scripts/sign-file /tmp/e2/build/linux-kernel/scripts/sign-
file.c   

When looking closely you may notice that this is not entirely the same as 
current master would output: I missed the CFLAGS for sign-file in my patch. 
When testing your patch I accidentially had a .config that had module 
signatures disabled, so I have not tested it actually, that's why I didn't 
notice that it doesn't work.

I'm just guessing, but your build error looks like you are also cross-building 
the tools, which is wrong. You want them to be host-tools. So don't export 
PKG_CONFIG_SYSROOT_DIR, it would then try to link target libraries into a host  
binary.

Eike
-- 
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help