Archive for the ‘Linux from Scratch’ Category

Blast from the Past: Linux from Scratch: I’ve had it up to here!

December 23rd, 2016 No comments

This post was originally published on November 27, 2011. The original can be found here.

As you may be able to tell from my recent, snooze-worthy technical posts about compilers and makefiles and other assorted garbage, my experience with Linux from Scratch has been equally educational and enraging. Like Dave, I’ve had the pleasure of trying to compile various desktop environments and software packages from scratch, into some god-awful contraption that will let me check my damn email and look at the Twitters.

To be clear, when anyone says I have nobody to blame but myself, that’s complete hokum. From the beginning, this entire process was flawed. The last official LFS LiveCD has a kernel that’s enough revisions behind to cause grief during the setup process. But I really can’t blame the guys behind LFS for all my woes; their documentation is really well-written and explains why you have to pass fifty --do-not-compile-this-obscure-component-or-your-cat-will-crap-on-the-rug arguments.

Patch Your Cares Away

CC attribution licensed from benchilada

Read more…

Linux from Scratch: I’ve had it up to here!

November 27th, 2011 9 comments

As you may be able to tell from my recent, snooze-worthy technical posts about compilers and makefiles and other assorted garbage, my experience with Linux from Scratch has been equally educational and enraging. Like Dave, I’ve had the pleasure of trying to compile various desktop environments and software packages from scratch, into some god-awful contraption that will let me check my damn email and look at the Twitters.

To be clear, when anyone says I have nobody to blame but myself, that’s complete hokum. From the beginning, this entire process was flawed. The last official LFS LiveCD has a kernel that’s enough revisions behind to cause grief during the setup process. But I really can’t blame the guys behind LFS for all my woes; their documentation is really well-written and explains why you have to pass fifty --do-not-compile-this-obscure-component-or-your-cat-will-crap-on-the-rug arguments.

Patch Your Cares Away

CC attribution licensed from benchilada

Read more…

Building glibc for LFS from Ubuntu by replacing awk

November 23rd, 2011 No comments

If you run into the following error trying to build LFS from a Ubuntu installation:

make[1]: *** No rule to make target `/mnt/lfs/sources/glibc-build/Versions.all', needed by `/mnt/lfs/sources/glibc-build/abi-versions.h'. Stop.

The mawk utility installed with Ubuntu, and symlinked to /usr/bin/awk by default does not properly handle the regular expressions in this package. Perform the following commands:

# apt-get install gawk
# rm -rf /usr/bin/{m}awk
# ln -snf /usr/bin/gawk /usr/bin/awk

Then you’re just a make clean; ./configure –obnoxious-dash-commands; make; make install away from success.

Reinstalling LFS soon: it’s not my fault, I swear!

November 17th, 2011 No comments

I went to play around with my Linux from Scratch installation after getting a working version of KDE 4.7.3 up and running. For a few days now my system has been running stood up to light web browsing use and SSH shenanigans, and hasn’t even dropped a remote connection.

This was until this evening, when I decided to reboot to try and fix a number of init scripts that were throwing some terrible error about problems in lsb_base under /lib/ somewhere. The system came back up properly, but when I startx‘d, I was missing borders for most of my windows. Appearance Preferences under KDE wouldn’t even lanch, claiming a segmentation fault.

There were no logs available to easily peruse, but after a few false starts I decided to check the filesystem with fsck from a bootable Ubuntu 11.04 USB stick. The results were not pretty:

root@ubuntu:~# fsck -a /dev/sdb3
fsck from util-linux-ng 2.17.2
/dev/sdb3 contains a file system with errors, check forced.
/dev/sdb3: Inode 1466546 has illegal block(s).

(i.e., without -a or -p options)

Running fsck without the -a option forced me into a nasty scenario, where like a certain Homer Simpson working from his home office, I repeatedly had to press “Y”:

At the end of it, I’d run through the terminal’s entire scroll buffer and continued to get errors like:

Inode 7060472 (/src/kde-workspace-4.7.3/kdm/kcm/main.cpp) has invalid mode (06400).
Clear? yes

i_file_acl for inode 7060473 (/src/kde-workspace-4.7.3/kdm/kcm/kdm-dlg.cpp) is 33554432, should be zero.
Clear? yes

