apk-tools and abuild on LFS

2 posts / 0 new
Last post
#1 Sun, 2013-07-28 07:28
kraileth
  • kraileth's picture
  • Offline
  • Last seen: 4 years 8 months ago
  • Joined: 2013-07-26

Recently I found the time to build a Linux from scratch (LFS) system. For those who don't know what this is: LFS is both a book and a distribution. The specialty of the later is that it's entirely build from source. No, not like Gentoo - it's build completely by hand. You set up a chroot on any host distro and start building a clean build environment first (including bootstrapping GCC and things like that). Building a complete LFS system takes quite a bit of time and is not a very forgiving task: If you built some component wrong, you may be in severe trouble later. But it's not meant to be confortable. It's meant to familarize you with the nuts and bolts of a Linux system. And that is where it really shines.

For people who aren't satisfied with LFS, there's also BLFS (Beyond Linux From Scratch) which deals with building advanced programs (like X and desktops for example). (B)LFS is a nice thing to do if you've got the time on your hands. However there's one important aspect of a Linux distro which is (deliberately) not covered in the book(s): Package management. That's completely comprehensible since everybody may have different ideas of how to organize this. A long story short: I'm not a friend of the simple make install since it doesn't really give me any control and I thought that I'd try to get apk working on that system. Why? Because I like it for being both very light-weight and elegant.

For some reason I can't quite get things to run and I hope there's somebody here who has a better knowledge of the abuild system and is willing to give me a hint on what to do. Here's what I did so far:

I first cloned the aports and took a look at how apk-tools is being built on Alpine. Then I installed the dependencies the APKBUILD file calls for and downloaded the source for apk. Compiling failed but after I seded "-nopie" out of src/Makefile, it went ok. I installed it on my system and it seems to work (i.e. installing some ARCH="noarch" package using the way described on the wiki (here) to initialize a new db is successful).

However installing any binary packages from the Alpine repos is out of question of course. LFS is not using a patched kernel and it's also not using µclibc. So building my own packages is in order. To do so I figured out that I should install abuildhelper and abuild on my system. I've installed them the way the APKBUILD describes and I think abuild works. I've created the keys, created the abuild group and added my user to it, etc.

The next step I wanted to take was to build the three packages "abuildhelper", "abuild" and "apk-tools" natively on my new system. I run abuild -r in the third directory and it of course complains that it can't find the dependencies. While they are not visible to Alpine's packaging system they are of course installed on the system. So I commented them out. Apk-tools should have zero dependencies now. But the problem is: If I run abuild -r now, I'm getting the message that build-base is not installed. I took a look at what this meta package pulls in. Everything should be available on my system. So I decided to just add "build-base" to my /etc/apk/world file.

Now this last step didn't really help me. I'm getting just the same message like before:

ERROR: unsatisfiable constrains:
   build-base (missing):
      required by: world[build-base]

I'm not quite sure what is happening here. How does abuild try to detect whether "build-base" is installed? And why does it search for it at all? Is this package a hard-coded requirement for every package to be built? And if yes: What would I have to do to trick abuild into thinking that it was present on my system? Simply changing the builddeps() function in the /usr/bin/abuild script to be empty skips the checks and builds a package for e.g. abuildhelper (still printing out some errors about "build-base" missing). Building apk-tools fails due to missing dependencies. Since messing with the abuild script's content is very ugly and I don't really want to just comment out more checks or anything, I thought that I'd just ask here. Any ideas on how to do this properly?

[edit]If I just build the "build-base" meta package without any dependencies (disabeling the checks in abuild), install it and restore the unmodified abuild script, it seems to be a successful workaround. However I still can't build apk-tools. Im getting the error:

/usr/bin/pkgconf: can't handle reloc type '42' in lib '/usr/lib/libc.so.6'

I guess this is due to apk / abuild not being design to work with a libc other than µclibc? Is there anything that could easily be done about it?[/edit]

Thu, 2013-08-15 09:31
ncopa
  • ncopa's picture
  • Offline
  • Last seen: 2 years 1 month ago
  • Joined: 2011-05-12

Quote:
/usr/bin/pkgconf: can't handle reloc type '42' in lib '/usr/lib/libc.so.6'

This sounds like a linker problem. Try fix pkgconf or pkg-config.

apk itself should work with glibc too.

Log in or register to post comments