Installing Packages From Source

EVK

New Member
Credits
66
Hi,

I have been trying different Linux distributions lately to learn as much as about Linux. Lately, I have encountered with installing packages from source while trying to learn about the core elements of Linux while installing LFS. I have managed to install some packages from the source, but there is no standard in the process. Yes, the general approach is to first configure, then make, then make install but from package to package this changes a lot. And I haven't yet found an approach to deal with any package I want to install.

For example, I am trying to install dpkg package manager and I managed to successfully install all the dependencies except one; libselinux1. There is no configure file in the folder after extracting the tarball, so I thought I should go with make step first, skipping configure. But, it did not work and I have got an error saying:
Fatal Error: sepol/sepol.h: No such file or directory
15 | #include <sepol/sepol.h>


My question is how can I know how to install any package from source without using package managers? And more specifically, how can I install this package?

Many thanks for any help!

Edit1: I'm using LFS 10.0 and went even beyond BLFS i.e. installing packages outside BLFS's scope .

Edit2: I have attached a photo of the output, it's the same when I try only "make". I can't take screenshot since I have not yet know how to do so in LFS.
 

Attachments

Last edited:


JasKinasis

Well-Known Member
Credits
3,300
Without taking a look at the source code myself, it’s difficult to say.
I’d recommend taking a look at the GNU autotools documentation.

Not all projects offer a pre-made configure script. It may be that you need to run automake, which will create a ./configure script from other config files in the source tree. Then you’d run ./configure before running make.

That’s most likely. Or maybe it uses a different build system. Like boost::jam/bjam, or ninja, or cmake etc etc.

Regarding selinux - if that is required, then you will have to build and install that library (and its development package) from source before trying to build dpkg.
sepol.h is part of selinux.
 

dos2unix

Well-Known Member
Credits
2,225
The majority of gnu/linux source code files come as compressed tar files.

mypackage.tar.gz anotherpackage.tar.bz2, somethingelse.tar.xz or even thingy.tgz

You will have to download these files, then uncompress them, then untar them.
 

EVK

New Member
Credits
66
I have installed more than 50 maybe 70 packages. I have a working, and an updated BLFS system. Up to this point, I have managed to solve all the problems I have encountered and learned a lot in the process. But, this is the first package that may not need to be configured since there is no configure file after untaring. There are only; include, src, utils, man, Makefile, VERSION, and LICENSE package after I untar the tar.gz file. As I said, since there is no configure file, I will either use GNU autotools as JasKinasis stated in the above comment (I'm currently learning how to do so along with some other stuff), or maybe just maybe some dependency or something is missing.
It says dpkg depends on bunch of packages which I have installed except 1; libselinux1 which depends on libpcre3 (I have installed successfully) and libc6 2.28 (I have read on the internet that it is also called glibc, and I have the 2.32).
Or I don't know if it may result to this but I did untar the tar.gz file using "tar -xvf <package name>".
 

wizardfromoz

Super Moderator
Staff member
Gold Supporter
Credits
6,128
G'day @EVK and welcome to linux.org :)

I guess an obvious question would be what Linux Distro and version you are using?

Cheers

Chris Turner
wizardfromoz
 

f33dm3bits

Gold Member
Gold Supporter
Credits
6,098
G'day @EVK and welcome to linux.org :)

I guess an obvious question would be what Linux Distro and version you are using?

Cheers

Chris Turner
wizardfromoz
OP mentioned he is using LFS(Linux from Scratch), which is focused on learning how to create your own distribution if I am not mistaken. I have no experience with LFS, there is probably a really small amount of people who do.
 

EVK

New Member
Credits
66
G'day @EVK and welcome to linux.org :)

I guess an obvious question would be what Linux Distro and version you are using?

Cheers

Chris Turner
wizardfromoz
As f33dm3bits said in the comment just above, I'm using LFS. I haven't just explicitly written in the first post, but I will add it now.

Edit: And thanks you for welcoming me. I should have started using Linux long ago. I had focused more on electronics rather than software. I wish I knew installing LFS is so fun!
 
Last edited:

wizardfromoz

Super Moderator
Staff member
Gold Supporter
Credits
6,128
Ah, my bad ... missed the LFS reference, D'oh.

Have you used any other Linux before trying LFS?

Glad you are enjoying yourself, though :)

