LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-30-2017, 04:37 AM   #1
cdek
Member
 
Registered: Jul 2016
Posts: 58

Rep: Reputation: Disabled
proper way to compile and install a package from source?


This is another newbie question ...

The program I want to install is PEBL.

It is not available on Slackbuilds but all the dependencies are.

After installing the dependencies it compiles without problems. (extra instructions from the developer here).

The only remaining step now is the "make install", which will copy some folders to /usr/local/bin and /usr/local/share.

I would like to know how I can create a slackware package first and then install that package instead.

Last edited by cdek; 04-30-2017 at 06:43 AM. Reason: correct link
 
Old 04-30-2017, 04:50 AM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,149

Rep: Reputation: Disabled
http://docs.slackware.com/howtos:sla...ding_a_package

PS The link in your post is:
http://http//pebl.sourceforge.net
It should be
http://pebl.sourceforge.net

Last edited by Didier Spaier; 04-30-2017 at 04:52 AM.
 
2 members found this post helpful.
Old 04-30-2017, 05:00 AM   #3
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,438

Rep: Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783
You may not need to build a package at all. Have you tried running the program from the build directory?
If a program is for personal use, then there may be no need to do a system wide 'make install'.
 
Old 04-30-2017, 06:54 AM   #4
cdek
Member
 
Registered: Jul 2016
Posts: 58

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Didier Spaier View Post
When I try:

Code:
$ make install DESTDIR=/tmp/build
it doesn't seem to install in /tmp/build but instead tries to copy the files to /usr/local/bin and /usr/local/share.

Code:
rm -Rf /usr/local/bin/pebl2
rm -Rf /usr/local/share/pebl2
install -d /usr/local/bin/
cp bin/pebl2 /usr/local/bin/pebl2
cp: cannot create regular file '/usr/local/bin/pebl2': Permission denied
Makefile:405: recipe for target 'install' failed
make: *** [install] Error 1
 
Old 04-30-2017, 07:11 AM   #5
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
Have you tried:
Code:
$ make DESTDIR=/tmp/build install
Sometimes you might need to rearrange those variables.

See here:
https://www.gnu.org/prep/standards/h...e/DESTDIR.html
 
1 members found this post helpful.
Old 04-30-2017, 07:24 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #5.

/tmp/ is not to be recommended for any user activity.
Using /tmp/ for any creativity will change the permissions.
You can do one thing in /tmp/ : Delete files.

Recommended for compiling etc. is /home/[user-name]/tmp/



-
 
1 members found this post helpful.
Old 04-30-2017, 08:08 AM   #7
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,149

Rep: Reputation: Disabled
Quote:
Originally Posted by cdek View Post
When I try:

Code:
$ make install DESTDIR=/tmp/build
it doesn't seem to install in /tmp/build but instead tries to copy the files to /usr/local/bin and /usr/local/share.

Code:
rm -Rf /usr/local/bin/pebl2
rm -Rf /usr/local/share/pebl2
install -d /usr/local/bin/
cp bin/pebl2 /usr/local/bin/pebl2
cp: cannot create regular file '/usr/local/bin/pebl2': Permission denied
Makefile:405: recipe for target 'install' failed

