Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
April 26, 2013 std.net.curl is not working? | ||||
---|---|---|---|---|
| ||||
Why i get the following Error, when i try to compile a simple "Hello World" that imports std.net.curl= The Error: # dmd hello.d /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_sharedStaticCtor28FZv': std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticCtor28FZv+0xf): undefined reference to `curl_global_init' /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function `_D3std3net4curl4Curl19_sharedStaticDtor29FZv': std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticDtor29FZv+0x5): undefined reference to `curl_global_cleanup' collect2: ld returned 1 exit status --- errorlevel 1 The Code: import std.stdio; import std.net.curl; void main() { writeln("hello world"); } My Testsystem: Debian # uname -a Linux dexplorer 2.6.32-5-amd64 #1 SMP Mon Feb 25 00:26:11 UTC 2013 x86_64 GNU/Linux curl is installed by apt-get install curl. Thanks! |
April 26, 2013 Re: std.net.curl is not working? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mab | Fri, 26 Apr 2013 19:25:16 +0200: mab wrote
> Why i get the following Error, when i try to compile a simple "Hello World" that imports std.net.curl=
>
> The Error:
> # dmd hello.d /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In
> function `_D3std3net4curl4Curl19_sharedStaticCtor28FZv':
> std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticCtor28FZv+0xf):
> undefined reference to `curl_global_init'
> /usr/lib/x86_64-linux-gnu/libphobos2.a(curl.o): In function
> `_D3std3net4curl4Curl19_sharedStaticDtor29FZv':
> std/net/curl.d:(.text._D3std3net4curl4Curl19_sharedStaticDtor29FZv+0x5):
> undefined reference to `curl_global_cleanup'
> collect2: ld returned 1 exit status --- errorlevel 1
>
> The Code:
> import std.stdio;
> import std.net.curl;
>
> void main()
> {
> writeln("hello world");
> }
>
> My Testsystem: Debian # uname -a Linux dexplorer 2.6.32-5-amd64 #1 SMP Mon Feb 25 00:26:11 UTC 2013 x86_64 GNU/Linux
>
> curl is installed by apt-get install curl.
>
> Thanks!
You have to link libcurl via argument:
dmd hello.d -L-lcurl
|
April 26, 2013 Re: std.net.curl is not working? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mab | On Fri, 26 Apr 2013 19:25:16 +0200, mab wrote:
> undefined reference to `curl_global_init'
> undefined reference to `curl_global_cleanup'
These functions are defined in libcurl. Make sure you have installed libcurl if it wasn't installed as a dependency for curl.
|
April 26, 2013 Re: std.net.curl is not working? | ||||
---|---|---|---|---|
| ||||
Posted in reply to qznc | Thank you for answering. But it didnt work. I get: #dmd hello.d -L-lcurl /usr/bin/ld: cannot find -lcurl collect2: ld returned 1 exit status --- errorlevel 1 Curl is installed, as also libcurl3. I forget to mention that i am using "DMD64 D Compiler v2.062". Is std.net.curl working in this Version? Because it also didnt work on my Windows 7 System. |
April 26, 2013 Re: std.net.curl is not working? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mab | On 04/26/2013 10:55 AM, mab wrote: > Thank you for answering. But it didnt work. > > I get: > #dmd hello.d -L-lcurl > /usr/bin/ld: cannot find -lcurl Try providing the directory that the curl library file is in: #dmd hello.d -L-L/wherever/libcurl/is/in -L-lcurl Ali |
April 26, 2013 Re: std.net.curl is not working? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mab | On 26/04/13 19:55, mab wrote: > Thank you for answering. But it didnt work. > > I get: > #dmd hello.d -L-lcurl > /usr/bin/ld: cannot find -lcurl > collect2: ld returned 1 exit status > --- errorlevel 1 > > Curl is installed, as also libcurl3. You need to install the development curl package: $ sudo apt-get install libcurl4-openssl-dev or $ sudo apt-get install libcurl4-gnutls-dev or $ sudo apt-get install libcurl4-nss-dev > > I forget to mention that i am using "DMD64 D Compiler v2.062". > Is std.net.curl working in this Version? Because it also didnt work on my Windows 7 System. > -- Jordi Sayol |
April 26, 2013 Re: std.net.curl is not working? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mab | On Friday, 26 April 2013 at 17:55:59 UTC, mab wrote:
> Thank you for answering. But it didnt work.
>
> I get:
> #dmd hello.d -L-lcurl
> /usr/bin/ld: cannot find -lcurl
> collect2: ld returned 1 exit status
> --- errorlevel 1
>
> Curl is installed, as also libcurl3.
>
> I forget to mention that i am using "DMD64 D Compiler v2.062".
> Is std.net.curl working in this Version? Because it also didnt work on my Windows 7 System.
Do you know what the libcurl library is actually called on your system? (try "find /usr -name "*curl*.so*" " or "find /usr -name "*curl*.a*" )
if the name you find is e.g. "libcurl3.so" then you'll have to use the linker flag -lcurl3 instead of lcurl
p.s. Please don't be offended if you're already fully aware of this, it's just better to make sure the basics are covered first.
|
April 26, 2013 Re: std.net.curl is not working? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jordi Sayol | On Friday, 26 April 2013 at 18:14:04 UTC, Jordi Sayol wrote:
[...]
> You need to install the development curl package:
>
> $ sudo apt-get install libcurl4-openssl-dev
> or
> $ sudo apt-get install libcurl4-gnutls-dev
> or
> $ sudo apt-get install libcurl4-nss-dev
>
[...]
That´s it.
Thank you!
|
Copyright © 1999-2021 by the D Language Foundation