1

I was trying to compile Linux Kernel from source. I've compiled the kernel previously and never got any error. But this time I am facing an error. The error is

   CHK     include/generated/asm-offsets.h
   CALL    scripts/checksyscalls.sh
   HOSTCC  scripts/sign-file
  /tmp/cczyW3hq.o: In function `main':
  sign-file.c:(.text.startup+0x52): undefined reference to `OPENSSL_init_crypto'
  sign-file.c:(.text.startup+0x5e): undefined reference to `OPENSSL_init_crypto'
  sign-file.c:(.text.startup+0x247): undefined reference to `OPENSSL_init_crypto'
  collect2: error: ld returned 1 exit status
  scripts/Makefile.host:91: recipe for target 'scripts/sign-file' failed
  make[1]: [scripts/sign-file] Error 1

When I checked scripts/sign-file.c, I saw comment saying Sign a module file using the given key.. So I reran make menuconfig, and set Module signature verification off. And tried to compile again. Now, previous error was removed but new error showed up which was same as above but on different file. Here is the error,

  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  HOSTCC  scripts/extract-cert
  /tmp/ccA63AAC.o: In function `main':
  extract-cert.c:(.text.startup+0x25): undefined reference to `OPENSSL_init_crypto'
  extract-cert.c:(.text.startup+0x31): undefined reference to `OPENSSL_init_crypto'
  collect2: error: ld returned 1 exit status
  scripts/Makefile.host:91: recipe for target 'scripts/extract-cert' failed
  make[1]: *** [scripts/extract-cert] Error 1
  Makefile:556: recipe for target 'scripts' failed
  make: *** [scripts] Error 2

So I want to know whether this problem is with libssl or some configuration error? I am using Ubuntu 16.04LTS with gcc-5.3.1.

EDIT: I have tried reinstalling libssl-dev and also tried compiling openssl from source code and then installing too. I have copied config file from /boot/config-4.4.0-22-generic to source directory.

UPDATE: with make scripts V=1 following is the output:

make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.asm-generic \
        src=asm obj=arch/x86/include/generated/asm
make -f ./scripts/Makefile.asm-generic \
        src=uapi/asm obj=arch/x86/include/generated/uapi/asm
make -f ./scripts/Makefile.build obj=scripts
make -f ./scripts/Makefile.build obj=scripts/gdb
make -f ./scripts/Makefile.build obj=scripts/gdb/linux
make -f ./scripts/Makefile.build obj=scripts/genksyms
make -f ./scripts/Makefile.build obj=scripts/mod
make -f ./scripts/Makefile.build obj=scripts/selinux
make -f ./scripts/Makefile.build obj=scripts/selinux/genheaders
make -f ./scripts/Makefile.build obj=scripts/selinux/mdp
  gcc -Wp,-MD,scripts/.sign-file.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89   -I./tools/include  -o scripts/sign-file scripts/sign-file.c  -lcrypto
/tmp/cc7o2Y1C.o: In function `main':
sign-file.c:(.text.startup+0x52): undefined reference to `OPENSSL_init_crypto'
sign-file.c:(.text.startup+0x5e): undefined reference to `OPENSSL_init_crypto'
sign-file.c:(.text.startup+0x247): undefined reference to `OPENSSL_init_crypto'
collect2: error: ld returned 1 exit status
scripts/Makefile.host:91: recipe for target 'scripts/sign-file' failed
make[1]: *** [scripts/sign-file] Error 1
Makefile:556: recipe for target 'scripts' failed
make: *** [scripts] Error 2
  • Disable the secure boot option – GAD3R Jun 6 '16 at 11:00
  • @GAD3R It is disabled in the BIOS. – 0x0001 Jun 6 '16 at 11:06
  • What does make scripts V=1 say (from the top-level directory)? – Stephen Kitt Jun 6 '16 at 12:57
  • @StephenKitt I have updated my question? – 0x0001 Jun 6 '16 at 13:08
  • Thanks, does it work better if you remove libcrypto* from /usr/local/lib (or wherever you installed your manually-built version)? – Stephen Kitt Jun 6 '16 at 13:17
0

You will have to make sure that the symbolic link to libssl and libcrypto is updated. Here is what you should do: Search for all occurrences of libssl.so and libcrypto.so

for each of them, see of they are linking to the correct version of libssl. libssl.so.1.1 in your case (libssl.so.1.1 must exist).

If they are targeting an older version, delete the link and create a new one

ln -s libssl.so.1.1 libssl.so

Same for libcrytpo.

Make sure you search for all occurances of libssl.so (you never know where your code picks it up from)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.