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

Support custom curl library #1080

Closed
wants to merge 1 commit into from
Closed

Conversation

zhaowq32
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.53%. Comparing base (67cc95c) to head (e891f5c).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1080      +/-   ##
==========================================
- Coverage   82.58%   82.53%   -0.06%     
==========================================
  Files          53       53              
  Lines        7729     7729              
  Branches     1214     1214              
==========================================
- Hits         6383     6379       -4     
- Misses       1234     1239       +5     
+ Partials      112      111       -1     
---- 🚨 Try these New Features:

@supervacuus
Copy link
Collaborator

Can you explain what you are trying to achieve here?

Our build script already allows specifying your own libcurl build. You can add your libcurl-install path to the CMAKE_PREFIX_PATH or specify CURL_INCLUDE_DIR and CURL_LIBRARY. You don't need to make any changes.

@zhaowq32
Copy link
Contributor Author

I compile sentry on Linux and get an error "CURL: Required feature AsynchDNS is not found".

cmake -G "Ninja" -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="build/dest" -DBUILD_SHARED_LIBS=OFF -DSENTRY_BACKEND=inproc -DSENTRY_BUILD_EXAMPLES=OFF -DSENTRY_BUILD_SHARED_LIBS=OFF -DSENTRY_BUILD_TESTS=OFF -DSENTRY_TRANSPORT=curl -DCURL_INCLUDE_DIR=/test/libcurl/Debug/include -DCURL_LIBRARY=/test/libcurl/Debug/lib/libcurl.a ..     

@zhaowq32
Copy link
Contributor Author

system version:Ubuntu 22.04.4 LTS (GNU/Linux 5.15.0-119-generic x86_64)
cmake version 3.23.0

@supervacuus
Copy link
Collaborator

I compile sentry on Linux and get an error "CURL: Required feature AsynchDNS is not found".

Ok, but the solution to that problem isn't to bypass the check for AsynchDNS in the build script (which we also do at runtime).

You must check in your libcurl build configuration whether the AsynchDNS feature is enabled:

-- Features: alt-svc AsynchDNS HSTS HTTPS-proxy IPv6 Largefile libz SSL threadsafe UnixSockets

after which ours will take it up during configuration:

-- Found CURL: /curl/build/lib/libcurl.a (found version "8.11.1-DEV") found components: AsynchDNS 
-- Configuring done
-- Generating done
-- Build files have been written to: /sentry-native/build

Tested on Ubuntu 22.04 with CMake 3.22.1.

@zhaowq32
Copy link
Contributor Author

What is your compilation command? I tried it again and still got an error.

  1. cmake command for curl
cmake -G Ninja -DCMAKE_MAKE_PROGRAM=cmake/3.10.2.4988404/bin/ninja -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=curl-8.10.1/build/dest -DBUILD_SHARED_LIBS=OFF -DCURL_USE_OPENSSL=ON -DHTTP_ONLY=ON -DBUILD_CURL_EXE=OFF -DBUILD_TESTING=OFF -DCURL_USE_LIBSSH2=OFF -DUSE_NGHTTP2=OFF -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DENABLE_ARES=ON -DOPENSSL_ROOT_DIR=libs/linux/boringssl/Debug -DCARES_LIBRARY=libs/linux/cares/Debug/lib/libcares.a -DCARES_INCLUDE_DIR=libs/linux/cares/Debug/include -DCMAKE_DEBUG_POSTFIX= -DENABLE_DEBUG=ON ..
  1. curl log
-- Features: alt-svc AsynchDNS Debug HSTS HTTPS-proxy IPv6 Largefile NTLM SSL threadsafe TrackMemory UnixSockets
  1. sentry log
-- SENTRY_TRANSPORT=curl
-- SENTRY_BACKEND=inproc
-- SENTRY_LIBRARY_TYPE=STATIC
-- SENTRY_SDK_NAME=
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long
-- Check size of long - done
CMake Error at cmake-3.23/Modules/FindCURL.cmake:175 (message):
  CURL: Required feature AsynchDNS is not found
Call Stack (most recent call first):
  CMakeLists.txt:281 (find_package)

@zhaowq32
Copy link
Contributor Author

I think it's because I only copied the static library but not the pkg and cmake files.

@zhaowq32 zhaowq32 closed this Nov 19, 2024
@supervacuus
Copy link
Collaborator

I think it's because I only copied the static library but not the pkg and cmake files.

That makes sense. It is generally a good idea to source self-built dependencies from whatever they generate as their install output (i.e., cmake --install ... if you use CMake to build libcurl).

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

Successfully merging this pull request may close these issues.

2 participants