linux 交叉编译libcurl库

简介: linux 交叉编译libcurl库

本文介绍libcurl的交叉编译

如果不需要交叉编译的话,直接通过 configure make make install 三连基本就能用.

首先介绍编译参数

General parameters:

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/curl]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR]
 
Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
 
System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]

Optional Features:

  #根据自己需求选择
  #由于参数太多,大部分包只列举enable参数,需要禁止把enable改成disable就行
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-maintainer-mode
                          enable make rules and dependencies not useful (and
                          sometimes confusing) to the casual installer
  --enable-silent-rules   less verbose build output (undo: "make V=1")
  --enable-debug          Enable debug build options
  --enable-optimize       Enable compiler optimizations
  --enable-warnings       Enable strict compiler warnings
  --enable-werror         Enable compiler warnings as errors
  --enable-curldebug      Enable curl debug memory tracking
  --enable-symbol-hiding  Enable hiding of library internal symbols
  --enable-hidden-symbols To be deprecated, use --enable-symbol-hiding
  --enable-ares[=PATH]    Enable c-ares for DNS lookups
  --disable-rt            disable dependency on -lrt
  --enable-ech            Enable ECH support
  --enable-code-coverage  Provide code coverage
  --enable-dependency-tracking
                          do not reject slow dependency extractors
  --disable-largefile     omit support for large files
  --enable-shared[=PKGS]  build shared libraries [default=yes]
  --enable-static[=PKGS]  build static libraries [default=yes]
  --enable-fast-install[=PKGS]
                          optimize for fast installation [default=yes]
  --disable-libtool-lock  avoid locking (might break parallel builds)
  --enable-http           Enable HTTP support
  --enable-ftp            Enable FTP support
  --enable-file           Enable FILE support
  --enable-ldap           Enable LDAP support
  --enable-ldaps          Enable LDAPS support
  --enable-rtsp           Enable RTSP support
  --enable-proxy          Enable proxy support
  --enable-dict           Enable DICT support
  --enable-telnet         Enable TELNET support
  --enable-tftp           Enable TFTP support
  --enable-pop3           Enable POP3 support
  --enable-imap           Enable IMAP support
  --enable-smb            Enable SMB/CIFS support
  --enable-smtp           Enable SMTP support
  --enable-gopher         Enable Gopher support
  --enable-mqtt           Enable MQTT support
  --enable-manual         Enable built-in manual
  --enable-libcurl-option Enable --libcurl C code generation support
  --enable-libgcc         use libgcc when linking
  --enable-ipv6           Enable IPv6 (with IPv4) support
  --enable-openssl-auto-load-config
                          Enable automatic loading of OpenSSL configuration
  --enable-versioned-symbols
                          Enable versioned symbols in shared library
  --enable-threaded-resolver
                          Enable threaded resolver
  --enable-pthreads       Enable POSIX threads (default for threaded resolver)
  --enable-verbose        Enable verbose strings
  --enable-sspi           Enable SSPI
  --enable-crypto-auth    Enable cryptographic authentication
  --enable-ntlm-wb[=FILE] Enable NTLM delegation to winbind's ' ntlm_auth \
                          helper, where FILE is ntlm_auth's ' absolute filename \
                          (default: /usr/bin/ntlm_auth)
  --enable-tls-srp        Enable TLS-SRP authentication
  --enable-unix-sockets   Enable Unix domain sockets
  --enable-cookies        Enable cookies support
  --enable-socketpair     Enable socketpair support
  --enable-http-auth      Enable HTTP authentication support
  --enable-doh            Enable DoH support
  --enable-mime           Enable mime API support
  --enable-dateparse      Enable date parsing
  --enable-netrc          Enable netrc parsing
  --enable-progress-meter Enable progress-meter
  --enable-dnsshuffle     Enable DNS shuffling
  --enable-get-easy-options                        
                          Enable curl_easy_options
  --enable-alt-svc        Enable alt-svc support
  --enable-hsts           Enable HSTS support
 

Optional Packages:

#通过--with-<packagesname>=PATH 启动
#通过--without-<packagesname>   禁用
#具体明细可通过 configure -h  查看
 
#下面只列出几个特殊的参数
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                          both]
  --with-aix-soname=aix|svr4|both
                          shared library versioning (aka "SONAME") variant to
                          provide on AIX, [default=aix].
  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
  --with-sysroot[=DIR]    Search for dependent libraries within DIR (or the
                          compiler's ' sysroot if not specified).
  --with-ldap-lib=libname Specify name of ldap lib file
  --with-lber-lib=libname Specify name of lber lib file
  --with-gssapi-includes=DIR
                          Specify location of GSS-API headers
  --with-gssapi-libs=DIR  Specify location of GSS-API libs
  --with-gssapi=DIR       Where to look for GSS-API
 
  --with-zsh-functions-dir=PATH
                          Install zsh completions to PATH
  --without-zsh-functions-dir
                          Do not install zsh completions
  --with-fish-functions-dir=PATH
                          Install fish completions to PATH
  --without-fish-functions-dir
                          Do not install fish completions
  --with-default-ssl-backend=NAME
                          Use NAME as default SSL backend
  --without-default-ssl-backend
                          Use implicit default SSL backend

