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

Add CURL_USE_SYSROOT_LIBZ variable to automatically link zlib in sysroot #13516

Closed
wants to merge 1 commit into from

Conversation

cntrump
Copy link

@cntrump cntrump commented May 2, 2024

For the cross-platform compilation environment, zlib is already in sysroot.
In this case, is it possible to directly specify the link parameter -lz?

example: cmake -G Ninja -DCURL_USE_SYSROOT_LIBZ=ON ...

@vszakats
Copy link
Member

vszakats commented May 2, 2024

Is it correct that you'd like to override the zlib found automatically by CMake to one that's necessary for your cross-target?

If so, have you tried this method?:

-DZLIB_INCLUDE_DIR=<custom-sysroot>/include
-DZLIB_LIBRARY=<custom-sysroot>/lib/libz.a

@cntrump
Copy link
Author

cntrump commented May 4, 2024

Is it correct that you'd like to override the zlib found automatically by CMake to one that's necessary for your cross-target?

If so, have you tried this method?:

-DZLIB_INCLUDE_DIR=<custom-sysroot>/include
-DZLIB_LIBRARY=<custom-sysroot>/lib/libz.a

I encountered this problem when compiling the apple universal version, because there is only libz.tbd and no libz.a. Use -lz to link to libz.tbd correctly.

@vszakats
Copy link
Member

vszakats commented May 4, 2024

Would this work in your case to spec the .tbd?:

-DZLIB_LIBRARY=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/lib/libz.tbd

(replace with your custom full path)

@cntrump
Copy link
Author

cntrump commented May 5, 2024

Would this work in your case to spec the .tbd?:

-DZLIB_LIBRARY=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/lib/libz.tbd

(replace with your custom full path)

Works, thanks !

@cntrump cntrump closed this May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants