www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DUB and lib curl (-lcurl)

reply Tony <tonytdominguez aol.com> writes:
I am on Ubuntu 16.04. I was looking at Getting Started with DUB:
http://code.dlang.org/getting_started

I did the "dub init myproject" and it worked fine. Then I added 
dependency:

' dependency "dub" version="~>1.3.0" '

as shown in the next step. This got an error:
-------------------------------------------------------------
dub build
Fetching dub 1.3.0 (getting selected version)...
Performing "debug" build using dmd for x86_64.
dub 1.3.0: building configuration "library"...
../../../.dub/packages/dub-1.3.0/dub/source/dub/internal/sdlang/token.d(26,2):
Deprecation: struct core.time.FracSec is deprecated - FracSec has been
deprecated in favor of just using Duration for the sake of simplicity
../../../.dub/packages/dub-1.3.0/dub/source/dub/internal/sdlang/token.d(26,2):
Deprecation: struct core.time.FracSec is deprecated - FracSec has been
deprecated in favor of just using Duration for the sake of simplicity
myproject ~master: building configuration "application"...
Linking...
/usr/bin/ld: cannot find -lcurl
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
dmd failed with exit code 1.
-----------------------------------------------------------------

I am wondering if the tutorial should caution that "you need to 
have lib curl already on your system", or if I have a bad DUB 
install (lib curl should have been installed with DUB).
Jan 08 2018
parent rikki cattermole <rikki cattermole.co.nz> writes:
On 09/01/2018 5:42 AM, Tony wrote:
 I am on Ubuntu 16.04. I was looking at Getting Started with DUB:
 http://code.dlang.org/getting_started
 
 I did the "dub init myproject" and it worked fine. Then I added dependency:
 
 ' dependency "dub" version="~>1.3.0" '
 
 as shown in the next step. This got an error:
 -------------------------------------------------------------
 dub build
 Fetching dub 1.3.0 (getting selected version)...
 Performing "debug" build using dmd for x86_64.
 dub 1.3.0: building configuration "library"...
 ../../../.dub/packages/dub-1.3.0/dub/source/dub/internal/sdlang/token.d(26,2): 
 Deprecation: struct core.time.FracSec is deprecated - FracSec has been 
 deprecated in favor of just using Duration for the sake of simplicity
 ../../../.dub/packages/dub-1.3.0/dub/source/dub/internal/sdlang/token.d(26,2): 
 Deprecation: struct core.time.FracSec is deprecated - FracSec has been 
 deprecated in favor of just using Duration for the sake of simplicity
 myproject ~master: building configuration "application"...
 Linking...
 /usr/bin/ld: cannot find -lcurl
 collect2: error: ld returned 1 exit status
 Error: linker exited with status 1
 dmd failed with exit code 1.
 -----------------------------------------------------------------
 
 I am wondering if the tutorial should caution that "you need to have lib 
 curl already on your system", or if I have a bad DUB install (lib curl 
 should have been installed with DUB).
Few things, the example of using dub as a dependency is just an example. You don't need to add it. The reason you're getting that error isn't a major problem. Basically the import libraries are not installed, curl is (I would expect), just not the files that allow linking it in. They are usually in packages *-dev.
Jan 08 2018