Slackware This Forum is for the discussion of Slackware Linux.
|
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
04-30-2017, 04:37 AM
|
#1
|
Member
Registered: Jul 2016
Posts: 58
Rep:
|
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
|
|
|
04-30-2017, 04:50 AM
|
#2
|
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,149
Rep:
|
Last edited by Didier Spaier; 04-30-2017 at 04:52 AM.
|
|
2 members found this post helpful.
|
04-30-2017, 05:00 AM
|
#3
|
LQ 5k Club
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,438
|
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'.
|
|
|
04-30-2017, 06:54 AM
|
#4
|
Member
Registered: Jul 2016
Posts: 58
Original Poster
Rep:
|
Quote:
Originally Posted by Didier Spaier
|
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
|
|
|
04-30-2017, 07:11 AM
|
#5
|
Member
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
|
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.
|
04-30-2017, 07:24 AM
|
#6
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519
|
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.
|
04-30-2017, 08:08 AM
|
#7
|
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,149
Rep:
|
Quote:
Originally Posted by cdek
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 with
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.
|
04-30-2017, 10:24 AM
|
#8
|
Guru
Registered: Mar 2004
Location: Canada
Posts: 7,401
|
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.
|
04-30-2017, 10:53 AM
|
#9
|
Senior Member
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,950
Rep:
|
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.
|
04-30-2017, 01:53 PM
|
#10
|
Member
Registered: Jul 2016
Posts: 58
Original Poster
Rep:
|
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.
|
04-30-2017, 02:49 PM
|
#11
|
LQ Addict
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,149
Rep:
|
I am glad you succeeded. It's a pleasure answering questions asked the smart way, as yours.
|
|
|
05-04-2017, 04:49 AM
|
#12
|
LQ Veteran
Registered: May 2008
Posts: 7,002
|
Quote:
Originally Posted by knudfl
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.
|
05-04-2017, 06:12 PM
|
#13
|
Slackware Maintainer
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,724
|
Quote:
Originally Posted by GazL
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.
|
05-04-2017, 06:51 PM
|
#14
|
LQ Veteran
Registered: May 2008
Posts: 7,002
|
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.
|
|
|
05-04-2017, 07:13 PM
|
#15
|
Member
Registered: Apr 2011
Location: California, USA
Distribution: Slackware
Posts: 528
|
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.
|
All times are GMT -5. The time now is 04:19 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|