-
Notifications
You must be signed in to change notification settings - Fork 16
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
Unable to link against third party library like openssl #192
Comments
So my question is, how are you trying to link against libcrypto? Are you trying to use an |
I have a systemLibrary :
|
Okay, I did a little testing on my Linux system and found that if I include the I didn't generate a Swift SDK with
Please give this a try! |
This works fine. But there somethings strange when compiling on the mac using the SDK. When compiling C source code with SDK, it seems to use local header and not headers in SDK and does not conform to header search path. |
Try setting the pkg config search path. See here: #89 (comment) |
On my end in Linux, looks like setting these paths causes pkgconfig to work properly with the Swift SDK:
The only problem is that this seems like it's a lot of work to set these variables just for pkgconfig to point to the Swift SDK directory. I wonder if this should be moved into SwiftPM to automatically set these when a --swift-sdk is used...or has it been in some way? swiftlang/swift-package-manager#7472 |
|
This does not work when host is macOS. it still continues to use the macOS header : I use the function EVP_MD_get_type() which is declared in ubuntu-jammy.sdk/usr/include/openssl/evp.h but it tried to open /usr/local/include/openssl/evp.h on macOS, which does not contains declaration. It seems to ignore openssl.pc configuration. |
Running an SDK on a Mac.
I'm linking against libcrypto (openSSL) and it does not work.
I have installed libssl-dev in docker Image as below :
RUN apt update && apt -y install libssl-dev && apt -y clean
But I don't know how to tell him to add it in the generated SDK and I have the following error :
ld.lld: error: undefined symbol: RAND_bytes
(and many others for the all call to libcrypto).
I have openSSL installed on the Mac, and It seems to try to look in the Mac library :
ld.lld: warning: /opt/homebrew/Cellar/openssl@3/3.0.7/lib/libssl.a: archive member 'libssl-lib-bio_ssl.o' is neither ET_REL nor LLVM bitcode
How to fix this ?
The text was updated successfully, but these errors were encountered: