configure: error: OpenSSL library not found

编译安装openssl时,没有问题。

在编译openssh时,configure报错

checking OpenSSL header version... 1010107f (OpenSSL 1.1.1g  21 Apr 2020)
checking for OpenSSL_version... no
checking for OpenSSL_version_num... no
checking OpenSSL library version... not found
configure: error: OpenSSL library not found.

百度了一把,没有发现可用的方法。

发现目录下有个config.log,查看文件内容看看怎么判断OpenSSL library not found的,发现是编译了一段简单代码,看结果是否能编译通过。

configure:12767: checking for OpenSSL_version
configure:12767: cc -o conftest -g -O2 -pipe -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset -fstack-protector-all -fPIE  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE  -Wl,-z,retpolineplt -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -fstack-protector-all -pie conftest.c -lcrypto -lrt -ldl -lutil -lz  >&5
/tmp/ccBPnFeL.o: In function `main':
/tmp/openssh-8.1p1/conftest.c:275: undefined reference to `OpenSSL_version'
collect2: ld returned 1 exit status
configure:12767: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "OpenSSH"
| #define PACKAGE_TARNAME "openssh"
| #define PACKAGE_VERSION "Portable"
| #define PACKAGE_STRING "OpenSSH Portable"
| #define PACKAGE_BUGREPORT "openssh-unix-dev@mindrot.org"
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define _PATH_PASSWD_PROG "/usr/bin/passwd"
| #define HAVE_RLIMIT_NPROC /**/
| #define WITH_OPENSSL 1
| #define HAVE_ATTRIBUTE__NONNULL__ 1
| #define HAVE_CRYPT_H 1
| #define HAVE_DIRENT_H 1
| #define HAVE_ENDIAN_H 1
| #define HAVE_ELF_H 1
| #define HAVE_ERR_H 1
| #define HAVE_FEATURES_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_GETOPT_H 1
| #define HAVE_GLOB_H 1
| #define HAVE_IFADDRS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_LANGINFO_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_LOCALE_H 1
| #define HAVE_NETDB_H 1
| #define HAVE_PATHS_H 1
| #define HAVE_POLL_H 1
| #define HAVE_PTY_H 1
| #define HAVE_RPC_TYPES_H 1
| #define HAVE_SECURITY_PAM_APPL_H 1
| #define HAVE_SHADOW_H 1
| #define HAVE_STDDEF_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STRING_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_BITYPES_H 1
| #define HAVE_SYS_CDEFS_H 1
| #define HAVE_SYS_DIR_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_MMAN_H 1
| #define HAVE_SYS_POLL_H 1
| #define HAVE_SYS_PRCTL_H 1
| #define HAVE_SYS_PTRACE_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_STROPTS_H 1
| #define HAVE_SYS_STATVFS_H 1
| #define HAVE_SYS_SYSMACROS_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_VFS_H 1
| #define HAVE_TIME_H 1
| #define HAVE_TTYENT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_UTIME_H 1
| #define HAVE_UTMP_H 1
| #define HAVE_UTMPX_H 1
| #define HAVE_VIS_H 1
| #define HAVE_WCHAR_H 1
| #define HAVE_NET_ROUTE_H 1
| #define HAVE_SYS_SYSCTL_H 1
| #define HAVE_LASTLOG_H 1
| #define HAVE_SYS_MOUNT_H 1
| #define HAVE_SYS_UN_H 1
| #define PAM_TTY_KLUDGE 1
| #define LOCKED_PASSWD_PREFIX "!"
| #define SPT_TYPE SPT_REUSEARGV
| #define LINK_OPNOTSUPP_ERRNO EPERM
| #define _PATH_BTMP "/var/log/btmp"
| #define USE_BTMP 1
| #define LINUX_OOM_ADJUST 1
| #define HAVE_LINUX_IF_TUN_H 1
| #define SSH_TUN_LINUX 1
| #define SSH_TUN_COMPAT_AF 1
| #define SSH_TUN_PREPEND_AF 1
| #define HAVE_LINUX_FILTER_H 1
| #define HAVE_LINUX_AUDIT_H 1
| #define SECCOMP_AUDIT_ARCH AUDIT_ARCH_X86_64
| #define HAVE_DIRNAME 1
| #define HAVE_LIBGEN_H 1
| #define HAVE_BASENAME 1
| #define HAVE_LIBZ 1
| #define HAVE_UTIMES 1
| #define HAVE_LIBUTIL_H 1
| #define HAVE_LOGIN 1
| #define HAVE_LOGOUT 1
| #define HAVE_OPENPTY 1
| #define HAVE_UPDWTMP 1
| #define HAVE_LOGWTMP 1
| #define HAVE_STRFTIME 1
| #define HAVE_STDLIB_H 1
| #define HAVE_MALLOC 1
| #define HAVE_STDLIB_H 1
| #define HAVE_REALLOC 1
| #define HAVE_CALLOC 1
| #define GLOB_HAS_ALTDIRFUNC 1
| #define HAVE_DECL_GLOB_NOMATCH 1
| #define BROKEN_STRNVIS 1
| #define HAVE_PROC_PID 1
| #define HAVE_ASPRINTF 1
| #define HAVE_BCOPY 1
| #define HAVE_BZERO 1
| #define HAVE_CLOCK 1
| #define HAVE_DIRFD 1
| #define HAVE_ENDGRENT 1
| #define HAVE_ERR 1
| #define HAVE_ERRX 1
| #define HAVE_FCHMOD 1
| #define HAVE_FCHMODAT 1
| #define HAVE_FCHOWN 1
| #define HAVE_FCHOWNAT 1
| #define HAVE_FLOCK 1
| #define HAVE_FREEADDRINFO 1
| #define HAVE_FSTATFS 1
| #define HAVE_FSTATVFS 1
| #define HAVE_FUTIMES 1
| #define HAVE_GETADDRINFO 1
| #define HAVE_GETCWD 1
| #define HAVE_GETGROUPLIST 1
| #define HAVE_GETLINE 1
| #define HAVE_GETNAMEINFO 1
| #define HAVE_GETOPT 1
| #define HAVE_GETPAGESIZE 1
| #define HAVE_GETPGID 1
| #define HAVE_GETRLIMIT 1
| #define HAVE_GETSID 1
| #define HAVE_GETTTYENT 1
| #define HAVE_GLOB 1
| #define HAVE_INET_ATON 1
| #define HAVE_INET_NTOA 1
| #define HAVE_INET_NTOP 1
| #define HAVE_INNETGR 1
| #define HAVE_LLABS 1
| #define HAVE_MEMMEM 1
| #define HAVE_MEMMOVE 1
| #define HAVE_MKDTEMP 1
| #define HAVE_POLL 1
| #define HAVE_PRCTL 1
| #define HAVE_RAISE 1
| #define HAVE_RECVMSG 1
| #define HAVE_RRESVPORT_AF 1
| #define HAVE_SENDMSG 1
| #define HAVE_SETEGID 1
| #define HAVE_SETENV 1
| #define HAVE_SETEUID 1
| #define HAVE_SETGROUPS 1
| #define HAVE_SETLINEBUF 1
| #define HAVE_SETREGID 1
| #define HAVE_SETREUID 1
| #define HAVE_SETRLIMIT 1
| #define HAVE_SETSID 1
| #define HAVE_SETVBUF 1
| #define HAVE_SIGACTION 1
| #define HAVE_SIGVEC 1
| #define HAVE_SNPRINTF 1
| #define HAVE_SOCKETPAIR 1
| #define HAVE_STATFS 1
| #define HAVE_STATVFS 1
| #define HAVE_STRCASESTR 1
| #define HAVE_STRDUP 1
| #define HAVE_STRERROR 1
| #define HAVE_STRNDUP 1
| #define HAVE_STRNLEN 1
| #define HAVE_STRPTIME 1
| #define HAVE_STRSIGNAL 1
| #define HAVE_STRTOLL 1
| #define HAVE_STRTOUL 1
| #define HAVE_STRTOULL 1
| #define HAVE_SYSCONF 1
| #define HAVE_TCGETPGRP 1
| #define HAVE_TRUNCATE 1
| #define HAVE_UNSETENV 1
| #define HAVE_UPDWTMPX 1
| #define HAVE_UTIMENSAT 1
| #define HAVE_USLEEP 1
| #define HAVE_VASPRINTF 1
| #define HAVE_VSNPRINTF 1
| #define HAVE_WAITPID 1
| #define HAVE_WARN 1
| #define HAVE_DECL_BZERO 1
| #define HAVE_MBLEN 1
| #define HAVE_MBTOWC 1
| #define HAVE_NL_LANGINFO 1
| #define HAVE_WCWIDTH 1
| #define HAVE_ISBLANK 1
| #define ENABLE_PKCS11 /**/
| #define HAVE_GAI_STRERROR 1
| #define HAVE_GAI_STRERROR 1
| #define HAVE_CONST_GAI_STRERROR_PROTO 1
| #define HAVE_NANOSLEEP 1
| #define HAVE_CLOCK_GETTIME 1
| #define HAVE_STRSEP 1
| #define HAVE_TCSENDBREAK 1
| #define HAVE_DECL_H_ERRNO 1
| #define HAVE_DECL_SHUT_RD 1
| #define HAVE_DECL_O_NONBLOCK 1
| #define HAVE_DECL_READV 1
| #define HAVE_DECL_WRITEV 1
| #define HAVE_DECL_MAXSYMLINKS 1
| #define HAVE_DECL_OFFSETOF 1
| #define HAVE_DECL_HOWMANY 1
| #define HAVE_DECL_NFDBITS 1
| #define HAVE_FD_MASK 1
| #define HAVE_SETRESUID 1
| #define HAVE_SETRESGID 1
| #define HAVE_GETTIMEOFDAY 1
| #define HAVE_TIME 1
| #define HAVE_ENDUTENT 1
| #define HAVE_GETUTENT 1
| #define HAVE_GETUTID 1
| #define HAVE_GETUTLINE 1
| #define HAVE_PUTUTLINE 1
| #define HAVE_SETUTENT 1
| #define HAVE_UTMPNAME 1
| #define HAVE_ENDUTXENT 1
| #define HAVE_GETUTXENT 1
| #define HAVE_GETUTXID 1
| #define HAVE_GETUTXLINE 1
| #define HAVE_PUTUTXLINE 1
| #define HAVE_SETUTXENT 1
| #define HAVE_UTMPXNAME 1
| #define HAVE_DAEMON 1
| #define HAVE_GETPAGESIZE 1
| #define SNPRINTF_CONST const
| #define HAVE_SO_PEERCRED 1
| #define HAVE_STRICT_MKSTEMP 1
| #define HAVE_DECL_AI_NUMERICSERV 1
| #define HAVE_GETPGRP 1
| #define GETPGRP_VOID 1
| /* end confdefs.h.  */
| /* Define OpenSSL_version to an innocuous variant, in case <limits.h> declares OpenSSL_version.
|    For example, HP-UX 11i <limits.h> declares gettimeofday.  */
| #define OpenSSL_version innocuous_OpenSSL_version
|
| /* System header to define __stub macros and hopefully few prototypes,
|     which can conflict with char OpenSSL_version (); below.
|     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|     <limits.h> exists even on freestanding compilers.  */
|
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|
| #undef OpenSSL_version
|
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char OpenSSL_version ();
| /* The GNU C library defines this for functions which it implements
|     to always fail with ENOSYS.  Some functions are actually named
|     something starting with __ and the normal name is an alias.  */
| #if defined __stub_OpenSSL_version || defined __stub___OpenSSL_version
| choke me
| #endif
|
| int
| main ()
| {
| return OpenSSL_version ();
|   ;
|   return 0;
| }

又检查了OpenSSL_version的位置:

$ nm /usr/local/lib/libcrypto.so | grep OpenSSL_version
00000000000eb3f0 T OpenSSL_version
00000000000eb3e0 T OpenSSL_version_num

openssl默认安装到了/usr/local下,心里有谱了,

CCFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure

然后成功make,完活。

  • 7
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值