Inode 7060473 (/src/kde-workspace-4.7.3/kdm/kcm/kdm-dlg.cpp) has invalid mode (00).
Clear? yes

i_file_acl for inode 7060474 (/src/kde-workspace-4.7.3/kdm/kcm/CMakeLists.txt) is 3835562035, should be zero.
Clear? yes

Inode 7060474 (/src/kde-workspace-4.7.3/kdm/kcm/CMakeLists.txt) has invalid mode (0167010).
Clear? yes

I actually gave up after after seeing several thousand of these inodes experiencing problems (later I learned that fsck -y will automatically answer yes, which means I’ve improved my productivity several thousand times!)

I was pretty quick to assess the problem: the OCZ Vertex solid state drive where I’d installed Linux has been silently corrupting data as I’ve written to it. Most of the problem sectors are in my source directories, but a few happened to be in my KDE installation on disk. This caused oddities such as power management not loading and the absence of window borders.

So what goes on from here? I plan to replace the OCZ drive under warranty and rebuild LFS on my spinning disk drive, but this time I’ll take my own advice and start building from this LiveUSB Ubuntu install, with an up-to-date kernel and where .tar.xz files are recognized. Onward goes the adventure!

Categories: Hardware, Jake B, Linux from Scratch Tags:

Fixing build issues with phonon-backend-gstreamer-4.5.1

November 9th, 2011 No comments

I’ve decided to try and upgrade my LFS system to the latest version of KDE (4.7.3 as of the time of this writing) and correspondingly needed to upgrade phonon-backend-gstreamer. Unfortunately, following the previous version’s compilation instructions provided this nasty message:

[ 4%] Building CXX object gstreamer/CMakeFiles/phonon_gstreamer.dir/audiooutput.cpp.o
In file included from /sources/phonon-backend-gstreamer-4.5.1/gstreamer/audiooutput.cpp:22:0:
/sources/phonon-backend-gstreamer-4.5.1/gstreamer/mediaobject.h:200:38: error: ‘NavigationMenu’ is not a member of ‘Phonon::MediaController’
/sources/phonon-backend-gstreamer-4.5.1/gstreamer/mediaobject.h:200:38: error: ‘NavigationMenu’ is not a member of ‘Phonon::MediaController’
/sources/phonon-backend-gstreamer-4.5.1/gstreamer/mediaobject.h:200:69: error: template argument 1 is invalid/sources/phonon-backend-gstreamer-4.5.1/gstreamer/mediaobject.h:262:11: error: ‘NavigationMenu’ is not a member of ‘Phonon::MediaController’
/sources/phonon-backend-gstreamer-4.5.1/gstreamer/mediaobject.h:262:11: error: ‘NavigationMenu’ is not a member of ‘Phonon::MediaController’/sources/phonon-backend-gstreamer-4.5.1/gstreamer/mediaobject.h:262:42: error: template argument 1 is invalid
/sources/phonon-backend-gstreamer-4.5.1/gstreamer/mediaobject.h:263:45: error: ‘Phonon::MediaController::NavigationMenu’ has not been declared
/sources/phonon-backend-gstreamer-4.5.1/gstreamer/mediaobject.h:317:11: error: ‘NavigationMenu’ is not a member of ‘Phonon::MediaController’
/sources/phonon-backend-gstreamer-4.5.1/gstreamer/mediaobject.h:317:11: error: ‘NavigationMenu’ is not a member of ‘Phonon::MediaController’/sources/phonon-backend-gstreamer-4.5.1/gstreamer/mediaobject.h:317:42: error: template argument 1 is invalid
make[2]: *** [gstreamer/CMakeFiles/phonon_gstreamer.dir/audiooutput.cpp.o] Error 1make[1]: *** [gstreamer/CMakeFiles/phonon_gstreamer.dir/all] Error 2make: *** [all] Error 2

To fix this issue, make sure you have the latest GStreamer and phonon-backend-xine installed. Then I followed some of the advice from this KDE forum topic.

If, like me, you installed Qt into /opt/qt, create a symbolic link into the qt directory pointing to your system’s latest version of phonon. For later success with kde-runtime, create links to the libphonon libraries in /opt/qt-4.7.1/lib to your recently compiled /usr/lib64 versions (adjust paths to /usr/lib on 32-bit systems):

