如何在Ubuntu上安装OpenSSL C ++库? [英] How do I install the OpenSSL C++ library on Ubuntu?

查看:667
本文介绍了如何在Ubuntu上安装OpenSSL C ++库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Ubuntu 10.04 LTS上使用OpenSSL 1.0.0构建一些代码。当我运行make,它调用g ++与-lssl选项。来源包括:

  #include< openssl / bio.h> 
#include< openssl / buffer.h>
#include< openssl / des.h>
#include< openssl / evp.h>
#include< openssl / pem.h>
#include< openssl / rsa.h>

我跑了:

  $ sudo apt-get install openssl 
读取软件包列表...完成
构建依赖关系树
读取状态信息...完成
openssl已经是最新版本。
0升级,0新安装,0删除和3未升级。

但我想openssl包不包括库。我得到这些错误make:

  foo.cpp:21:25:错误:openssl / bio.h:没有这样的文件或目录
foo.cpp:22:28:错误:openssl / buffer.h:没有这样的文件或目录
foo.cpp:23:25:错误:openssl / des.h:没有这样的文件或目录
foo.cpp:24:25:错误:openssl / evp.h:没有这样的文件或目录
foo.cpp:25:25:错误:openssl / pem.h:没有这样的文件或目录
foo.cpp:26:25:错误:openssl / rsa.h:没有这样的文件或目录

如何在Ubuntu 10.04 LTS上安装OpenSSL C ++库?



我做了一个 man g ++ 和(在选项链接)为-l选项它声明:链接器搜索标准目录列表的库...和搜索的目录包括几个标准系统目录...是那些标准系统目录?



更新:答案是 sudo apt-get install libssl-dev 。我怎么能想出自己(除了在这里提出这个问题)?我可以以某种方式告诉apt-get列出所有的包,和grep的ssl?或者我需要知道lib * -dev命名约定吗?

解决方案

要安装开发包是libssl-dev:

  sudo apt-get install libssl-dev 
pre>

I'm trying to build some code on Ubuntu 10.04 LTS that uses OpenSSL 1.0.0. When I run make, it invokes g++ with the "-lssl" option. The source includes:

#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/des.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>

I ran:

$ sudo apt-get install openssl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
openssl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

But I guess the openssl package doesn't include the library. I get these errors on make:

foo.cpp:21:25: error: openssl/bio.h: No such file or directory
foo.cpp:22:28: error: openssl/buffer.h: No such file or directory
foo.cpp:23:25: error: openssl/des.h: No such file or directory
foo.cpp:24:25: error: openssl/evp.h: No such file or directory
foo.cpp:25:25: error: openssl/pem.h: No such file or directory
foo.cpp:26:25: error: openssl/rsa.h: No such file or directory

How do I install the OpenSSL C++ library on Ubuntu 10.04 LTS?

I did a man g++ and (under "Options for Linking") for the -l option it states: " The linker searches a standard list of directories for the library..." and "The directories searched include several standard system directories..." What are those standard system directories?

Update: The answer is sudo apt-get install libssl-dev. How could I have figured that out for myself (other than asking this question here)? Can I somehow tell apt-get to list all packages, and grep for ssl? Or do I need to know the "lib*-dev" naming convention?

解决方案

You want to install the development package, which is libssl-dev:

sudo apt-get install libssl-dev

这篇关于如何在Ubuntu上安装OpenSSL C ++库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