www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Compiling vibe.d application for Amazon ec2 instance

reply crimaniak <crimaniak gmail.com> writes:
Hi all!

I made vibe-d application, and client give me already taken 
hosting for it on Amazon aws ec2, uname -a:
Linux ip-xxx-xx-xx-xx 4.4.11-23.53.amzn1.x86_64 #1 SMP Wed Jun 1 
22:22:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Compiled on my Ubuntu binary don't run because of different 
versions of libraries (on Amazon they older).

I can try to install dmd to ec2 instance but don't think this is 
good idea. I want to compile binary on my developing machine (may 
be in specific OS in VirtualBox).
How to resolve this problem by right way?

Can I get VirtualBox image of ec2 version of Linux and use it on 
my machine?
Can I compile all libraries used as static and make more 
independent binary?
Something else?
Sep 11 2016
next sibling parent reply Jonathan M Davis via Digitalmars-d-learn writes:
On Sunday, September 11, 2016 23:12:15 crimaniak via Digitalmars-d-learn 
wrote:
 Hi all!

 I made vibe-d application, and client give me already taken
 hosting for it on Amazon aws ec2, uname -a:
 Linux ip-xxx-xx-xx-xx 4.4.11-23.53.amzn1.x86_64 #1 SMP Wed Jun 1
 22:22:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

 Compiled on my Ubuntu binary don't run because of different
 versions of libraries (on Amazon they older).

 I can try to install dmd to ec2 instance but don't think this is
 good idea. I want to compile binary on my developing machine (may
 be in specific OS in VirtualBox).
 How to resolve this problem by right way?

 Can I get VirtualBox image of ec2 version of Linux and use it on
 my machine?
 Can I compile all libraries used as static and make more
 independent binary?
 Something else?
I've never used EC2, so I don't know what it would take to be able to build in the same environment locally (though I would certainly think that there would be a way do to so, and I would assume that Amazon's documentation talks about it somewhere). However, you can try just grabbing the .zip file for dmd and putting that on your EC2 instance and using that to build your program there - especially if you're in a hurry. You can also try fully statically linking, but it's a bit of a pain, since last time I checked it doesn't work right if you let dmd do the linking command, which means that you have to use it to generate the object files and then manually link them using gcc. https://issues.dlang.org/show_bug.cgi?id=6952 - Jonathan M Davis
Sep 11 2016
parent reply Seb <seb wilzba.ch> writes:
On Monday, 12 September 2016 at 02:14:08 UTC, Jonathan M Davis 
wrote:
 On Sunday, September 11, 2016 23:12:15 crimaniak via 
 Digitalmars-d-learn wrote:
 [...]
I've never used EC2, so I don't know what it would take to be able to build in the same environment locally (though I would certainly think that there would be a way do to so, and I would assume that Amazon's documentation talks about it somewhere). However, you can try just grabbing the .zip file for dmd and putting that on your EC2 instance and using that to build your program there - especially if you're in a hurry. [...]
You should try -static in ldc, it's works like a dream for me :)
Sep 14 2016
parent David Nadlinger <code klickverbot.at> writes:
On Wednesday, 14 September 2016 at 12:13:58 UTC, Seb wrote:
 You should try -static in ldc, it's works like a dream for me :)
Yep, LDC supports fully static linking on Linux (and is currently the only compiler to do so). — David
Sep 14 2016
prev sibling parent wobbles <grogan.colin gmail.com> writes:
On Sunday, 11 September 2016 at 23:12:15 UTC, crimaniak wrote:
 Hi all!

 I made vibe-d application, and client give me already taken 
 hosting for it on Amazon aws ec2, uname -a:
 Linux ip-xxx-xx-xx-xx 4.4.11-23.53.amzn1.x86_64 #1 SMP Wed Jun 
 1 22:22:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

 Compiled on my Ubuntu binary don't run because of different 
 versions of libraries (on Amazon they older).

 I can try to install dmd to ec2 instance but don't think this 
 is good idea. I want to compile binary on my developing machine 
 (may be in specific OS in VirtualBox).
 How to resolve this problem by right way?

 Can I get VirtualBox image of ec2 version of Linux and use it 
 on my machine?
 Can I compile all libraries used as static and make more 
 independent binary?
 Something else?
I would find out the AMI of the image you're going to be running on, and spin up a machine from that. Install all dev tools there, and compile. Then you'll be good to go. You could even export the ec2 VM and run it locally in VirtualBox or something. I've never done it, but it's apparently possible.
Sep 12 2016