# mv /opt/qt-4.7.1/include/phonon /tmp
# ln -snf /usr/include/phonon /opt/qt-4.7.1/include/phonon
# cd /opt/qt-4.7.1/lib
# rm -rf libphonon*
# ln -snf /usr/lib64/
# ln -snf /usr/lib64/
# ln -snf /usr/lib64/
# ln -snf /usr/lib64/
# ln -snf /usr/lib64/
# ln -snf /usr/lib64/

Then rerun the compilation process for phonon-backend-gstreamer and voila, no more errors. (You’ll probably still have more issues to work out, but this gets past the phonon-backend-gstreamer blockade.)

Why do so many open source programs throw C/C++ warnings?

November 8th, 2011 4 comments

Seriously, I’d like to know, because this is a bit ridiculous.

For all the heavily encouraged coding styles out there, nearly all the open source software packages I’ve had to compile for Linux from Scratch have either

  1. Insanely chatty defaults for compilation; that is, GCC provides ‘notices’ about seemingly minor points, or
  2. A large number of warnings when compiling – unused variables, overloaded virtual functions, and deprecated features soon to disappear.

In the worst case, some of these warnings appear to be potential problems with the source. Leaving potentially uninitialized variables around seems to be a great way to run into runtime crashes if someone decides to use them. Overloading virtual functions with a different method signature has the same possible impact. And comparing signed and unsigned numbers is just a recipe for a crash or unpredictable behaviour down the line.

I just don’t get it. In my former development experiences, any compiler notifications were something to pay attention to. Usually when first developing an application, they were indicative of a typo, a forgotten variable or just general stupidity with the language. If a warning was absolutely unavoidable, it was specifically ignored in the build scripts with a clear explanation as to why.

So what’s the case with your programs? Have you noticed any stupid or insightful compiler messages scrolling past?

LFS so far – why you should build i686 and x86_64 binaries

November 7th, 2011 No comments

I’ve now been actively using my (Beyond) Linux from Scratch installation for about a week now, and it’s actually pretty neat to have something working that I built with just a general outline. Granted, the LFS guide is very well put together, but going beyond the basic console of a system requires a bit of time and effort.

In really any other distro, the package manager should really be your best friend (except when it breaks.) Even in a source-based Linux like Gentoo, Portage gives you a pretty decent idea of what’s installed and is able to keep track of dependencies. With LFS, there are really some times where I don’t want to have to locate and download seventeen .tar.bz2 files, and ./configure –prefix=/usr; make; make install to each one in sequence. What’s worse is when you run into three dependencies for a particular piece of software, and the first two install properly, but the third one depends on ten additional packages.

This is what building software in LFS looks like.

There are also some libraries that despite being built on an x86_64 system will come out as 32-bit, and require special compiler or configure flags in order to build a pure 64-bit version. LFS x86_64 does not really have patience for anything 32-bit. This is generally fine because you’re building most of the applications yourself, but you can’t “just run” any typical application unless it’s taken the architecture into account.

In summary, while it’s awesome to go to SourceForge and have the very latest version of a package, sometimes I just don’t feel like going through all those hoops and satisfying twenty conditions for a compile to take place. Perhaps I’m OK if your application uses a built-in library rather than relying on whatever happens to be installed in /usr/lib.

The takeaway from this is that besides providing the source, considerate developers should try and build an i686 and x86_64 binary from that same source. If your build system has issues or you find it painful to produce binary releases, remember that anyone attempting to follow the INSTALL file will run into the same pain points. Firefox, for example, has both i686 and x86_64 release tarchives. The 64-bit version works quite well on my LFS installation and it’s how I’m writing this post.

LFS: Installing VLC

November 6th, 2011 1 comment

Since the install of Linux From Scratch, one of the main issues I’ve been having is the playback of audio and video files. VLC does both quite well, so I decided to install it.

Like most of my installs in Linux From Scratch, there are millions of dependencies, and you have to install each one manually. I found that the CBLFS VLC page was a great help in determining which packages were required.

One thing I noticed, is that even though it lists some packages as “Optional,” VLC will not compile without a few of them. The easiest way to deal with this is to just install the optional packages as required.

