一、下载libcurl库相关工具
下载地址:https://github.com/curl/curl/releases/tag/curl-7_71_1
下载后移动到虚拟机/树莓派
二、解压
tar xvf curl-7.71.1.tar.gz
解压之后生成文件夹curl-7.71.1
cwj-007@ubuntu:~/httpHandler$ ls
curl-7.71.1 curl-7.71.1.tar.gz
进入此文件夹
cd curl-7.71.1
可以通过 阅读 README 或者 docs文件来做了解
其中:INSTALL.md文件必看
进入文件中重点查看unix部分
# Unix
A normal Unix installation is made in three or four steps (after you've
unpacked the source archive):
./configure //配置文件(带参数)
make //编译
make test (optional)
make install //安装
You probably need to be root when doing the last command.
Get a full listing of all available configure options by invoking it like:
./configure --help
If you want to install curl in a different file hierarchy than `/usr/local`,
specify that when running configure:
./configure --prefix=/path/to/curl/tree //指定安装的文件夹路径
If you have write permission in that directory, you can do 'make install'
without being root. An example of this would be to make a local install in
your own home directory:
./configure --host=HOST cross-compile to build programs to run on HOST [BUILD] //交叉编译
./configure --prefix=$HOME
make
make install
The configure script always tries to find a working SSL library unless
explicitly told not to. If you have OpenSSL installed in the default search
path for your compiler/linker, you don't need to do anything special. If you
have OpenSSL installed in `/usr/local/ssl`, you can run configure like:
./configure --with-ssl
If you have OpenSSL installed somewhere else (for example, `/opt/OpenSSL`) and
you have pkg-config installed, set the pkg-config path first, like this:
env PKG_CONFIG_PATH=/opt/OpenSSL/lib/pkgconfig ./configure --with-ssl
Without pkg-config installed, use this:
./configure --with-ssl=/opt/OpenSSL
If you insist on forcing a build without SSL support, even though you may
have OpenSSL installed in your system, you can run configure like this:
./configure --without-ssl
If you have OpenSSL installed, but with the libraries in one place and the
header files somewhere else, you have to set the `LDFLAGS` and `CPPFLAGS`
environment variables prior to running configure. Something like this should
work:
CPPFLAGS="-I/path/to/ssl/include" LDFLAGS="-L/path/to/ssl/lib" ./configure
If you have shared SSL libs installed in a directory where your run-time
linker doesn't find them (which usually causes configure failures), you can
provide this option to gcc to set a hard-coded path to the run-time linker:
LDFLAGS=-Wl,-R/usr/local/ssl/lib ./configure --with-ssl
三、配置、编译、安装
1.配置
./configure --prefix=$PWD/_install //安装在当前路径下的install文件夹(没有此文件埃及则自动生成)
注意:若要使用交叉编译,则加上参数–host=arm-linux
./configure --prefix=$PWD/_install --host=arm-linux
2.编译
make
3.安装
make install
此时可以看到当前目录底下生成_install文件夹
可以查看到我们需要用到的
1.头文件
2.库