Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[package] libcurl/8.2.1: Unable to get local issuer certificate #21034

Closed
dpaulat opened this issue Nov 10, 2023 · 1 comment
Closed

[package] libcurl/8.2.1: Unable to get local issuer certificate #21034

dpaulat opened this issue Nov 10, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@dpaulat
Copy link

dpaulat commented Nov 10, 2023

Description

I am unable to successfully use cpr/1.10.4 and libcurl/8.2.1 to access remote resources using https. This works for me in Linux (Ubuntu 22.04, gcc 11), but not Windows (MSVC 2022). Older versions (cpr/1.9.0 and libcurl/7.86.0) work as expected. My issue seems to be presenting itself identical to #13910, although in a different environment.

Package and Environment Details

  • Package Name/Version: libcurl/8.2.1 with cpr/1.10.4
  • Operating System+version: Windows 11 22H2 (22621.2428)
  • Compiler+version: MSVC 2022 (17.7.2)
  • Docker image: N/A
  • Conan version: conan 1.59.0
  • Python version: Python 3.10.3

Conan profile

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.version=17
build_type=Release
[options]
[conf]
[build_requires]
[env]

Steps to reproduce

Demo Project

CMakeLists.txt:

cmake_minimum_required(VERSION 3.10)
project(bad-libcurl)

set (CMAKE_CXX_STANDARD 20)

if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
  message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
  file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/0.18.1/conan.cmake"
                "${CMAKE_BINARY_DIR}/conan.cmake"
                TLS_VERIFY ON)
endif()

include(${CMAKE_BINARY_DIR}/conan.cmake)

conan_cmake_configure (REQUIRES 
                        cpr/1.10.4
                        libcurl/8.2.1
                        GENERATORS cmake)
conan_cmake_autodetect (settings)
conan_cmake_install (PATH_OR_REFERENCE . BUILD missing SETTINGS ${settings})

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(bad-libcurl Main.cpp)
target_include_directories(bad-libcurl PUBLIC ./)
target_include_directories(bad-libcurl PUBLIC ${CONAN_INCLUDE_DIRS})

target_link_libraries(bad-libcurl ${CONAN_LIBS})

Main.cpp:

#include "cpr/cpr.h"
#include <iostream>

int main() {
    auto r = cpr::Get(cpr::Url{"https://example.com"});
    std::cerr << "Fail: " << r.error.message << std::endl;
}

Commands:

cmake . -G Ninja -DCMAKE_BUILD_TYPE=Release
ninja
bin\bad-libcurl.exe

Logs:

>bin\bad-libcurl.exe
Fail: SSL certificate problem: unable to get local issuer certificate

Logs

Click to expand log
>cmake . -G Ninja -DCMAKE_BUILD_TYPE=Release
-- The C compiler identification is MSVC 19.37.32822.0
-- The CXX compiler identification is MSVC 19.37.32822.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Downloading conan.cmake from https://github.com/conan-io/cmake-conan
-- Conan: Detected VS runtime: MD
-- Conan: checking conan executable
-- Conan: Found program C:/Users/dpaul/AppData/Local/Programs/Python/Python310/Scripts/conan.exe
-- Conan: Version found Conan version 1.59.0
-- Conan executing: C:/Users/dpaul/AppData/Local/Programs/Python/Python310/Scripts/conan.exe install . --build missing --settings arch=x86_64 --settings build_type=Release --settings compiler=Visual Studio --settings compiler.version=17 --settings compiler.runtime=MD --settings compiler.cppstd=20
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.cppstd=20
compiler.runtime=MD
compiler.version=17
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

WARN: cpr/1.10.4: requirement libcurl/8.0.1 overridden by your conanfile to libcurl/8.2.1
WARN: openssl/3.1.4: requirement zlib/[>=1.2.11 <2] overridden by libcurl/8.2.1 to zlib/1.3
Version ranges solved
    Version range '>=1.1 <4' required by 'libcurl/8.2.1' resolved to 'openssl/3.1.4' in local cache
    Version range '>=1.2.11 <2' required by 'libcurl/8.2.1' resolved to 'zlib/1.3' in local cache
    Version range '>=1.2.11 <2' required by 'openssl/3.1.4' valid for downstream requirement 'zlib/1.3'

conanfile.txt: Installing package
Requirements
    cpr/1.10.4 from 'conancenter' - Cache
    libcurl/8.2.1 from 'conancenter' - Cache
    openssl/3.1.4 from 'conancenter' - Cache
    zlib/1.3 from 'conancenter' - Cache
Packages
    cpr/1.10.4:a1bb317656abbffd4fe4e7b09a239841ce7a6edb - Cache
    libcurl/8.2.1:a875f41e4829a262d98e23ace329473a9a7e8894 - Cache
    openssl/3.1.4:c47212d5fc818fd54769ccb1344e758f51a9aacb - Cache
    zlib/1.3:5a61a86bb3e07ce4262c80e1510f9c05e9b6d48b - Cache

Installing (downloading, building) binaries...
zlib/1.3: Already installed!
openssl/3.1.4: Already installed!
libcurl/8.2.1: Already installed!
cpr/1.10.4: Already installed!
conanfile.txt: Generator txt created conanbuildinfo.txt
conanfile.txt: Generator cmake created conanbuildinfo.cmake
conanfile.txt: Aggregating env generators
conanfile.txt: Generated conaninfo.txt
conanfile.txt: Generated graphinfo
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: C:/Users/dpaul/git/curl-test
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/dpaul/git/curl-test

>ninja
[2/2] Linking CXX executable bin\bad-libcurl.exe

>bin\bad-libcurl.exe
Fail: SSL certificate problem: unable to get local issuer certificate
@dpaulat dpaulat added the bug Something isn't working label Nov 10, 2023
@dpaulat
Copy link
Author

dpaulat commented Nov 16, 2023

This appears to be a compatibility issue between libcurl 8.0.1+ and cpr <= 1.10.4. Using libcurl/8.4.0 and cpr/1.10.5 resolves the issue.

@dpaulat dpaulat closed this as completed Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant