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).

Recommended Answers

All 6 Replies

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.

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).

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.

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.

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.