错误:libcurl >= 7.28.0 库和标头需要支持 https

错误:libcurl >= 7.28.0 库和标头需要支持 https

我很抱歉写了这么长的问题,但考虑到类似的问题已经被问了多少次,我觉得我必须提供更多的背景信息。


在我的系统中,我明白了。 。 。

checking for curl-config... /usr/bin/curl-config
checking libcurl version ... 8.2.1
checking curl/curl.h usability... yes
checking curl/curl.h presence... yes
checking for curl/curl.h... yes
checking if libcurl is version 7 and >= 7.28.0... 
configure: error: libcurl >= 7.28.0 library and headers are required with support for https

当尝试安装 R 时(版本4.0.3,这是不可协商的)与./configure --prefix=/opt/R/ --exec-prefix=/opt/R/ --with-libpth-prefix=/opt/ --without-recommended-packages --with-pcre1 --enable-R-shlib

在 中config.log,我看到以下内容。

configure:46024: checking for curl-config
configure:46042: found /usr/bin/curl-config
configure:46054: result: /usr/bin/curl-config
configure:46080: checking curl/curl.h usability
configure:46080: gcc -c  -g -O2 -fpic  -I/usr/local/include  conftest.c >&5
configure:46080: $? = 0
configure:46080: result: yes
configure:46080: checking curl/curl.h presence
configure:46080: gcc -E  -I/usr/local/include  conftest.c
configure:46080: $? = 0
configure:46080: result: yes
configure:46080: checking for curl/curl.h
configure:46080: result: yes
configure:46094: checking if libcurl is version 7 and >= 7.28.0
configure:46123: gcc -o conftest  -g -O2 -fpic  -I/usr/local/include  -L/usr/local/lib64 conftest.c -lcurl -lpcre -llzma -lbz2 -lz -lrt -ldl -lm  >&5
configure:46123: $? = 0
configure:46123: ./conftest
configure:46123: $? = 1
configure: program exited with status 1
configure: failed program was:

然后,当内容confdefs.h被曝光后,我看到:

#include <stdlib.h>
| #include <curl/curl.h>
| int main()
| {
| #ifdef LIBCURL_VERSION_MAJOR
| #if LIBCURL_VERSION_MAJOR > 7
|   exit(1);
| #elif LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR >= 28
|   exit(0);
| #else
|   exit(1);
| #endif
| #else
|   exit(1);
| #endif
| }
| 
configure:46133: result: 
configure:46191: error: libcurl >= 7.28.0 library and headers are required with support for https

多个网站上有多个关于同一错误的问题,但我尝试过的解决方案都不适合我。

因为显然我有多个版本可用。 。 。

bash-4.2# yum list curl --showduplicates | head -n 5
Loaded plugins: ovl, priorities
Installed Packages
curl.x86_64                    8.2.1-1.amzn2.0.3                      installed 
Available Packages
curl.x86_64                    7.55.1-8.amzn2.0.1                     amzn2-core
bash-4.2# yum list libcurl --showduplicates | head -n 5
Loaded plugins: ovl, priorities
Installed Packages
libcurl.x86_64                  8.2.1-1.amzn2.0.3                     installed 
Available Packages
libcurl.x86_64                  7.55.1-8.amzn2.0.1                    amzn2-core

。 。 。 (每个我都有更多),我最后的尝试围绕着尝试降级和/或删除curllibcurl,但没有运气:

bash-4.2# yum downgrade libcurl
Loaded plugins: ovl, priorities
amzn2-core                                                                                                                                                                                  | 3.6 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package libcurl.x86_64 0:8.2.1-1.amzn2.0.2 will be a downgrade
---> Package libcurl.x86_64 0:8.2.1-1.amzn2.0.3 will be erased
--> Finished Dependency Resolution
Error: Package: curl-8.2.1-1.amzn2.0.3.x86_64 (installed)
           Requires: libcurl(x86-64) = 8.2.1-1.amzn2.0.3

(输出继续)。

我正在 Docker 容器中工作,因此上面的内容很容易重现。我将 Docker 文件留在这个问题的末尾。

我认为以下是有用的系统信息。

bash-4.2# cat /etc/*-release*
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
SUPPORT_END="2025-06-30"
Amazon Linux release 2 (Karoo)
cpe:2.3:o:amazon:amazon_linux:2

谁能帮我解决这个问题吗?


这是Dockerfile

FROM amazonlinux:2

RUN yum update -y && \
    yum install -y make zip gzip tar which wget java \
    readline-devel \
    xorg-x11-server-devel libX11-devel libXt-devel \
    libcurl-devel libcurl4-openssl-dev \
    openssl-devel libxml2-devel \
    gcc-c++ gcc-gfortran \
    zlib-devel bzip2 bzip2-libs bzip2-devel xz-devel && \
    yum clean all

RUN mkdir -p /opt/R /opt/bin

RUN mv /usr/bin/which /opt/bin/

WORKDIR /opt
RUN wget https://cran.r-project.org/src/base/R-4/R-4.0.3.tar.gz && \
    tar -xf R-4.0.3.tar.gz && \
    mv R-4.0.3/* /opt/R && \
    rm -rf R-4.0.3.tar.gz R-4.0.3

WORKDIR /opt/R

# RUN ./configure --prefix=/opt/R/ --exec-prefix=/opt/R/ --with-libpth-prefix=/opt/ \
#     --without-recommended-packages --with-pcre1 --enable-R-shlib

CMD ["bash"]

答案1

由于您一直使用 4.0.3,并且从那时起R项目确定升级libcurl7 升级到 8 不会破坏 API 或 ABI,您可以修补构建。运行之前./configure,运行

awk '/> 7/ { c = 1 } !/> 7/ && c { print("  exit(0);"); c = 0; next; } 1' configure > configure.new && mv configure.new configure

如果您不必专门构建 R 4.0.3,最简单的解决方案是切换到 4.3.0 或更高版本(理想情况下是当前版本的 4.3.1); 4.3.0 及更高版本支持使用libcurl8 进行构建。

相关内容