www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How do you actually run the "Start a minimal webserver" example on the

reply AN <a a.com> writes:
I downloaded the script and made it executable. I also have dub 
on `/usr/bin/dub` . The example just stalls with no output. After 
fidgeting around for 5 minutes I realized it was downloading 
silently in the background. (I think for homepage examples, they 
should be running in verbose mode as this is probably the first 
touchpoint for a new D user)

Now, i have this error:

$ ./webserver.d
/usr/bin/x86_64-linux-gnu-ld: cannot find -lssl
/usr/bin/x86_64-linux-gnu-ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
Error: /usr/bin/gcc failed with status: 1
/usr/bin/ldc2 failed with exit code 1.

System: Ubuntu 18.04

Should dub take care of those for installation? Or, maybe the 
example is best run with a docker image of dmd/ldc compiler.
Aug 25 2018
parent reply Chris M. <chrismohrfeld comcast.net> writes:
On Saturday, 25 August 2018 at 20:17:35 UTC, AN wrote:
 I downloaded the script and made it executable. I also have dub 
 on `/usr/bin/dub` . The example just stalls with no output. 
 After fidgeting around for 5 minutes I realized it was 
 downloading silently in the background. (I think for homepage 
 examples, they should be running in verbose mode as this is 
 probably the first touchpoint for a new D user)

 Now, i have this error:

 $ ./webserver.d
 /usr/bin/x86_64-linux-gnu-ld: cannot find -lssl
 /usr/bin/x86_64-linux-gnu-ld: cannot find -lcrypto
 collect2: error: ld returned 1 exit status
 Error: /usr/bin/gcc failed with status: 1
 /usr/bin/ldc2 failed with exit code 1.

 System: Ubuntu 18.04

 Should dub take care of those for installation? Or, maybe the 
 example is best run with a docker image of dmd/ldc compiler.
You need the libssl-dev package installed first, it contains the libraries that ld is complaining it can't find. As far as I know that's not within dub's scope to worry about. sudo apt-get install libssl-dev
Aug 25 2018
parent reply Everlast <Everlast For.Ever> writes:
On Saturday, 25 August 2018 at 20:28:55 UTC, Chris M. wrote:
 On Saturday, 25 August 2018 at 20:17:35 UTC, AN wrote:
 I downloaded the script and made it executable. I also have 
 dub on `/usr/bin/dub` . The example just stalls with no 
 output. After fidgeting around for 5 minutes I realized it was 
 downloading silently in the background. (I think for homepage 
 examples, they should be running in verbose mode as this is 
 probably the first touchpoint for a new D user)

 Now, i have this error:

 $ ./webserver.d
 /usr/bin/x86_64-linux-gnu-ld: cannot find -lssl
 /usr/bin/x86_64-linux-gnu-ld: cannot find -lcrypto
 collect2: error: ld returned 1 exit status
 Error: /usr/bin/gcc failed with status: 1
 /usr/bin/ldc2 failed with exit code 1.

 System: Ubuntu 18.04

 Should dub take care of those for installation? Or, maybe the 
 example is best run with a docker image of dmd/ldc compiler.
You need the libssl-dev package installed first, it contains the libraries that ld is complaining it can't find. As far as I know that's not within dub's scope to worry about. sudo apt-get install libssl-dev
Then don't you think these thing should be mentioned with the examples? It looks very bad(and is, since it wastes peoples time) to give an example that has dependencies and they are not mentioned, nor is the method to make it all work).
Aug 25 2018
parent Radu <rad.racariu gmail.com> writes:
On Saturday, 25 August 2018 at 20:37:04 UTC, Everlast wrote:
 On Saturday, 25 August 2018 at 20:28:55 UTC, Chris M. wrote:
 On Saturday, 25 August 2018 at 20:17:35 UTC, AN wrote:
 I downloaded the script and made it executable. I also have 
 dub on `/usr/bin/dub` . The example just stalls with no 
 output. After fidgeting around for 5 minutes I realized it 
 was downloading silently in the background. (I think for 
 homepage examples, they should be running in verbose mode as 
 this is probably the first touchpoint for a new D user)

 Now, i have this error:

 $ ./webserver.d
 /usr/bin/x86_64-linux-gnu-ld: cannot find -lssl
 /usr/bin/x86_64-linux-gnu-ld: cannot find -lcrypto
 collect2: error: ld returned 1 exit status
 Error: /usr/bin/gcc failed with status: 1
 /usr/bin/ldc2 failed with exit code 1.

 System: Ubuntu 18.04

 Should dub take care of those for installation? Or, maybe the 
 example is best run with a docker image of dmd/ldc compiler.
You need the libssl-dev package installed first, it contains the libraries that ld is complaining it can't find. As far as I know that's not within dub's scope to worry about. sudo apt-get install libssl-dev
Then don't you think these thing should be mentioned with the examples? It looks very bad(and is, since it wastes peoples time) to give an example that has dependencies and they are not mentioned, nor is the method to make it all work).
You can add that mention. Post the PR link here. Those linker errors are easy to Google. OpenSSL is a basic building block for major OSes, not like it requires some obscure stupid dependency. Dlang is not Basic nor PHP, don't wanna sound like a precious little prick, but some things just need to be said!
Aug 25 2018