Wiz
 

EVK

New Member
Credits
66
Ah, my bad ... missed the LFS reference, D'oh.

Have you used any other Linux before trying LFS?

Glad you are enjoying yourself, though :)

Wiz
I have tried Ubuntu 16.04 and 18.04 while doing a comprehensive project in ROS(Robot Operating System). Actually, my main goal is to both learn more about Linux while installing LFS, and get ROS work on it. Simple tutorial stuff etc. is just not for me, one should just dive in and learn while struggling.

Edit: Not related to the comment, but I added a photo of the error in the first post. And, I don't understand why sepol.h is not present in /src if it's required to "make" the package. May I be trying to install the wrong package? This is the one I'm trying to install: https://packages.debian.org/buster/libselinux1 libsenux_2.8.orig.tar.gz . I have also tried libsenux_2.8-1.debian.tar.xz but the output is the same.
 
Last edited:

JasKinasis

Well-Known Member
Credits
3,300
Once again, sepol.h is part of selinux. You’ll need to build and install selinux and its development package before you can build and install dpkg.

sepol.h won’t be in /usr/include/ and likewise the corresponding libselinux shared libraries won’t be in /usr/lib/ until you’ve built and installed selinux.

Build and install selinux, then build dpkg.

Typically, you can’t build and install a package until you have built and installed all of its core dependencies. Which for some packages, could involve a long, complicated chain of other libraries/dependencies that need to be built and installed beforehand.

Also, be aware that some packages have a bunch of optional dependencies.
If there are optional dependencies, the configure script will typically enable/disable certain optional features based on whether or not you have the appropriate headers/libraries installed on the machine you’re building on.

If you are missing any of the core dependencies, configure will fail. If you’re missing optional dependencies, configure will succeed, but certain bits of optional functionality will be disabled/unavailable in the final build.
 

EVK

New Member
Credits
66
Once again, sepol.h is part of selinux. You’ll need to build and install selinux and its development package before you can build and install dpkg.

sepol.h won’t be in /usr/include/ and likewise the corresponding libselinux shared libraries won’t be in /usr/lib/ until you’ve built and installed selinux.

Build and install selinux, then build dpkg.

Typically, you can’t build and install a package until you have built and installed all of its core dependencies. Which for some packages, could involve a long, complicated chain of other libraries/dependencies that need to be built and installed beforehand.

Also, be aware that some packages have a bunch of optional dependencies.
If there are optional dependencies, the configure script will typically enable/disable certain optional features based on whether or not you have the appropriate headers/libraries installed on the machine you’re building on.

If you are missing any of the core dependencies, configure will fail. If you’re missing optional dependencies, configure will succeed, but certain bits of optional functionality will be disabled/unavailable in the final build.
The problem is; I get this attached error when I try to install selinux, and I have checked its dependencies, they are libc6 (also glibc as I have read) and libpcre3, I have installed both successfully. There are no optional packages for selinux.
There are only src, man, include, utils, Makefile, VERSION and LICENSE in the folder when I untar the tarball file. If only there were configure or a README file, I could have fixed it myself.
I'm thinking that maybe the tarball file is wrong one. It's libselinux_2.8.orig.tar.gz from here.
 

Attachments

JasKinasis

Well-Known Member
Credits
3,300
I think you’ll need that package, plus its corresponding dev package.
The dev package contains the headers and shared libs.

Are you building the packages on the same machine you’re installing/deploying LFS on? or are you building the packages on one machine and then installing them on another?
 


Members online


Latest posts

Top