Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have never compiled from source and did not know how to so I went to the tutorials in our forum and looked under App's/ Gui/ Multimedia.
I found the article "Compiling Programs from Source" By: Jeremy and read it twice.
The article is clear that I will need a compiler (gcc)
Do I need to go and get gcc or did my distro (Debian)come with it?
Also that when I do download from source to put the source in the following directory /usr/local/src
And than to change the directory after the unzip and the untar but what directory would I change to?
When needing the apropriate libraries; how do I know or how can I tell which libraries I'll need?
I am trying to learn first before I begin to compile and verify anything in the terminal and don't think it's wise to just download any random programs/.tar.gz-
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802
Rep:
Your distro will undoubtedly include gcc...
Just make sure that gcc and the make tools are all installed... There's tons of packages for gcc,... I would just install the metapackage for gcc at first and then determine if you need more...
You also want to install the headers for your kernel and (probably) the backports... and maybe the gcc tools for other architectures, depending on your target architecture...
The article is clear that I will need a compiler (gcc)
Do I need to go and get gcc or did my distro (Debian)come with it?
It is in the default software sources, if it is not there already. Use the "apt-get" program to install gcc and other dev tools, e.g.:
Code:
apt-get install build-essential
then you can check the version of installed gcc:
Code:
gcc -v
Quote:
Also that when I do download from source to put the source in the following directory /usr/local/src
And than to change the directory after the unzip and the untar but what directory would I change to?
that depends on the tarball directory structure. you can use the -v flag to show what is being done when you uncompress, e.g.:
Code:
tar zxvf foo-0.99.tar.gz
a popular convention is to use the same name in the tarball as is the directory you tar up - typically the name of the program, plus the version. so in the above case, you might do:
Code:
cd foo-0.99
but this is by no means a rule. use the -v flag to see what tar is decompressing. you can also use "t" instead of "x" in the tar command, to just show the contents of the tarball, w/o extracting, e.g.:
Code:
tar ztvf foo-0.99.tar.gz
Quote:
When needing the apropriate libraries; how do I know or how can I tell which libraries I'll need?
Typically, the source you wish to compile will have an INSTALL and/or README (and possible doc/ files) which should outline any libraries and header files required to build the program. You will quickly encounter missing libs/headers when you run ./configure. Or possibly during the subsequent make.
I'll have to learn more about the make tools and the metapackages-
Of course I won't use this because it's for Ubuntu but I'm using this in the Code brackets as an example so I know what I'm looking at-
I'll check in my Software Sources if not I'll use the command you posted. Thanks
I didn't know about -v flag to show whats being done when I umcompress-
I'll read the 'Install or 'Read Me'
Thanks for the heads up on if I do encounter a problem. When I run ./configure it should show me what's missing if anything.
This is just an example (lib44jd) but I think I got it-
Code:
tar zxf lib44jd.tar.gz
cd lib44jd
./configure
make
make test (optional)
make install
I'll check in my Software Sources if not I'll use the command you posted. Thanks
I didn't know about -v flag to show whats being done when I umcompress-
I'll read the 'Install or 'Read Me'
Thanks for the heads up on if I do encounter a problem. When I run ./configure it should show me what's missing if anything.
This is just an example (lib44jd) but I think I got it-
Code:
tar zxf lib44jd.tar.gz
cd lib44jd
./configure
make
make test (optional)
make install
Right?
Wel, for a generic example, yes that is about right. Note that there are typically a lot of options you can pass to the configure script (like --prefix=/opt, for example). you might also need to be root for the "make install" command (if not root already). you could use su/sudo for that step.
yes, you are right. ./configure will tell you if anything missed. In general when you want to build a software you need to install all the dependencies, and it is usually documented.
Nugat:
I found in that article that the last step needs to be executed with root permissions.
Until I read I didn't know in the last step it copies the compiled programs to my system.
Pan64
I want to make sure I understand.
You said that I need to install all the dependencies and it's usually documented.
Documented in the "Read Me" file or the "Install" file you mean?
Or documented at the Debian website where I obtain the .tar.gz?
let we say you want to build from source "thisapp". You will need to go to the home page of "thisapp" and read the online documentation. You will find some info about dependencies: to be able to compile you need to have installed "thatapp" (also there can be a readme or howto about it). Usually it means there is a package named thatapp-devel. All those packages should be installed first. ./configure will report missing packages too, but sometimes it is not really trivial.
To install anything (including your own software) you need to use root. To build your software you must not use root.
I understand now; thanks for the confirmation about being root and when I must not use root.
I'm off to do a little more reading and learn more about these things:
make tools, install headers for my kernel, and metapackages for gcc.
Until I know more and am certain of how this(compiling from source)process should progress I won't proceed with the process. I'm sure you'll agree one must know and fully understand all of the details.
I'm not sure if modifying would be a good practice for the first time compiling from source.
oh, i wasn't talking about modifying the source software. i just meant you could do something like this:
Code:
./configure --prefix=$HOME/myapp
make
make install
and then add something like this to your ~/.bashrc
Code:
myapp=$HOME/myapp
if [ -d $myapp/bin ]; then
echo $PATH|grep -q $myapp/bin && : || export PATH=${myapp}/bin:${PATH}
fi
if [ -d $myapp/lib ]; then
echo $LD_LIBRARY_PATH|grep -q $myapp/lib && : || export LD_LIBRARY_PATH=${myapp}/lib:${LD_LIBRARY_PATH}
fi
that way you could install software to your home directory (if you really wanted to), and the binaries would be in your path and the path to the libraries would be found by the binaries (per the .bashrc stuff).
it is not how one would normally install software, it is just a way to install it w/o using root.
Last edited by nugat; 10-01-2012 at 03:49 AM.
Reason: typo
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802
Rep:
Metapackages are, basically, just packages that assemble other packages together, under a big umbrella. That way you get the essential packages you need to do 90% of what falls out there...
For Debian based distros, you should probably be using apt-get install [name of the package] or Synaptic.
... Just FYI...
Ok, I get it. Thanks for the example :
my app= $HOME/myapp
if [ -d $myapp/bin]; (still learning shell scripting)
I might consider installing to my home directory; but not for the first try.(nervous)
Thanks for showing me a way to install w/o using root
Anyway, that tutorial mentions a noteable exception of a Perl program or Cpan,so in order to complete this compile from source do I need to install Perl or Cpan?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.