Question:
Can I compile GCC source for Linux from another platform?
Jim Maryland
2009-09-29 11:23:01 UTC
I have a Redhat Linux server that does not have a C/C++ compiler. I'm looking to build the gcc source (found a binary, but it is taking a really long time to download) and was wondering if it is possible to build on another platform for a Redhat Linux target platform.

I have Visual Studio 2005 on my Windows PC so I'd like to know if it is possible to build gcc, from source, to a Redhat Linux 64 bit OS. If so, can you provide a link or instructions?

Thanks in advance.
Three answers:
2009-09-29 11:30:09 UTC
No.



The compiler is itself built to run on a specific OS platform. There is a GCC that runs on Windows, but it's built to build Windows code. If you were doing this on a Unix system of some type, it might be possible to flag the compiler to build for a certain platform, but even then it can be an issue.



Here's a suggestion, if you like to hack. Find out the RH version on the server. Then find the CentOS or Fedora version that matches or is close. Install that on a client system, make sure you install the development tools, and build the code on that box. Then you can move it to the server and see if it works.
?
2009-09-29 11:28:23 UTC
I'm only an amateur, so I couldn't give you instructions on how to make gcc work with Visual Studio, but there's a free program called Dev C++ which I believe compiles exactly the same as the gcc compiler on Linux platforms.
tbshmkr
2009-09-29 11:57:56 UTC
What exactly are you trying to download??

=

You could write your source code and compile it with MinGW ("Minimalist GNU for Windows") (NOT Visual Studio 2005).

-

Code::Blocks == Open Source C/C++ IDE

http://www.codeblocks.org/downloads/binaries

codeblocks-8.02mingw-setup.exe

-

When you have the program working properly, load the source code into your Linux machine, tune for proper operation, & compile with Gnu GCC.

-

Not ideal, but a possibility.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...