Hello guys,
I am implementing an app where currently I am using sockets to get data from urls. It works fine but I thought that using libCurl might be a better, faster solution. So I downloaded the libCurl from os4depot and installed it using the autoinstall script.
For a test tried to compile the a simple code found at
https://raw.githubusercontent.com/curl/curl/master/docs/examples/simple.c
I use the following to compile it
gcc -D__USE_INLINE__ -Wall simple.c -o simple -lcurl -lauto
but I am getting a lot of undefined references like below.
openssl.c:(.text+0x4804): undefined reference to `EVP_PKEY_get0_DSA' openssl.c:(.text+0x4818): undefined reference to `DSA_get0_pqg' openssl.c:(.text+0x482c): undefined reference to `DSA_get0_key' openssl.c:(.text+0x48bc): undefined reference to `EVP_PKEY_get0_DH' openssl.c:(.text+0x48d0): undefined reference to `DH_get0_pqg' openssl.c:(.text+0x48e4): undefined reference to `DH_get0_key' openssl.c:(.text+0x4944): undefined reference to `OCSP_BASICRESP_free' openssl.c:(.text+0x4950): undefined reference to `OCSP_RESPONSE_free' openssl.c:(.text+0x498c): undefined reference to `OCSP_crl_reason_str' openssl.c:(.text+0x4a1c): undefined reference to `OCSP_RESPONSE_free' openssl.c:(.text+0x4a90): undefined reference to `X509_NAME_get_entry' openssl.c:(.text+0x4a94): undefined reference to `X509_NAME_ENTRY_get_data' openssl.c:(.text+0x4aa0): undefined reference to `ASN1_STRING_type' openssl.c:(.text+0x4ab4): undefined reference to `ASN1_STRING_to_UTF8' openssl.c:(.text+0x4b04): undefined reference to `X509_verify_cert_error_string' openssl.c:(.text+0x4b2c): undefined reference to `OCSP_response_status_str' openssl.c:(.text+0x4b84): undefined reference to `BIO_free' openssl.c:(.text+0x4b94): undefined reference to `X509_free' openssl.c:(.text+0x4c2c): undefined reference to `BIO_free' openssl.c:(.text+0x4c34): undefined reference to `X509_free' openssl.c:(.text+0x4d18): undefined reference to `BIO_free' openssl.c:(.text+0x4d20): undefined reference to `X509_free' openssl.c:(.text+0x4d5c): undefined reference to `GENERAL_NAMES_free'
I guess I am missing something that has to do with AmiSSL, which is also installed in my SDK.
Can you guys point me to the right direction?
Thank you for your help.
Tried to compile it by adding at the end
-mcrt=clib2
and now I get the following errors only
Any idea?
Update:
Added in the code the following, which solde the fd_set problem
#include <sys/select.h>
But then I got the following error
gcc/ppc-amigaos/bin/ld: cannot find -lauto
I checked the clib2/lib folder and there is no libauto.a file in there. So the error make sense.
What confuses me is that if I remove it, I get again all the undefined references I was getting earlier.
It is because libcurl depends on other libs.
Looking at the libcurl.la file in the archive on os4depot the following should work to link with libcurl "-lcurl -lrtmp -lssl -lcrypto -lz". The ssl and crypto libraries are from libopenssl and rtmp from librtmp.
@salass00
Thank you so much for your comment.
At the end I needed to download libz and compile with the following
gcc -D__USE_INLINE__ -Wall simple.c -o simple -lcurl -lrtmp -lssl -lcrypto -lz -lpthread
Thanks again. Now I can evaluate if it is best to access the various urls I need using socket or use the libcurl, to make my life easier. What would you follow guys?
libcurl if you do not much worry about size (and use my one from Odyssey SDK, as it latest one and contains some good fixes in terms of threading resolver). And if you need some tiny/small/cool app, then pure socket programming (which is _much_ harder compare with culr usage)
Thanks Roman for your recommendation.
It would be great if you could release that newer libcurl in a package on OS4Depot, so that everyone can find and use it.