PS
make: *** [install] Error 1
This is because the PREFIX is hard coded in the Makefile (see line #30), and the source tarball does not include a configure script. Best would be to make a SlackBuild to cope with this situation, but a quick and dirty way could be:
  • Create a temporary directory as regular user
    Code:
    mkdir -p ~/tmp/build
  • Edit the Makefile, replacing (don't forget the trailing /)
    Code:
    PREFIX = /usr/local/
    with:
    Code:
    PREFIX = ~/tmp/build/usr/
  • As regular user, run "make" then "make install"
  • Follow the instructions of the tutorial I linked to beginning with "strip -s" but replacing
    Code:
    /tmp/build
    with
    Code:
    ~/tmp/build
Caveat: I didn't try so this could fail. But, you get the idea.

PS In this line:
Code:
/sbin/makepkg -l y -c n ../app-version-arch-tag.tgz
you will have to replace "app" by PEBL or pebl, "version" by the version number (2.0.4?) and "arch" by the output of "uname -m".
For "tag", "1" or "1cdek" "1_cdek" could be a good choice: this field is usually a build number for genuine Slackware package, but adding something that says it's not a genuine Slackware package and who built it can be handy. The templates @ http://slackbuilds.org insert an underscore between the build number and the real tag, but that's your choice.
In any case do not insert an additional hyphen anywhere but maybe inside "app" as that could confuse the Slackware package management tools.

Write the full path: /sbin/makepkg, as /sbin is not included in regular users' PATH by default.

Also, I don't see any man page so you don't need to gzip them.

Last edited by Didier Spaier; 04-30-2017 at 01:52 PM. Reason: End of post modified and expanded.
 
3 members found this post helpful.
Old 04-30-2017, 10:24 AM   #8
hitest
Guru
 
Registered: Mar 2004
Location: Canada
Posts: 7,401

Rep: Reputation: 3800Reputation: 3800Reputation: 3800Reputation: 3800Reputation: 3800Reputation: 3800Reputation: 3800Reputation: 3800Reputation: 3800Reputation: 3800Reputation: 3800
Another possibility is to use gnashley's src2pkg utility to create a Slackware package that you can easily install and remove on your system.

http://distro.ibiblio.org/amigolinux/download/src2pkg/
 
1 members found this post helpful.
Old 04-30-2017, 10:53 AM   #9
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,950

Rep: Reputation: Disabled
I think the proper way is to make a SlackBuild and build it as you would any package from SBo. To understand them spend some time reading the slackbuild templates and the included comments, if you have any specific questions I'm sure someone could help.

https://slackbuilds.org/templates/
 
2 members found this post helpful.
Old 04-30-2017, 01:53 PM   #10
cdek
Member
 
Registered: Jul 2016
Posts: 58

Original Poster
Rep: Reputation: Disabled
Didier, thank you so much for the detailed instructions.

I was able to install the package the way you explained it (and I learned a few things on the way).

I'll study the Slackbuild scripts to see if I can learn how to turn this into a proper install script.
 
1 members found this post helpful.
Old 04-30-2017, 02:49 PM   #11
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,149

Rep: Reputation: Disabled
I am glad you succeeded. It's a pleasure answering questions asked the smart way, as yours.
 
Old 05-04-2017, 04:49 AM   #12
GazL
LQ Veteran
 
Registered: May 2008
Posts: 7,002

Rep: Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133
Quote:
Originally Posted by knudfl View Post
Using /tmp/ for any creativity will change the permissions.
How so? I don't disagree that /tmp tends to get misused and there are better alternatives to use, but I've never seen "permissions" cited as an issue.
 
1 members found this post helpful.
Old 05-04-2017, 06:12 PM   #13
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,724

Rep: Reputation: 8965Reputation: 8965Reputation: 8965Reputation: 8965Reputation: 8965Reputation: 8965Reputation: 8965Reputation: 8965Reputation: 8965Reputation: 8965Reputation: 8965
Quote:
Originally Posted by GazL View Post
How so? I don't disagree that /tmp tends to get misused and there are better alternatives to use, but I've never seen "permissions" cited as an issue.
It is true that if (as root) you untar something in /tmp that has (for example) 755 permissions on '.', that you'll end up setting the perms on /tmp to 755 and will break non-privileged use of /tmp. I've had to put in workarounds for that with recent Mozilla things.

I wouldn't necessarily discourage the use of /tmp though, as long as you're aware of the possible pitfalls.
 
1 members found this post helpful.
Old 05-04-2017, 06:51 PM   #14
GazL
LQ Veteran
 
Registered: May 2008
Posts: 7,002

Rep: Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133Reputation: 5133
Yes, good point Pat. Not working in a sub-directory would never even occur to me, so I took knudfl's comment as referring to working at any level under /tmp rather than specifically to using /tmp's root level directory, but perhaps that was a misinterpretation on my part.

Last edited by GazL; 05-04-2017 at 06:52 PM.
 
Old 05-04-2017, 07:13 PM   #15
TracyTiger
Member
 
Registered: Apr 2011
Location: California, USA
Distribution: Slackware
Posts: 528

Rep: Reputation: 273Reputation: 273Reputation: 273
Quote:
It is true that if (as root) you untar something in /tmp that has ...
Extracting a tar archive as root puts the tar archive in control.

I'm not against this as I do this all of the time. But the person running tar needs to be aware of the dangers.

My long-time general practice for using tar has been to ...
  • Extract in a new directory one level deeper than needed
  • Before extracting run tar first with tvf options to inspect the paths
  • Create a new archive using relative paths not absolute when possible
This new thing called Linux may have more sophisticated options to run tar safely. I developed my tar habits with scars received while using UNIX.

Then again I never type the command "su". I always type "/bin/su".

Just a paranoid old guy.
 
3 members found this post helpful.
  


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
compile from source vs package manager lostzinzthought Linux - General 5 09-14-2010 07:41 PM
why compile source code for installing package? olddocks Linux - Server 6 04-29-2008 12:21 AM
aterm package works but I cant compile from source davimint Slackware 6 01-17-2007 11:30 PM
Package manager/compile from source doowttam Linux - Newbie 3 07-07-2006 01:44 AM
Get package from linuxpackages.net or compile from source? need advice kingsz1 Slackware 14 01-05-2006 02:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:19 PM.

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