常规包列表(packagesname)

  • quiche
  • nghttp3
  • ngtcp2
  • nghttp2
  • libidn2
  • winidn
  • librtmp
  • wolfssh
  • libssh
  • libssh2
  • libmetalink
  • libpsl
  • ca-fallback
  • ca-path
  • nss
  • schannel
  • mesalink
  • mbedtls
  • gnutls
  • zlib
  • brotli
  • zstd
  • winssl
  • darwinssl
  • amissl
  • wolfssl
  • bearssl
  • ssl
  • secure-transport

Some influential environment variables:

  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  LT_SYS_LIBRARY_PATH
              User-defined run-time library search path.

本文使用的交叉编译器:

arm-linux-gcc

如果没有openssl库的,参考交叉编译openssl

以下是本人进行的编译参数(仅供参考)

#首先配置环境变量
CFLAGS=-fPIC
LIBS="-ldl"
#生成Makefile
 
./configure  \
--host=arm-linux  CC=/opt/vtcs_toolchain/vienna/usr/bin/arm-linux-gcc CXX=/opt/vtcs_toolchain/vienna/usr/bin/arm-linux-g++ \
--prefix=/armlib/curl  \
--with-ssl=/armlib/openssl \
--enable-shared --enable-static --enable-http-auth  --enable-http --enable-warnings --enable-file  --enable-libcurl-option \
--disable-pop3 --disable-dict  --disable-imap --disable-ldap --disable-ldaps  --disable-proxy  --disable-smb --disable-gopher --disable-mqtt --disable-hsts --disable-smtp --disable-telnet   \
--without-ca-bundle --without-gnutls --without-libidn --without-librtmp --without-libssh2  --without-nss --without-zlib  \
--without-wolfssl --without-winssl --without-schannel --without-darwinssl --without-secure-transport

configure配置成功的打印信息(仅供参考)

 

最后执行

make

make install

即可

 

参考网址

https://curl.se/docs/install.html


目录
相关文章
|
6天前
|
Linux 编译器 Android开发
FFmpeg开发笔记(九)Linux交叉编译Android的x265库
在Linux环境下,本文指导如何交叉编译x265的so库以适应Android。首先,需安装cmake和下载android-ndk-r21e。接着,下载x265源码,修改crosscompile.cmake的编译器设置。配置x265源码,使用指定的NDK路径,并在配置界面修改相关选项。随后,修改编译规则,编译并安装x265,调整pc描述文件并更新PKG_CONFIG_PATH。最后,修改FFmpeg配置脚本启用x265支持,编译安装FFmpeg,将生成的so文件导入Android工程,调整gradle配置以确保顺利运行。
24 1
FFmpeg开发笔记(九)Linux交叉编译Android的x265库
|
1月前
|
数据建模 Linux C++
linux交叉编译live555
linux交叉编译live555
33 1
|
1月前
|
Linux
linux 交叉编译libpng,libjpeg库
linux 交叉编译libpng,libjpeg库
23 1
|
1月前
|
存储 Linux 编译器
Linux 交叉编译第三方库需要设置的环境变量
Linux 交叉编译第三方库需要设置的环境变量
24 0
|
8天前
|
Linux 网络安全 开发工具
【GitLab私有仓库】在Linux上用Gitlab搭建自己的私有库并配置cpolar内网穿透
【GitLab私有仓库】在Linux上用Gitlab搭建自己的私有库并配置cpolar内网穿透
|
19天前
|
Linux 计算机视觉
Linux交叉编译opencv并移植ARM端
通过以上步骤,你可以在Linux上交叉编译OpenCV,并将生成的库文件和头文件移植到ARM平台上,从而在ARM上使用OpenCV。 买CN2云服务器,免备案服务器,高防服务器,就选蓝易云。百度搜索:蓝易云
36 0
|
1月前
|
Linux 编译器
Linux交叉编译libunwind
Linux交叉编译libunwind
35 0
|
1月前
|
Linux
Linux 交叉编译qt源码安装 注意项/建议
Linux 交叉编译qt源码安装 注意项/建议
10 0
|
1月前
|
算法 安全 Linux
Linux 裁剪并交叉编译openssl库
Linux 裁剪并交叉编译openssl库
34 1
|
6天前
|
机器学习/深度学习 缓存 监控
linux查看CPU、内存、网络、磁盘IO命令
`Linux`系统中,使用`top`命令查看CPU状态,要查看CPU详细信息,可利用`cat /proc/cpuinfo`相关命令。`free`命令用于查看内存使用情况。网络相关命令包括`ifconfig`(查看网卡状态)、`ifdown/ifup`(禁用/启用网卡)、`netstat`(列出网络连接,如`-tuln`组合)以及`nslookup`、`ping`、`telnet`、`traceroute`等。磁盘IO方面,`iostat`(如`-k -p ALL`)显示磁盘IO统计,`iotop`(如`-o -d 1`)则用于查看磁盘IO瓶颈。