Discussion:
build a Linux console using Windows?
(too old to reply)
Joe Butler
2009-09-23 13:30:03 UTC
Permalink
Hi,

Am a Windows user and programmer (only use Linux for web servers, so, not
into compiling stuff from source, etc.). I would find it very useful if I
could compile some c/c++ console app code so that the compiler running on my
Windows dev machine emits a linux console app.

So, I have some c and cpp source that I currently compile with MS Dev Studio
6 to produce a Windows exe console to run on Windows. I'd like to be able
to compile the same code from Windows and produce a Linux console app. It
shouldn't be a big deal, since I can cross compile using GCC to all sorts of
embedded devices and I can see in the Linux KDevelop, I can emit Windows
apps!. Just need to know what the basic setup is to emit Linux console apps
from a Windows compiler.

Currently, I have Code::Block installed on Windows and this looks like the
most useful first step since I can specify a compiler in the Project Build
Options. But which compiler? Would prefer pre-built source (i.e. binary
distribution of compiler).

Any suggestions, thanks,

(also posted in gnu.gcc.help before I realised someone here might have an
answer)
Ben Voigt [C++ MVP]
2009-09-23 17:26:54 UTC
Permalink
Post by Joe Butler
Hi,
Am a Windows user and programmer (only use Linux for web servers, so,
not into compiling stuff from source, etc.). I would find it very
useful if I could compile some c/c++ console app code so that the
compiler running on my Windows dev machine emits a linux console app.
So, I have some c and cpp source that I currently compile with MS Dev
Studio 6 to produce a Windows exe console to run on Windows. I'd
like to be able to compile the same code from Windows and produce a
Linux console app. It shouldn't be a big deal, since I can cross
compile using GCC to all sorts of embedded devices and I can see in
the Linux KDevelop, I can emit Windows apps!. Just need to know what
the basic setup is to emit Linux console apps from a Windows compiler.
Just like you said, use gcc to cross-compile.
Post by Joe Butler
Currently, I have Code::Block installed on Windows and this looks
like the most useful first step since I can specify a compiler in the
Project Build Options. But which compiler? Would prefer pre-built
source (i.e. binary distribution of compiler).
Any suggestions, thanks,
(also posted in gnu.gcc.help before I realised someone here might
have an answer)
This group is for discussing Microsoft compilers, and while Microsoft has
cross-compilers from Win32 and Win64 to WinCE(x86), WinCE(ARM), WinCE(MIPS)
and to WinIA64(Itanium), Microsoft doesn't distribute any Linux compilers
whatsoever (AFAIK).

But I believe gnu compilers hosted on Windows are available for a variety of
linux targets. Example: http://www.yagarto.de/
Although I suspect you're looking for linux/glibc/x86 target, you didn't
actually say that.
Ben Voigt [C++ MVP]
2009-09-24 14:21:18 UTC
Permalink
Post by Joe Butler
Hi,
Am a Windows user and programmer (only use Linux for web servers, so,
not into compiling stuff from source, etc.). I would find it very
useful if I could compile some c/c++ console app code so that the
compiler running on my Windows dev machine emits a linux console app.
In addition to the other suggestions, why do you want a linux binary to
begin with? For deployment on your own web server, or for distribution to
others? Are all potential users running the same Linux distribution (and
version)? Linux does not have binary portability like Windows does,
properly written source code is extremely portable but a recompile for each
target platform is required. Sometimes you can work around using a foreign
binary by setting LD_LIBRARY_PATH in shell script, but that's typically more
headache than a recompile.

Pavel A.
2009-09-23 18:34:21 UTC
Permalink
Run a real, live Linux on your Windows PC using Vmware or something like
that.

--pa
Post by Joe Butler
Hi,
Am a Windows user and programmer (only use Linux for web servers, so, not
into compiling stuff from source, etc.). I would find it very useful if I
could compile some c/c++ console app code so that the compiler running on my
Windows dev machine emits a linux console app.
So, I have some c and cpp source that I currently compile with MS Dev Studio
6 to produce a Windows exe console to run on Windows. I'd like to be able
to compile the same code from Windows and produce a Linux console app. It
shouldn't be a big deal, since I can cross compile using GCC to all sorts of
embedded devices and I can see in the Linux KDevelop, I can emit Windows
apps!. Just need to know what the basic setup is to emit Linux console apps
from a Windows compiler.
Currently, I have Code::Block installed on Windows and this looks like the
most useful first step since I can specify a compiler in the Project Build
Options. But which compiler? Would prefer pre-built source (i.e. binary
distribution of compiler).
Any suggestions, thanks,
(also posted in gnu.gcc.help before I realised someone here might have an
answer)
Continue reading on narkive:
Loading...