Find the answer to your Linux question:
Results 1 to 10 of 10
Hi, I'm using a webhosting server running CentOS, and I'm trying to install GCC to compile Java on the server. Since I'm new to Linux and don't have root privileges, ...
  1. #1
    Just Joined!
    Join Date
    Feb 2011
    Posts
    5

    Question Need help installing GCC

    Hi, I'm using a webhosting server running CentOS, and I'm trying to install GCC to compile Java on the server. Since I'm new to Linux and don't have root privileges, I'm having trouble installing this. I need to install this using command-line. I don't know if I should compile from source (which I downloaded off the "gcc.gnu.org" website) or if I need to install a binary or something. Can I even install anything without root privileges? I'm at a loss for what to do, so any help would be appreciated. Thanks for your help!

  2. #2
    Linux User glennzo's Avatar
    Join Date
    Sep 2004
    Location
    Salem, Mass
    Posts
    434
    You'll need root or "sudo" privileges at some point. You should be able to install gcc using yum.
    Glenn
    Powered by Fedora 16 and Arch Linux

  3. #3
    Just Joined!
    Join Date
    Feb 2011
    Posts
    5
    Okay, I wasn't sure because I had downloaded the Java JDK and was able to run the javac program. The problem i had was that the server didn't have enough memory to run Java (which is why I'm trying to use GCC). I was still able to start it though without root privileges. I was hoping the same sort of thing could be done with GCC. Is there any way to run GCC without installing it (like an executable file on Windows)?

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    You can install the compiler and its libraries in your own home directory tree without root permissions, I think - haven't tried this before. You will likely need to specify the --prefix=~/your-install-directory to configure so when you execute "make install" it will copy stuff to ~/your-install-directory. The executables will go into ~/your-install-directory/bin and libraries into ~/your-install-directory/lib (or lib64), etc. Then you will need to adjust your PATH and LD_LIBRARY_PATH environment variables so the compiler and shared libraries will be found first in ~/your-install-directory/...

    So, clear as mud yet?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Just Joined!
    Join Date
    Feb 2011
    Posts
    5
    Sorry for taking so long to reply. I've been trying to get this working, but I don't think I'll be able to with my limited knowledge of linux. Anyways, I appreciate your help.

  6. #6
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    you don't compile java with gcc, that is a C compiler

    you need to use java jdk to run and compile java applications

    you may be able to use gcj, though i'm not sure how well it works

  7. #7
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by coopstah13 View Post
    you don't compile java with gcc, that is a C compiler

    you need to use java jdk to run and compile java applications

    you may be able to use gcj, though i'm not sure how well it works
    The Eclipse IDE works well for this.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  8. #8
    Just Joined!
    Join Date
    Feb 2011
    Posts
    5
    I thought gcc stands for "GNU Compiler Collection". Doesn't it include gcj? It's not only for c and c++. That's what it sounds like from this website:gcc.gnu.org.

    From the gcc site: "GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile Java source code to Java bytecode (class files) or directly to native machine code, and Java bytecode to native machine code."

    From what I read elsewhere on the internet, it sounds like many people use it.

  9. #9
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Quote Originally Posted by smengler View Post
    I thought gcc stands for "GNU Compiler Collection". Doesn't it include gcj? It's not only for c and c++. That's what it sounds like from this website:gcc.gnu.org.

    From the gcc site: "GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile Java source code to Java bytecode (class files) or directly to native machine code, and Java bytecode to native machine code."

    From what I read elsewhere on the internet, it sounds like many people use it.
    For true java portability, you should use the java compiler from sun/oracle. The gnu gcj is great for taking java applications and turning them into machine code, either from source or compiled bytecode. However, there are incompatibilities that can cause differences in application behavior, so additional testing would be required. In any case, I would opt for the "standard" java compiler if I am going to compile to java byte code, and gcj if I want to compile java byte code to more efficient machine code.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  10. #10
    Just Joined!
    Join Date
    Feb 2011
    Posts
    5
    Alright, I didn't know that sun's java compiler would be much different. So it looks like sun's compiler is better for what I want to do. Everything's good now (except that my hosting provider wants me to pay extra for java support). Thanks for your help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...