I only ran into one issue while compiling:

D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/var/lib/dbus/machine-id": No such file or directory
See the manual page for dbus-uuidgen to correct this issue.
D-Bus not built with -rdynamic so unable to print a backtrace

The quick fix for this is to just run:

dbus-uuidgen > /var/lib/dbus/machine-id

Now that VLC is compiled, you can run it anytime by using vlc from the command-line. Make sure you don’t pull a Jake and run it as root. It will yell at you.

Linux From Scratch: We Have Lift-off…

November 4th, 2011 No comments

Hi Everyone,

Now that I have a relatively stable environment, I just wanted to write an update of how things went, and some issues that I ran into while installing my desktop environment.

No Sound

Not that I was expecting anything different from LFS, but I had no sound upon booting into KDE. I found this quite strange, as alsamixer was showing my sound card fine. One thing I can tell you, is that alsaconf is a filthy liar. My sound is now working, and it still says it can’t find my card. I’m not sure how I got it working, but here are a few tips.

  • Make sure your sound is un-muted in alsamixer.
  • Check your kernel to make sure that either support is compiled in for your card, or module support is selected.
  • If you selected module supprt, make sure the modules are loaded. For me, this was snd-hda-intel.

Firefox and Adobe Flash

I’m not going to go into too many details about Firefox, as Jake covered this in his post here, but I’d like to note that installing Flash into Firefox was quite easy. All I had to do was download the .tar.gz from Adobe, and do the following:

tar -xvf flash.tar.gz (or whatever the .tar.gz is called)
cd flash
cp ~/.mozilla/plugins (make sure plugins is created if it does not exist.)

KDE Crash On Logout

The first time I tried to logout of KDE, I noticed that it crashed. After doing some investigations, I found a solution here. You want to edit your $KDE4_PREFIX/share/config/kdm/kdmrc to reflect the following:



What’s Next?

I’m actually not sure what I’m going to do next. I suppose I should get VLC running on the system, but that shouldn’t be too difficult. I now have a working web browser, flash, and sound, which should be fine until I can get other things working.

Getting Firefox 3.6.23 to compile under LFS

November 4th, 2011 No comments

Using the instructions from the BLFS book with the latest available 3.6 build of Firefox, I was able to achieve success. I figured I’d try out 3.6 before going onto something with a terribly inflated version number, and as per usual, ran into some problems:

  • Rebuild libpng-1.5.5 with APNG support. This is actually optional as I ended up commenting out the –with-system-png option in mozconfig.
  • In the suggested mozconfig, comment out the last two lines:

    #ac_add_options --with-system-libxul
    #ac_add_options --with-libxul-sdk=/usr/lib/xulrunner-devel-

    to create a standalone build.

  • Apply the GCC patch from this Bugzilla report (direct download).
  • Apply a partial patch from the Chromium project of all places. I’ve customized it here:

    # TLE Patch for Firefox/LFS

    diff -u a/gfx/ots/src/ b/gfs/ots/src/
    — a/gfx/ots/src/ 2011-11-02 07:10:17.000000000 -0400
    +++ b/gfx/ots/src/ 2011-11-02 07:10:30.000000000 -0400
    @@ -5,6 +5,7 @@
    #include “os2.h”

    #include “head.h”
    +#include <cstddef>

    // OS/2 – OS/2 and Windows Metrics

  • Apply a GCC4.6-specific patch to fix various .cpp files. Some parts of the patch will fail; that’s expected.
  • Manually edit layout/style/nsCSSRuleProcessor.cpp and go to line 1199. Change the source code as follows:

    const nsCaseInsensitiveStringComparator ciComparator;
    should become

    const nsCaseInsensitiveStringComparator ciComparator = nsCaseInsensitiveStringComparator();
  • For the toolkit/components/places/src/SQLFunctions.cpp file, change line 126 to:
    const nsCaseInsensitiveStringComparator caseInsensitiveCompare = nsCaseInsensitiveStringComparator();
  • In toolkit/crashreporter/google-breakpad/src/common/linux/, make sure line 51 is changed to:
    const CPPLanguage CPPLanguageSingleton = CPPLanguage();
  • In toolkit/xre/nsAppRunner.cpp, line 990:

    static const nsXULAppInfo kAppInfo = nsXULAppInfo();
  • While this is resolved in newer Firefox versions, copy security/coreconf/ to security/coreconf/ to add support for the 3.1 kernel.

Your reward will be a working Firefox installation:

KDE4, LFS: Make GTK Applications Look Like QT4 Applications

November 3rd, 2011 2 comments

Do your GTK applications (i.e. Firefox) look like something designed in the 90’s in KDE? I think I can help you.

I installed the latest Firefox, (not the one in the screenshot, I stole this.) and was very disappointed to see something like the following:

Tyler pointed me to the Gentoo guide here, which helped me find out which packages I needed.

If you install Chakra-Gtk-Config, and either oxygen-gtk or qtcurve (make sure to download the gtk2 theme), you will have better looking GTK applications in no time. Note that there are probably tons of other GTK themes for KDE4, these are just some suggestions to get you started.

That is much better.

Installing glib-1.2.10 in LFS to get XMMS working

November 3rd, 2011 1 comment

So I wanted to install XMMS in Linux From Scratch, as it’s one of the more reliable MP3 players and one of the first multimedia Linux apps I’ve used. It’s very reminiscent of Winamp 2:

If you would also like to get it installed, you’ll need the source and glib-1.2.10. Then, check out a common problem when installing glib, and a patch to fix the ./configure step.

LFS, pre-KDE: Fixing libmng with -fPIC and xine with a header

November 2nd, 2011 No comments

Fixing libmng with -fPIC

In preparation for getting KDE4 (and Qt4, and all the other dependencies) working with my Linux from Scratch install, I noticed an issue when compiling libmng:

/usr/bin/ld: libmng_chunk_io.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
libmng_chunk_io.o: could not read symbols: Bad valuecollect2: ld returned 1 exit status
make: *** [] Error 1

To fix this, you’ll have to edit the makefile in /sources/libmng-1.0.10/makefiles/makefile.linux as per this osdir mailing list thread. Line 47 currently reads:

FLAGS=-I$(ZLIBINC) -I$(JPEGINC) -I$(LCMSINC) -Wall -O3 -funroll-loops \

Add the -fPIC flag instead:

FLAGS=-I$(ZLIBINC) -I$(JPEGINC) -I$(LCMSINC) -Wall -O3 -fPIC -funroll-loops \

Then change back to /sources/libmng-1.0.10 and run make clean; cp makefiles/makefile.linux Makefile && make to successfully compile the library.

And Xine

Xine appears to be missing a header, causing an xmcc compilation error. Check out the original solution and add the line with the + where indicated:

Index: src/video_out/xxmc.h
src/video_out/xxmc.h 2011-01-23 17:55:01.333928003 +0100
+++ src/video_out/xxmc.h 2011-01-23 17:54:48.509926463 +0100
@@ -79,6 +79,7 @@
#include <X11/extensions/Xvlib.h>
#include <X11/extensions/vldXvMC.h>
+ #include <X11/extensions/XvMClib.h>
#include <X11/extensions/XvMClib.h>
#include <X11/extensions/XvMC.h>

LFS, pre-KDE: Errors Compiling qca-2.0.3

November 2nd, 2011 No comments

If you’re going through the Beyond Linux From Scratch guide, and run into this error while compiling qca-2.0.3 (and I assume many other versions of qca), I think I can help.

You don’t seem to have ‘make’ or ‘gmake’ in your PATH.
Cannot proceed.

The fix is relatively easy. Just make sure to have which installed on the machine. Jake found this out the hard way by looking through the configure script. Doing this experiment on Linux From Scratch has really given me an appreciation for distributions that come with basic utilities such as which.

Since which is very difficult to find on Google, here is a link:

Linux from Scratch: A Cautionary Tale, Part 2

November 1st, 2011 3 comments

What Next? Chroot

Once you get into the chroot environment, you will get the incredibly annoying PC speaker beep every time you foul up a command.

When compiling glibc in section 6.9, first ensure that there’s no “lib64” directory in your root; for some reason I had a symlink of lib64 pointing to itself. Make sure you’ve run the sed script correctly or the “make install” portion will fail. Specifically, use -Wl (the letter l) in the command, not -W1 (the number 1). After you fix the idiotic transposition of 1 and L, remove both the glibc-build and glibc-2.14.1 directories under /sources and restart section 6.9 from the beginning. If you don’t restart from the beginning, you’ll still get “glibc cannot find dynamic linker” even though the file exists in /lib64.

Keep Watching What You Type

In section 6.10, when running the grep command to ensure the correct startfiles are used, make sure you use [1in] with a one and not [lin] with an L in the command:

grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log

In section 6.11 and 6.12, I had to run ldconfig before the new libraries were picked up. It seems like the same problem encountered on this mailing list but I’d confirmed that my PATH was set correctly. The same applied for section 6.22; run ldconfig before attempting the configure/make/make install process for E2fsprogs.

For procps-3.2.8, when applying the sed command in chapter 6.27.1, make sure you’ve copied and pasted it (or at least check your typing.) I missed a forward slash in the regex about four times, causing an error during make:

...undefined reference to `get_pid_digits'
collect2: ld returned 1 exit status

But hey, at least I have things sort of working:

My next few posts will deal with specific problems with reasonable solutions.

Linux From Scratch : The Beginning…

October 31st, 2011 1 comment

Hi Everyone,

If you don’t remember me, I’m Dave. Last time for the experiment I used SuSE, which I regretted. This time I decided to use Linux From Scratch like Jake, as I couldn’t think of another distribution that I haven’t used in some way or another before. Let me tell you… It’s been quite the experience so far.

The Initial Setup

Unlike Jake, I opted not to use the LFS Live CD, as I figured it would be much easier to start with a Debian Live CD. By the sounds of it, I made a good decision. I had network right out of the gate, which made it easy to copy and paste awful sed commands.

The initial part of the install was relatively painless for me. Well, except that one of the LFS mirrors had a version from 2007 listed as their latest stable build, setting me back about an hour. I followed the book, waited quite a while for some stuff to compile, and I was in my brand new … command-line. Ok, it it’s not very exciting at first, but I was jumping for joy when I ran the following command and got the result I did:

root [ ~ ]# ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=56 time=32.967 ms
64 bytes from icmp_seq=1 ttl=56 time=33.127 ms
64 bytes from icmp_seq=2 ttl=56 time=40.045 ms


Series of Tubes

The internet was working! Keep reading if you want to hear what awful thing happened next…

Read more…

Linux from Scratch: A Cautionary Tale, Part 1

October 30th, 2011 1 comment

And I’m started with Linux from Scratch! Here are some helpful pointers for anyone considering running LFS on their own. Caution: this is highly nerdy and keyworded to hell to hopefully allow your favourite search engine to grab solutions from this post.

Getting Started, AKA: Use a Distribution You Know

LFS needs an existing Linux environment. Don’t try and use unetbootin on the LFS liveCD (I used lfslivecd-x86_64-6.3-r2145-min.iso to get started, but there is a newer revision 2160 available on one of the mirrors.) unetbootin in this configuration is just a bag of hurt and you’ll spend an inordinate amount of time trying to get your root volume to work, so just burn a CD.

If I was building LFS again I’d have started from a stable Debian base or other Linux distribution where I’m comfortable and have network access – there are a number of reasons below I suggest this, but you really want your host system kernel to be 2.6.25 or higher.

Make sure to have all the patches from are downloaded and in a location you can access from your host distribution. USB sticks are OK for this if you don’t have network access (mount the stick, and then copy the patches and packages to the sources directory). Use DownThemAll or a similar mass downloading application/extension on the patches page to save time and grief.

Watch What You Mount

Augh, out of space! It’s quite possible to mount /mnt/lfs on two partitions at the same time by missing a directory, like this:

$ mount /dev/sdb3 /mnt/lfs
$ mount /dev/sdb1 /mnt/lfs

Oops – I missed /boot at the end of the second mount command. To confirm this before copying any files, “mount” should show only one partition active at /mnt/lfs. Since my /dev/sdb1 partition was only 200MB I got to the GCC extraction step and was promptly disappointed. I ended up unmounting everything, recreating the filesystem (mke2fs -v /dev/sdb1) and then remounting (mkdir -pv /mnt/lfs/boot; mount -t ext2 /dev/sdb1 /mnt/lfs/boot).

For more tales of installation havoc, keep reading…

Read more…