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


目录
相关文章
|
5天前
|
存储 编译器 Linux
动态链接的魔法:Linux下动态链接库机制探讨
本文将深入探讨Linux系统中的动态链接库机制,这其中包括但不限于全局符号介入、延迟绑定以及地址无关代码等内容。
|
4月前
|
安全 Linux vr&ar
Linux的动态库和静态库
Linux的动态库和静态库
|
2月前
|
Linux API 开发工具
FFmpeg开发笔记(五十九)Linux编译ijkplayer的Android平台so库
ijkplayer是由B站研发的移动端播放器,基于FFmpeg 3.4,支持Android和iOS。其源码托管于GitHub,截至2024年9月15日,获得了3.24万星标和0.81万分支,尽管已停止更新6年。本文档介绍了如何在Linux环境下编译ijkplayer的so库,以便在较新的开发环境中使用。首先需安装编译工具并调整/tmp分区大小,接着下载并安装Android SDK和NDK,最后下载ijkplayer源码并编译。详细步骤包括环境准备、工具安装及库编译等。更多FFmpeg开发知识可参考相关书籍。
108 0
FFmpeg开发笔记(五十九)Linux编译ijkplayer的Android平台so库
|
4月前
|
NoSQL Linux C语言
嵌入式GDB调试Linux C程序或交叉编译(开发板)
【8月更文挑战第24天】本文档介绍了如何在嵌入式环境下使用GDB调试Linux C程序及进行交叉编译。调试步骤包括:编译程序时加入`-g`选项以生成调试信息;启动GDB并加载程序;设置断点;运行程序至断点;单步执行代码;查看变量值;继续执行或退出GDB。对于交叉编译,需安装对应架构的交叉编译工具链,配置编译环境,使用工具链编译程序,并将程序传输到开发板进行调试。过程中可能遇到工具链不匹配等问题,需针对性解决。
124 3
|
4月前
|
Linux API
在Linux中,程序产生了库日志虽然删除了,但磁盘空间未更新是什么原因?
在Linux中,程序产生了库日志虽然删除了,但磁盘空间未更新是什么原因?
|
5月前
|
Oracle 关系型数据库 Linux
讲解linux下的Qt如何编译oracle的驱动库libqsqloci.so
通过这一连串的步骤,可以专业且有效地在Linux下为Qt编译Oracle驱动库 `libqsqloci.so`,使得Qt应用能够通过OCI与Oracle数据库进行交互。这些步骤适用于具备一定Linux和Qt经验的开发者,并且能够为需要使用Qt开发数据库应用的专业人士提供指导。
168 1
讲解linux下的Qt如何编译oracle的驱动库libqsqloci.so
|
4月前
|
Linux 网络安全 API
【Azure 应用服务】App Service For Linux 环境中,如何从App Service中获取GitHub私有库(Private Repos)的Deploy Key(RSA key)呢?
【Azure 应用服务】App Service For Linux 环境中,如何从App Service中获取GitHub私有库(Private Repos)的Deploy Key(RSA key)呢?
|
4月前
|
小程序 Linux 开发者
Linux之缓冲区与C库IO函数简单模拟
通过上述编程实例,可以对Linux系统中缓冲区和C库IO函数如何提高文件读写效率有了一个基本的了解。开发者需要根据应用程序的具体需求来选择合适的IO策略。
37 0
|
5月前
|
Linux 编译器 vr&ar
【Linux】静态库和动态库
本文详细介绍了Linux系统中静态库和动态库的概念、区别、制作与使用方法,包括它们在链接时的区别、加载机制以及优缺点。
65 0
|
5月前
|
Linux Shell vr&ar
【linux】详解——库
【linux】详解——库