954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

compile for linux server

I have developed a C++ CGI which runs fine on Apache on Win32.

I would like to deploy the program onto linux.

My plan is to install Wubi (i.e. Ubuntu) and compile the CGI there so that it will work on the linux server.

But before I do, I need to know if it is a wise approach to use Ubuntu to compile for a Linux server. I know Ubuntu is based on Linux, but is that sufficient to justify this approach to the problem?

Do you have any other suggestions if not?

Many thanks (I would rather avoid the world of cross compiling).

willgr
Newbie Poster
10 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 
But before I do, I need to know if it is a wise approach to use Ubuntu to compile for a Linux server. I know Ubuntu is based on Linux, but is that sufficient to justify this approach to the problem?

You don't compile with Ubuntu, you compile with a compiler such as "G++". So which distribution you choose to run G++ on, isn't important.

Nick Evan
Not a Llama
Moderator
10,112 posts since Oct 2006
Reputation Points: 4,142
Solved Threads: 403
 

And as far as lay-people are concerned, Ubuntu IS Linux. You can't just install Linux, you have to install one of its varieties (Ubuntu, Fedora, etc).

daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204
 

Thank you for your answers. I develop on Win32 and am considering installing Ubuntu to solve the need to build the program for Linux.

My concern is that external linux machines (of unspecified distributions) will not be able to run C++ programs compiled on Ubuntu.

willgr
Newbie Poster
10 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

You are correct - typically you give them the source code and they compile it themselves. If you link against any libraries, they would have to have identical versions of the libraries to run the binaries directly. You would also have the issue of 32 vs 64bit.

daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204
 

In linux, the distributions (Ubuntu, Kubuntu, Fedora, Gnome, ..) and their families (Debian, ..) really mostly differ in where you find things in the computer (e.g. the different services and stuff your software links with). So that's why there are different "packages" for different distributions (usually by family). But really, these packages generally are just different install programs that just contain different compiled and/or linked versions of the same source code. I'm no expert though, but as far as I have seen, all open-source programs in Linux have several distro-specific packages to install the software, but only one download for the source code (compilable on any distribution of Linux). So in that case, implementing for any distro (like Ubuntu) is fine, you might have to recompile for different distros if you want to distribute the application, but even that, I'm not sure you even really need a recompilation, maybe simply a different "install" procedure, i.e. package, will do the trick.

But again, don't take my word for it. I only have experience using programs in Linux, compiling some open-source programs (rolling software versions) and programming non-commercially-distributed applications. So the above is just the impression I have on distribution of Linux software.

mike_2000_17
Posting Virtuoso
Moderator
2,134 posts since Jul 2010
Reputation Points: 1,634
Solved Threads: 457
 

This is all very useful actually as I have only ever developed for and on Windows, though I am not using anything Windows specific in my code, mostly STL.

willgr
Newbie Poster
10 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: