LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-31-2017, 11:52 PM   #1
F.Society
LQ Newbie
 
Registered: Aug 2017
Posts: 9

Rep: Reputation: Disabled
Question Compiling from source code?


Hello everyone!

So, rather than using apt-get lately I've been seeing programs or games that you must compile first.

I've learned a little bit but I'm still a bit confused about the make command.

*EDIT" Forgot to mention:

Running Debian lxde


For simplicity, I'll use nethack.

Is there a way to compile these programs so that I might use them to their own folder without installing?

For example;

Git "nethack"

User/downloads/nethack-source

Compile to: User/downloads/nethack

Run via:

cd user/downloads/nethack && ./Nethack

So compiling it to a new folder I choose and running it out of there without Installing.

Any and all help appreciated.


I am still very new to Linux but I'm learning as fast as I can.
So simple terminology helps.

Last edited by F.Society; 09-01-2017 at 12:12 AM.
 
Old 09-01-2017, 12:24 AM   #2
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
It is not the make command that you want to look at rather the configure. A lot of the time there is a --prefix= you can use when running the ./configure command that tells where the program will be installed. To find the options you can use with the command use ./configure -h or --help though most times you are better off letting the program to install into its default location most likely in /usr/local/bin or similar. That way the program is in the path and is installed into the standard location for user installed programs.
 
1 members found this post helpful.
Old 09-01-2017, 12:36 AM   #3
F.Society
LQ Newbie
 
Registered: Aug 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by HappyTux View Post
It is not the make command that you want to look at rather the configure. A lot of the time there is a --prefix= you can use when running the ./configure command that tells where the program will be installed. To find the options you can use with the command use ./configure -h or --help though most times you are better off letting the program to install into its default location most likely in /usr/local/bin or similar. That way the program is in the path and is installed into the standard location for user installed programs.


Appreciate the info!
I do understand that sometimes letting it be is best.

But in cases like the simple game I'm not sure it's entirely mandatory to.
that's why I was curious if it was possible and the best way to do it.
 
Old 09-01-2017, 01:16 AM   #4
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by F.Society View Post
Appreciate the info!
I do understand that sometimes letting it be is best.

But in cases like the simple game I'm not sure it's entirely mandatory to.
that's why I was curious if it was possible and the best way to do it.
Nothing is mandatory that is why options like that exists to allow you to do with your system what you want. For the most part though letting it default to a local user directory that is there for the purpose of installing software outside the packing system is the way to go. Less problems if needing to trouble shoot tracking down directories where things are not expected to be, possible paths hard coded into the build that will break, stuff like that...
 
1 members found this post helpful.
Old 09-01-2017, 01:25 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051
installing things you compiled yourself, you have to keep in mind that your package management system won't know about them!
so there will be no updates, while the rest of the system will keep on updating (if you treat it right), which will evtl. lead to compatibility issues.

also, depending on the install location, there might be file conflicts.

now some applications don't need to be installed at all - you simply build them and run them from the build directory. might work, might not. if it works, i think it's abetter solution, because easier to keep an eye on where the files are.
 
1 members found this post helpful.
Old 09-01-2017, 01:59 AM   #6
F.Society
LQ Newbie
 
Registered: Aug 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
True, however say you are beta testing a game.
which isn't in any repos so you compile the source as it's released on github.
personally I feel a simple accessible folder on my desktop would be easy to keep an eye on.
 
Old 09-01-2017, 02:09 AM   #7
dejank
Member
 
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229

Rep: Reputation: Disabled
If you want to install from source, there are ways to make debian package and keep both yourself and package manager happy. Do yourself a favor and read this: http://forums.debian.net/viewtopic.php?p=228570

If that does not fulfill your needs, think of using virtual machine to test whatever you want to test, or chroot environment.

Last edited by dejank; 09-01-2017 at 02:12 AM.
 
Old 09-01-2017, 11:26 AM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051
Quote:
Originally Posted by F.Society View Post
True, however say you are beta testing a game.
which isn't in any repos so you compile the source as it's released on github.
personally I feel a simple accessible folder on my desktop would be easy to keep an eye on.
don't get me wrong, i'm not saying one shouldn't do it.
but one needs to be aware of what's happening.
that last sentence tells me that you're not.
if you do a "sudo make install", the program will NOT be in an easily accessible folder on your desktop anymore.

also, there's quite a few stories where somebody installed something from source, forgot about it, and started to have weird issues later on... and that's only the stories of those who did remember in the end.
 
Old 09-01-2017, 02:53 PM   #9
F.Society
LQ Newbie
 
Registered: Aug 2017
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
don't get me wrong, i'm not saying one shouldn't do it.
but one needs to be aware of what's happening.
that last sentence tells me that you're not.
if you do a "sudo make install", the program will NOT be in an easily accessible folder on your desktop anymore.

also, there's quite a few stories where somebody installed something from source, forgot about it, and started to have weird issues later on... and that's only the stories of those who did remember in the end.
Thats why I was trying to figure out how to cram it all into one folder.
I am aware of when running make install it auto installs to the pre defined place.
I guess overall I just need to find a way to learn about compiling.
 
Old 09-01-2017, 07:12 PM   #10
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by F.Society View Post
Thats why I was trying to figure out how to cram it all into one folder.
I am aware of when running make install it auto installs to the pre defined place.
I guess overall I just need to find a way to learn about compiling.
Not much to learn a properly packaged source should just compile using the standard commands. Where you can run into problems is in the support libraries needed to get a compile done this is where apt-file comes in handy. Once installed and having run apt-file update as root then the normal user can use apt-file search file/missing.h to find the development package that contains the needed header file that needs to be installed to compile with success. Most times there is a README or INSTALL file in the extracted source top level directory containing useful information they should be read to find that and most importantly leave shit alone until you know what you are doing as if you break it you get to keep the pieces.
 
Old 09-01-2017, 11:29 PM   #11
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Location: Non. Je suis propriétaire – No. I am an owner.
Distribution: Apple-selling shops, markets and direct marketing
Posts: 1,513
Blog Entries: 39

Rep: Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787
On the topic of maintaining and removing compiled packages with porg, I have a blog-post.

I thought, too, the OP needed information on the --prefix option to configure, so Porg may be OT, here, or not.

Last edited by Michael Uplawski; 09-01-2017 at 11:30 PM. Reason: more beautiful and actually working hyperlinks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] compiling source code cmoore90638 Linux - Newbie 3 07-07-2016 04:18 PM
Help compiling source code jjscott Linux - Software 7 06-15-2015 09:30 PM
Compiling from source code umamaheshmunez Linux - Software 9 10-24-2008 03:05 AM
compiling source code BoredStudent Linux - Desktop 1 10-26-2006 08:09 AM
compiling source code bishalpoudyal Linux - Software 1 04-08-2006 03:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration