www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - curl & linux

reply Alexandr Druzhinin <drug2004 bk.ru> writes:
I use curl in my application. If I link it with -lcurl - symbols are 
undefined (libcurl3 installed), if I link with -lphobos2 - it links. So 
curl is linked with libphobos2.so? But what to do if I need static 
linking? (ubuntu 12.04 x86_64, dmd 2.063.2)
Sep 28 2013
parent reply Jordi Sayol <g.sayol yahoo.es> writes:
On 28/09/13 10:28, Alexandr Druzhinin wrote:
 I use curl in my application. If I link it with -lcurl - symbols are undefined
(libcurl3 installed), if I link with -lphobos2 - it links. So curl is linked
with libphobos2.so? But what to do if I need static linking? (ubuntu 12.04
x86_64, dmd 2.063.2)
 
To link against libcurl (-lcurl) you need to install libcurl development files. On Ubuntu, install one of these three packages: "libcurl4-openssl-dev", "libcurl4-gnutls-dev" or "libcurl4-nss-dev". For libcurl static linking you should link against all libraries that libcurl depends on. -- Jordi Sayol
Sep 28 2013
parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
28.09.2013 17:06, Jordi Sayol пишет:
 On 28/09/13 10:28, Alexandr Druzhinin wrote:
 I use curl in my application. If I link it with -lcurl - symbols are undefined
(libcurl3 installed), if I link with -lphobos2 - it links. So curl is linked
with libphobos2.so? But what to do if I need static linking? (ubuntu 12.04
x86_64, dmd 2.063.2)
To link against libcurl (-lcurl) you need to install libcurl development files. On Ubuntu, install one of these three packages: "libcurl4-openssl-dev", "libcurl4-gnutls-dev" or "libcurl4-nss-dev". For libcurl static linking you should link against all libraries that libcurl depends on.
Thank you for info. I have installed "libcurl4-gnutls-dev" - the same happens, symbols are undefined. But with -lphobos2 it links... Why linker don't find these symbols if libs are installed? Should I pass to linker some additional info in this case?
Sep 28 2013
parent reply Jordi Sayol <g.sayol yahoo.es> writes:
On 28/09/13 14:41, Alexandr Druzhinin wrote:
 28.09.2013 17:06, Jordi Sayol =D0=BF=D0=B8=D1=88=D0=B5=D1=82:
 On 28/09/13 10:28, Alexandr Druzhinin wrote:
 I use curl in my application. If I link it with -lcurl - symbols are =
undefined (libcurl3 installed), if I link with -lphobos2 - it links. So c= url is linked with libphobos2.so? But what to do if I need static linking= ? (ubuntu 12.04 x86_64, dmd 2.063.2)

 To link against libcurl (-lcurl) you need to install libcurl developme=
nt files. On Ubuntu, install one of these three packages: "libcurl4-opens= sl-dev", "libcurl4-gnutls-dev" or "libcurl4-nss-dev".
 For libcurl static linking you should link against all libraries that =
libcurl depends on.

 Thank you for info. I have installed "libcurl4-gnutls-dev" - the same h=
appens, symbols are undefined. But with -lphobos2 it links... Why linker = don't find these symbols if libs are installed? Should I pass to linker s= ome additional info in this case?
=20
Can I see your full command line please? $ dmd -lcurl .... --=20 Jordi Sayol
Sep 28 2013
parent Alexandr Druzhinin <drug2004 bk.ru> writes:
28.09.2013 20:14, Jordi Sayol пишет:
 Can I see your full command line please?
 $ dmd -lcurl ....
I use dub, but I did rdmd version: rdmd --build-only -I/home/drug/.dub/packages/derelict-master/import -I/home/drug/.dub/packages/glamour-master -version=Derelict3 -version=gl3n -I/home/drug/.dub/packages/gl3n-master/ -I/home/drug/3rdparties/cairoD/src -I/home/drug/.dub/packages/arsd-master -version=CAIRO_HAS_PNG_FUNCTIONS -L-lphobos2 -L-L/home/drug/3rdparties/cairoD -L-lcairoD -L-lcairo -L-ldl -ofbin/geoviewer src/app.d If I change -L-lphobos2 на -L-lcurl I get: /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_sharedStaticCtor34FZv': std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticCtor34FZv+0xf): undefined reference to `curl_global_init' /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_sharedStaticDtor35FZv': std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticDtor35FZv+0x5): undefined reference to `curl_global_cleanup' /usr/lib/x86_64-linux-gnu/libphobos2.a(curl_144c_140.o): In function `_D3std3net4curl4HTTP4Impl6__dtorMFZv': std/net/curl.d:(.text._D3std3net4curl4HTTP4Impl6__dtorMFZv+0x19): undefined reference to `curl_slist_free_all' ... and so on. That is in this case I have static linking but curl symbols are not definded somehow.
Sep 28 2013