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

Undefined references to CURL functions #856

Open
370rokas opened this issue Oct 25, 2024 · 1 comment
Open

Undefined references to CURL functions #856

370rokas opened this issue Oct 25, 2024 · 1 comment

Comments

@370rokas
Copy link

370rokas commented Oct 25, 2024

Hey,
I am getting linker errors to libCurl functions.

/usr/bin/ld: /home/rokas/Documents/CLionProjects/scm-scraper/build/libdate-tz.so.3.0.3: undefined reference to `curl_global_init@CURL_OPENSSL_4'
/usr/bin/ld: /home/rokas/Documents/CLionProjects/scm-scraper/build/libdate-tz.so.3.0.3: undefined reference to `curl_easy_perform@CURL_OPENSSL_4'
/usr/bin/ld: /home/rokas/Documents/CLionProjects/scm-scraper/build/libdate-tz.so.3.0.3: undefined reference to `curl_easy_setopt@CURL_OPENSSL_4'
/usr/bin/ld: /home/rokas/Documents/CLionProjects/scm-scraper/build/libdate-tz.so.3.0.3: undefined reference to `curl_easy_init@CURL_OPENSSL_4'
/usr/bin/ld: /home/rokas/Documents/CLionProjects/scm-scraper/build/libdate-tz.so.3.0.3: undefined reference to `curl_easy_cleanup@CURL_OPENSSL_4'
/usr/bin/ld: /home/rokas/Documents/CLionProjects/scm-scraper/build/libdate-tz.so.3.0.3: undefined reference to `curl_global_cleanup@CURL_OPENSSL_4'

This is my CMake code for getting the library:

set(BUILD_TZ_LIB ON)
FetchContent_Declare(
        date_src
        GIT_REPOSITORY https://github.com/HowardHinnant/date.git
        GIT_TAG        v3.0.3
)
FetchContent_MakeAvailable(date_src)

target_link_libraries(scm-scraper PRIVATE
        date::date-tz
        date::date
        ....
)

I am running:

Arch Linux 6.11.4-arch1-1
GCC 14.2.1 20240910
CMake 3.30.5
curl 8.10.1 (x86_64-pc-linux-gnu) libcurl/8.10.1 OpenSSL/3.3.2 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.64.0 nghttp3/1.6.0

Any clue what might be wrong with my system's configuration?

Best Regards

@HowardHinnant
Copy link
Owner

I'm a CMake flunky. So if you find a fix to the CMake build system that fixes this, I'm open to a patch.

Meanwhile I like to build without CMake. Here are the instructions I follow: https://howardhinnant.github.io/date/tz.html#Installation

Adding -lcurl to your compile/link command will fix this. Here is my complete typical build command:

clang++ -std=c++17 test.cpp -I../date/include ../date/src/tz.cpp -O3 -lcurl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants