LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   installing from source HOWTO? (https://www.linuxquestions.org/questions/linux-software-2/installing-from-source-howto-184364/)

Lleb_KCir 05-22-2004 12:17 AM

installing from source HOWTO?
 
im trying to put tuxtype on my RH9 system for my daughter. she is wanting to learn how to type and this looks like it might just do the trick if i can ever figure out how to get it done.

i was able to figure out how to get past the tar.gz and get it to a tar, then was able to get tar -xf filename.tar to work and creat the dir:

/home/ray/tuxtype2-1.5.2

i was then able to start part of the ./configure --prefix=/home/ray/tuxtype2-1.5.2/tuxtype

but i got a C++ complier error at the end:

Code:

[ray@localhost tuxtype2-1.5.2]$ ./configure --prefix=/home/ray/tuxtype2-1.5.2/tuxtype
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets ${MAKE}... yes
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking for C++ compiler default output... configure: error: C++ compiler cannot create executables

what is my next step to troubleshoot this so i can learn more.

thank you for your help.

e1000 05-22-2004 01:15 AM

during the install theres a development tool section, you needed to install most of those, If memory serves me, theres a way to re-enter the install menu (similar to when you first installed RH9), from there you will need to install basic development tools,

specifacly you need just about every compiler thats available in the RH9 install. all of them of course being branches of GCC. (it seems that the program you want is writen in c++, so youll want to install g++, although I dont remember if thats bundled in with gcc in red hat)

once you have verified that it works, you might consider doing it with prefix=/usr/local so that its binary can be accesed via the comand line, also, you might look into checkinstall, which replaces 'make install' and installs apps as a package so you can remove it.

post here if you got any more problems

Lleb_KCir 05-22-2004 07:52 AM

thanks for the reply. ill look at that later this afternoon when i get home.

Lleb_KCir 05-22-2004 08:29 AM

hoping i am downloading the right thing now.

ftp://ftp.mirror.ac.uk/sites/sources...c-3.4.0.tar.gz

pulling down the 2nd one on that list. ill see about installing that via ssh (boy im so newbiesh i hope i dont screw it up) and see if that will not give me what all i need.

correct me if im wrong:

first i need to deal with the .gz by gzip -u (ill look up the arguement, but i need the uncompress arguement)

then i need to tar -xf

then i need to do something with the make command, and at that point i get lost.

grcunningham 05-22-2004 09:07 AM

if you are using the RedHat9 CD's, you dont have to
download anything, just go to your menu and find
add/remove programs. in the development section,
add the gnome development tools

but if you do download, and its a tar.gz, you dont have
to gzip first....this is built into tar. just use the -z switch...i use
tar -xzvf
this does it in one step

Lleb_KCir 05-22-2004 09:31 AM

ahh kewl. reason i did the download is to get the most current build of gcc, and the fact that im remote atm so i can not put the CD in the system, but i can ssh and install from there.

thank you much for the -z see so neet to learn, but this is what years of windows does to you.

it makes one stupid. to install in M$, just put the CD in, or download the program and double click it, follow the wizard. all finished. that makes one rather dumb IMHO on how things work.

that sadly is were i am. i love all the power of *nix, its unbeatable.

Lleb_KCir 05-22-2004 09:36 AM

Quote:

Installing GCC: Configuration
Like most GNU software, GCC must be configured before it can be built. This document describes the recommended configuration procedure for both native and cross targets.

We use srcdir to refer to the toplevel source directory for GCC; we use objdir to refer to the toplevel build/object directory.

If you obtained the sources via CVS, srcdir must refer to the top gcc directory, the one where the MAINTAINERS can be found, and not its gcc subdirectory, otherwise the build will fail.

If either srcdir or objdir is located on an automounted NFS file system, the shell's built-in pwd command will return temporary pathnames. Using these can lead to various sorts of build problems. To avoid this issue, set the PWDCMD environment variable to an automounter-aware pwd command, e.g., pawd or amq -w, during the configuration and build phases.

First, we highly recommend that GCC be built into a separate directory than the sources which does not reside within the source tree. This is how we generally build GCC; building where srcdir == objdir should still work, but doesn't get extensive testing; building where objdir is a subdirectory of srcdir is unsupported.

If you have previously built GCC in the same directory for a different target machine, do make distclean to delete all files that might be invalid. One of the files this deletes is Makefile; if make distclean complains that Makefile does not exist or issues a message like "don't know how to make distclean" it probably means that the directory is already suitably clean. However, with the recommended method of building in a separate objdir, you should simply use a different objdir for each target.

Second, when configuring a native system, either cc or gcc must be in your path or you must set CC in your environment before running configure. Otherwise the configuration scripts may fail.

Note that the bootstrap compiler and the resulting GCC must be link compatible, else the bootstrap will fail with linker errors about incompatible object file formats. Several multilibed targets are affected by this requirement, see host/target specific installation notes.

To configure GCC:

% mkdir objdir
% cd objdir
% srcdir/configure [options] [target]



ok please explain to me how i know what directory to creat. do i just call it gcc, do i put it under / or /var/ or /usr what?

wow, so much of that is just foreign to me. any and all help is greatly appricitated.

Andrew Benton 05-22-2004 04:51 PM

What it's telling you there is that the gcc maintainers recommend that you compile gcc in a seperate folder to the one the source code is in. With most things you cd into the folder then do ./configure, make, make install, but with gcc (and a few other things) you need to make a seperate folder to build in, cd into that and then run the configure script in the gcc source folder from there. I mostly compile on my gnome desktop, but you can do it where you like. untar the gcc source code then create an empty folder somewhere to build in. It doesn't matter what it's called or where it is as you will be deleting it after you've done make install. I'm lazy so I would right click on my gnome desktop and choose Create Folder to make an empty folder, then I would delete the word untitled so it is just called folder then
cd /path/to/folder &&
/path/to/gcc-source/configure --prefix=WHERE-YOU-WANT-TO-INSTALL-IT --enable-languages=c,c++ &&
make bootstrap &&
make install

make install has to be done as root if you chose to install it in a system wide location. It will work just as well if you choose to play it safe and install it somewhere in your home folder. I suggest you use the --enable-languages=c,c++ option as otherwise it will build compilers for half a dozen other languages that you don't need and it will take forever (slight exaggeration). If you install it somewhere other than --prefix=/usr you can use it when you need it by setting the variable
export CC=/path/to/bin/gcc

Lleb_KCir 05-22-2004 06:20 PM

Quote:

Originally posted by Andrew Benton
What it's telling you there is that the gcc maintainers recommend that you compile gcc in a seperate folder to the one the source code is in. With most things you cd into the folder then do ./configure, make, make install, but with gcc (and a few other things) you need to make a seperate folder to build in, cd into that and then run the configure script in the gcc source folder from there. I mostly compile on my gnome desktop, but you can do it where you like. untar the gcc source code then create an empty folder somewhere to build in. It doesn't matter what it's called or where it is as you will be deleting it after you've done make install. I'm lazy so I would right click on my gnome desktop and choose Create Folder to make an empty folder, then I would delete the word untitled so it is just called folder then
cd /path/to/folder &&
/path/to/gcc-source/configure --prefix=WHERE-YOU-WANT-TO-INSTALL-IT --enable-languages=c,c++ &&
make bootstrap &&
make install

make install has to be done as root if you chose to install it in a system wide location. It will work just as well if you choose to play it safe and install it somewhere in your home folder. I suggest you use the --enable-languages=c,c++ option as otherwise it will build compilers for half a dozen other languages that you don't need and it will take forever (slight exaggeration). If you install it somewhere other than --prefix=/usr you can use it when you need it by setting the variable
export CC=/path/to/bin/gcc

wow ok. slow down here a bit.... that is an AWSOME responce, but im going to back you up a bit to make sure that i understand you 100%.

[qoute]then I would delete the word untitled so it is just called folder then
cd /path/to/folder &&[/quote]

ok so i could make a folder with this path:

/home/ray/gcc

what are the '&&' for?

Quote:

/path/to/gcc-source/configure --prefix=WHERE-YOU-WANT-TO-INSTALL-IT --enable-languages=c,c++ &&
ok as of right now i dont have the config file as i have not done anything past the .tar.bz file that is sitting in my /home/ray dir.

when i tar -zxf(i think that is the command. i might be missing one argument, but i can find that info in this thread) how do i tell it were to install the source, or will it put it someplace on its own?

what is bootstrap? sorry to be so blonde, but as stated i really dont get how things install just yet. to much rpm, and windows setup.exe for me in the past.

thank you for the help.

Andrew Benton 05-23-2004 03:17 AM

/home/ray/gcc will be fine. I put the && there for safety reasons. If you copy a string of commands from your browser or a text file into a shell and press enter it will try and execute them one after the other. That may work perfectly, or it may not. If there is an error it will drop to the next command and try and execute that and may then give a very strange error message as the previous commands didn't work properly which would make it hard to work out what went wrong. If you put && at the end of each line it won't move on to the next line and try and do that, it'll just stop at the first problem and print an error message so we can then work through the problems one at a time.
Bootstrap is a way for the compiler to check that it is working properly. It first uses your system C compiler to build a new C compiler, then it uses that to make another one, then it uses that one to make a third. Then it compares the second and third one and if they are identical it is very likely that everything is working properly and you can go ahead and install it.
tar xzf gcc-3.4.0.tar.gz
will untar the source for you. You can give the tar command other options. man tar can tell you more.

Lleb_KCir 05-23-2004 09:24 AM

Quote:

Originally posted by Andrew Benton
/home/ray/gcc will be fine. I put the && there for safety reasons. If you copy a string of commands from your browser or a text file into a shell and press enter it will try and execute them one after the other. That may work perfectly, or it may not. If there is an error it will drop to the next command and try and execute that and may then give a very strange error message as the previous commands didn't work properly which would make it hard to work out what went wrong. If you put && at the end of each line it won't move on to the next line and try and do that, it'll just stop at the first problem and print an error message so we can then work through the problems one at a time.
Bootstrap is a way for the compiler to check that it is working properly. It first uses your system C compiler to build a new C compiler, then it uses that to make another one, then it uses that one to make a third. Then it compares the second and third one and if they are identical it is very likely that everything is working properly and you can go ahead and install it.
tar xzf gcc-3.4.0.tar.gz
will untar the source for you. You can give the tar command other options. man tar can tell you more.

thank you so much for the clerification. i went back and tried to install gcc from the CDs, but something was so fubar it kept asking for dependancies that were older then i had running on my system, so i ended up formatting and reinstalling everything after backing it all up to Cd.

this time i made sure to install the developer portion of the packets.

Andrew Benton 05-23-2004 12:18 PM

Very wise.

Lleb_KCir 05-23-2004 12:20 PM

best thing about mistakes is you can learn from them. i am smarter with linux now then i was yesterday.

ayie 05-25-2004 04:08 AM

Code:

[root@fedora pkgs]# ls
gcc-3.0.4  gcc-3.0.4.tar.gz
[root@fedora pkgs]# mkdir gcc-build
[root@fedora pkgs]# cd gcc-build && ../gcc-3.0.4/configure --prefix=/root/sdk/ --enable-languages=c,c++ && make bootstrap && make install
Configuring for a i686-pc-linux-gnuoldld host.
*** This configuration is not supported in the following subdirectories:
    target-libf2c target-libffi target-boehm-gc target-zlib target-libjava zlib fastjar target-libobjc
    (Any other directories should still work fine.)
Created "Makefile" in /root/sdk/pkgs/gcc-build using "mt-frag"
../gcc-3.0.4/configure: line 7: cc: command not found
*** The command 'cc -o conftest -g  conftest.c' failed.
*** You must set the environment variable CC to a working compiler.
[root@fedora gcc-build]#

can anyone help me ??


All times are GMT -5. The time now is 09:40 AM.