Linux 커널 4.7-rc2를 컴파일할 수 없습니다.

Linux 커널 4.7-rc2를 컴파일할 수 없습니다.

소스에서 Linux 커널을 컴파일하려고 합니다. 이전에 커널을 컴파일했는데 오류가 발생하지 않았습니다. 그런데 이번에는 오류가 발생했습니다. 오류는 다음과 같습니다

   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

scripts/sign-file.c를 확인하면 이라는 주석이 보입니다 Sign a module file using the given key.. 그래서 나는 계속해서 시작했고 make menuconfig갔다 Module signature verification. 그리고 다시 컴파일을 시도해보세요. 이제 이전 오류는 제거되었지만 위와 동일하지만 다른 파일에 새로운 오류가 나타납니다. 이것은 오류입니다.

  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

libssl그렇다면 이 문제가 구성 오류 로 인한 것인지 궁금합니다 . Ubuntu 16.04LTS와 함께 사용하고 있습니다 gcc-5.3.1.

편집: libssl-dev 재설치를 시도하고 소스에서 openssl을 컴파일한 다음 설치도 시도했습니다. /boot/config-4.4.0-22-generic소스 디렉터리 의 구성 파일을 .

업데이트: make scripts V=1출력은 다음과 같습니다.

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

답변1

커널 모듈 서명을 활성화했으므로 커널 컴파일 프로세스에서도 도구 생성을 시도합니다 sign-file. 이를 위해서는 OpenSSL 라이브러리가 필요합니다.

더 구체적으로 말하자면, OpenSSL이 필요한 모든 것을 컴파일한다는 것은 다음을 의미합니다.개발 키트먼저 OpenSSL을 설치합니다( 배포판에 따라 일반적 openssl-dev으로 또는 ).openssl-devel

답변2

libssl 및 libcrypto에 대한 기호 링크가 업데이트되었는지 확인해야 합니다. 다음을 수행해야 합니다. 모든 libssl.so 및 libcrypto.so를 검색합니다.

각각에 대해 올바른 버전의 libssl에 연결되어 있는지 확인하십시오. 귀하의 경우에는 libssl.so.1.1입니다(libssl.so.1.1이 있어야 함).

이전 버전을 타겟팅하는 경우 링크를 제거하고 새 버전을 만드세요.

ln -s libssl.so.1.1 libssl.so

libcrytpo도 마찬가지입니다.

모든 libssl.so를 검색하십시오(코드가 어디서 가져오는지 결코 알 수 없음).

답변3

API가 없는 이전 버전의 openssl을 사용하고 계시기를 바랍니다 OPENSSL_init_crypto.

  1. openssl/crypto.h/usr/include또는에서 openssl 헤더 파일을 찾아 헤더 파일에 API 프로토타입이 있는지 /usr/local/include확인합니다 ( 아래 언급된 대로 grep을 사용할 수 있음).OPENSSL_init_crypto
grep OPENSSL_init_crypto /usr/include -R
grep OPENSSL_init_crypto /usr/local/include -R

위의 2개 grep명령으로 결과가 나오지 않으면 openssl이 설치되어 있지 않거나 이전 openssl 버전이 설치되어 있다는 의미입니다.

  1. 따라서 다음에서 최신 openssl-1.1.1을 다운로드하십시오.여기 다음 명령을 사용하여 설치하십시오.
tar -xvf <openssl_tar_package>
./config
make
make install

관련 정보