-   Linux From Scratch (
-   -   Error compiling Pacman on LFS 6.1.1 (

Vampirite 08-26-2006 01:16 PM

Error compiling Pacman on LFS 6.1.1

I needed a good package manager for LFS. I found problems in quite alot, .deb packages are complicated to create - as are RPMs. The easiest (in my opinion) - Pacman. However it won't compile.

I am trying to compile it on a recently compiled LFS 6.1.1 (Kernel The only other thing I have done is strip all binaries using --strip-all. And all libraries (including kernel modules) with --strip-debug.

I have compiled libtar including the patch on Pacman's website.

It gets up to here before the error (which seems I have not copied - oops. Will do that soon, though it is something about TLS...)


(cd libftp; make libftp.a)
make[1]: Entering directory `/home/kourosh/compile/pacman-2.9.8/libftp'
make[1]: `libftp.a' is up to date.
make[1]: Leaving directory `/home/kourosh/compile/pacman-2.9.8/libftp'
gcc ./src/pacman.o ./src/db.o ./src/util.o ./src/list.o ./src/package.o ./src/pacsync.o ./src/md5.o ./src/md5driver.o ./src/strhash.o ./src/rpmvercmp.o -o pacman -Llibftp -lftp -ltar -lz
gcc ./src/pacman.o ./src/db.o ./src/util.o ./src/list.o ./src/package.o ./src/pacsync.o ./src/md5.o ./src/md5driver.o ./src/strhash.o ./src/rpmvercmp.o -o pacman.static -static -Llibftp -lftp -ltar -lz

Just to make sure, I ran ldconfig, and my /etc/ contains:


# Begin /etc/


# End /etc/

So - whats wrong? I have compiled as root and as my user, has anyone else had this problem?

I need help - I can't get much further without pacman.



P.S. Funny if it was something just as little as a missing package ;)

jong357 08-29-2006 06:19 AM

And off the zero reply list we go... ;)

Try posting the missing package and your error message. A proper follow up never killed anyone... :p

Vampirite 08-29-2006 04:41 PM

Funny, it compiles perfectly on Slackware 10.2...

I'm going to try recompiling gcc - need to do it anyway, and it might work...

I haven't been on LFS in a while, different computer to this one, will try and get the error message soon.

If it is a missing package I have no idea what it is...

I was wondering if this would ever get a reply ;)

Oh yeah and just may I ask - in which way can I get the error message without manually typing it by hand...?
"make > ./error.txt" seems to just output the good bit as seen in the first post...

cs-cam 08-30-2006 01:43 AM


make > ./make.log 2>&1

jong357 08-30-2006 08:18 AM

So now your saying you haven't figured it out? I'm confused.. I guess I misunderstood.. ;) pacman is alright I guess. Have you thought about pkgtools? Can't beat it...

Might I suggest you check DIY out if you haven't already.

The maintainer uses pacman personally, I believe, so perhaps there is something in his patch there.. Besides, not only is DIY a boon for anyone using a package manager on "LFS", it's also a hell of alot more correct in bootstrapping methods, the number one point being that we don't statically link anything during the toolchain phase. I've had a couple bad builds over the years from doing it the "LFS way"...

Anyhoo... I don't think the patch offered on DIY is compilation related but ya' never know. Worth a look see IMO...

Vampirite 08-30-2006 09:50 AM

I'll try the patch. Don't think it'll make much difference, come to think of it I don't know why I turned down pkgtools...I use it quite alot in Slackware.

I'll have to look into pkgtools and dpkg. Where can I get pkgtools? Just exract it from Slackware?

jong357 08-31-2006 03:33 PM

Yep. tar-1.13 and mktemp are runtime dependencies for pkgtool. Whether you want to make those into seperate packages or throw them in with pkgtools is up to you.

tar-1.5 will bugger up your packages so manually "tar-1.13 czf pkgtools-$VERSION-$ARCH-1.tgz".. You can build tar-1.13 and install to /tools/bin/tar-1.13 or just let "tar" build the first package and then build pkgtools again using makepkg. I'm being a little hurried. I'll post my .SlackBuild for LFS and let you decipher it on your own time. I modify the pkgtool scripts to use "desc" and not "slack-desc" AND I have CWD set up a certain way. Alot different than Pat's source directory but it's still pkgtools-11.0


# $CFLAGS are set globaly in /etc/bashrc except for 'dialog'
# tar-1.13 has a tendency to break after you get away from
# using the toolchain, thus rendering pkgtools broken.
# Just rebuild pkgtools after you remove /tools and all
# will magically start to work. Suggestions welcome...


if [ ! -d $TMP ]; then
  mkdir -p $TMP
  chmod 1777 $TMP

rm -rf $PKG
mkdir -p $PKG/var/log/{setup/tmp,scripts,packages,removed_{packages,scripts}}
mkdir -p $PKG/{install,etc,sbin,bin,usr/{share,man/man{1,8}}}

# Install the scripts:
for script in $CWD/source/scripts/* ; do
    install -m 755 $script $PKG/sbin

# Make our changes to the scripts
( cd $PKG
  patch -Np1 -i $CWD/patches/$PKGNAME-$VERSION-jag.patch )

# Man pages:
for page in $CWD/source/man8/* ; do
  install -m 644 $page $PKG/usr/man/man8

# Install terminfo:
( cd $PKG/usr/share
  tar xjf $CWD/source/terminfo.tar.bz2 )

# Build dialog:
cd $TMP
rm -rf dialog-$DIALOG
tar xzf $CWD/source/dialog-$DIALOG.tar.gz
cd dialog-$DIALOG
find . -perm 444 -exec chmod 644 {} \;
  ./configure --prefix=/usr \
  --bindir=/bin \
strip dialog
install -m 755 dialog                        $PKG/bin
install -m 644 dialog.1                $PKG/usr/man/man1
install -m 644 samples/slackware.rc        $PKG/etc/dialogrc
cd po
for file in *.gmo ; do
  mkdir -p $PKG/usr/share/locale/`basename $file .gmo`/LC_MESSAGES
  cat $file > $PKG/usr/share/locale/`basename $file .gmo`/LC_MESSAGES/
gzip -9 $PKG/usr/man/man1/dialog.1

# We still need tar-1.13
cd $TMP
rm -rf tar-$TAR
tar xzf $CWD/source/tar-$TAR.tar.gz
cd tar-$TAR
patch -Np1 -i $CWD/patches/bzip2-tar.patch
./configure \
  --prefix=/usr \
  --bindir=/bin \
strip --strip-unneeded src/tar
install -m 755 src/tar                $PKG/bin/tar-1.13

# Make a launcher for it even tho I never use it...
mkdir -p $PKG/usr/share/{applications,pixmaps}
install -m 644 $CWD/pkgtool.png $PKG/usr/share/pixmaps
cat << EOF > $PKG/usr/share/applications/pkgtool.desktop
[Desktop Entry]
Comment=Package Maintenance
Comment[en_CA]=Package Maintenance
Comment[en_GB]=Package Maintenance

# Make the package description:
cat << EOF > $PKG/install/desc
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.

pkgtools: pkgtools (package manager)
pkgtools: This package contains utilities for handling tgz packages.
pkgtools: Included are the command line utilities 'installpkg', 'removepkg',
pkgtools: 'makepkg', 'explodepkg', and 'upgradepkg' that install, remove,
pkgtools: build, examine, and upgrade software packages.  Also included is
pkgtools: 'pkgtool', a menu based program for installing packages, removing
pkgtools: packages, or viewing the packages that are installed on the system.
pkgtools: This is Slackware's pkgtool with a few modifications.

cat $CWD/ > $PKG/install/

# Build the package:
cd $PKG
chown -R root.root .
if [ -x /sbin/makepkg ]; then
  makepkg -l y -c n $TMP/$PKGNAME-$PKGVER-$ARCH-$BUILD.tgz
  echo "Making package..."
  echo "Your package is in $TMP. You will need to:"
  echo "cd /"
  echo "tar xzvf $TMP/$PKGNAME-$VERSION-$ARCH-$BUILD.tgz"
  echo "sh install/"
  echo "rm -rf install"
  echo "Then re-run this script for the final package."
  echo "tar > 1.13 was used. This borked your package manifest."

EDIT: Here... I'll just upload everything if you don't want to sort it out on your own. You can download the tarball, sift thru it and decide if it's aceptable for use on your system. If you try to sort it all out from the FTP slackware site, it might take you awhile... Up to you...

Vampirite 09-01-2006 03:28 AM

I'll look through it, I was working on a (very) basic package manager in bash shell script, similar to pkgtool and pacman. But I am lost as how to write a package remover.

Anywho, the error compiling pacman was:


(cd libftp; make libftp.a)
make[1]: Entering directory `/home/kourosh/compile/pacman-2.9.8/libftp'
make[1]: `libftp.a' is up to date.
make[1]: Leaving directory `/home/kourosh/compile/pacman-2.9.8/libftp'
gcc ./src/pacman.o ./src/db.o ./src/util.o ./src/list.o ./src/package.o ./src/pacsync.o ./src/md5.o ./src/md5driver.o ./src/strhash.o ./src/rpmvercmp.o -o pacman -Llibftp -lftp -ltar -lz
gcc ./src/pacman.o ./src/db.o ./src/util.o ./src/list.o ./src/package.o ./src/pacsync.o ./src/md5.o ./src/md5driver.o ./src/strhash.o ./src/rpmvercmp.o -o pacman.static -static -Llibftp -lftp -ltar -lz
/usr/bin/ld: __libc_errno: TLS definition in /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libc.a(errno.o) section .tbss mismatches non-TLS reference in /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libc.a(check_fds.o)
/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libc.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [pacman] Error 1

The previously mentioned patch just modified pacman's configuration files and makepkg. Still a failure.

I'll have to look at pkgtool in my own time, thanks though!

But I still prefer pacman.

What's wrong with tar-1.15.1? I'm using it for my package manager. If I need to I'll install tar-1.13 to a different prefix, move the original tar binary to tar-1.15.1 and symlink tar-1.13 to tar. I know what I mean ;)

jong357 09-01-2006 10:46 AM

looks like pacman doesn't like something about your glibc.... That's a tough one and I don't really know how to help you there... Some sort of TLS error with /usr/lib/libc.a :confused:

Are you using LFS stable? I would have built gcc-3.4.6/glibc-2.3.6/binutils-2.16.1 if I were you... Wonderfull, wonderfull combination of core packages. Rock solid. Perhaps you would have better luck with pacman using those versions.... And where does gcc-3.4.3 come into it? lfs-6.1.1 is using 4.0.3/2.3.6/2.16.1...

I would scrap your toolchain and start again by following the book, but that's just me... If you prefer to use gcc-3.4.x then use 3.4.6.. It's a great compiler and the last in the 3.4 series. Personally, I'd suggest staying away from glibc-2.4 and gcc-4.1.x for the time being. You can try it if you want, but I'd expect problems in the BLFS stage of your build.

I would suggest posting on the ARCH forums, but historically speaking, you'd probably get some flak for doing so seeing as how this isn't a specific ARCH problem. Never much cared for some of the archers over there from a couple years back but that might have changed by now. Up to you.

For the tar question:
I also get some screwy happenings with the package manifest in /var/log/packages using tar > 1.13.... Besides, the pkgtool scripts are hard-coded to look for the binary tar-1.13 anyway... I suppose you could change those refrences but I say you won't like the results... Doing as you suggested with the tar binaries won't have an impact on pkgtools since it looks for "tar-1.13" anyway and then you would always have to call on "tar-1.15.1" if you wanted to use the new version.

I wonder if it's possible to compile pacman without the "-Llibftp -lftp" linker flags... Why would you want to use that aspect of the package manager on LFS anyways? It would probably take alot of work besides just removing those refrences....

Vampirite 09-03-2006 03:37 AM

Do I have to just destroy my LFS and start again, or can I recompile gcc, binutils, then finally glibc (the versions you specified) ON lfs, to just create a new toolchain?

The stable LFS you were looking at is 6.2, I was unlucky enough to finish 6.1.1, and have 6.2 be released the next day.

I'll see what happens in the Arch forums.

And see how much I can edit the Makefile... ;)

jong357 09-03-2006 10:55 AM

Are you already done with LFS? A little late for a package manager if so... You'd want to employ your PM imediately after the toolchain. Upgrading Glibc and Binutils on a running system is like playing with fire IMO. It can be done but not simpily by doing a make install directly over the old version. I think you'll see alot of breakage if you do that.

If all you have done is the toolchain, then your effectively still using a "running system". As soon as you chroot, you become dependent upon your toolchain's glibc and binutils. Still safer to start over IMO and all you've done is the toolchain anyway up to this point so it's really not a big deal to start over. That's what? About a day straight of compiling (on an old machine anyway).

If I were you, I'd bite the bullet and start over at the beginning.. But that's just me. If your already using binutils-2.16.1 and glibc-2.3.6 then upgrading gcc is a trivial matter and, who knows, this may fix your pacman problem.

Atleast for me, it's a pain in the butt to compile all the packages you want, even with build scripts. I have about 280 packages that I build in LFS/BLFS... Your not going to want to do this often, so that's another reason I'd probably start over while your still towards the beginning. It would be nice to have ALL your packages compiled with whatever versions of glibc/gcc/binutils you decide to go with. After a year or so, when new stable versions of the "core 3" packages come out, just start over, unless you devise some safe way of upgrading glibc and binutils. Look at Slackware's glibc build script. That's one way of safely upgrading a glibc on a running system. I still prefer not to do that tho.

Well, good luck.. You might want to compare notes with DIY if you end up starting over. It's a much, much better way to bootstrap a system IMO. Following greg's ref build will result in a "less prone to problems" build in the long run. At the very least, it's a good refrence to see what your make install variable will be. Not everything honors DESTDIR....

Vampirite 09-04-2006 03:45 AM

Well, it's alright if I start again, I've only just finished it, so it's only about two days or so compiling, for the temporary system, and the proper system.
And I can also use LFS 6.2 (but using the toolchain you specified - I don't like GCC 4.x).

I was originally intending to just use the base system, and use the package manager for applications from BLFS. But now I realise I can compile a package manager, and except from the toolchain, use it to package all applications for the system.

As for pacman, I edited the Makefile and removed the flags, however pacsync required libftp. Remove libftp and pacsync and pacman.c requires pacsync. And pacman.c has pacsync integrated, it's impossible to remove it.

Vampirite 10-14-2006 08:37 AM

Got a new computer so I need to start from scratch (no pun intended) anyway.

Vampirite 04-11-2007 10:20 AM

Oooh turns out gcc 3.4.3 (the one for LFS 6.1.1) doesnt compile pacman for some reason...

I compiled LFS 6.2 on my newer computer and 4.0.3 (the one for LFS 6.2) compiles it fine...

All times are GMT -5. The time now is 10:59 PM.