Building/Bootstrapping "How To"

Build commands for various packages are located here.

Total Upgrade Sequence

  1. GCC
  2. libtool
  3. binutils
  4. uclibc
  5. busybox
  6. perl, python, guile
  7. m4, bison, flex
  8. autoconf, automake
  9. (all the rest)

uClibc

uClibc build problems: undefined reference to `__emutls_get_address'

gcc -Wl,-EB -shared -Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=gnu -Wl,-z,defs -Wl,-s   -Wl,-init,__uClibc_init  -Wl,-soname=libc.so.0 -nostdlib -o lib/libuClibc-0.9.34-git.so  -Wl,--whole-archive libc/libc_so.a -Wl,--no-whole-archive ./lib/interp.os ./lib/ld-uClibc.so.0 ./lib/uclibc_nonshared.a /usr/lib/gcc/powerpc32-gnu-linux-uclibc/4.8.0/libgcc.a  
libc/libc_so.a(__syscall_error.os): In function `__syscall_error':
__syscall_error.c:(.text+0x20): undefined reference to `__emutls_get_address'

Using thread local storage requires manually linking to TLS emutls, via -lgcc_s (-lgcc_s.so.1).

$ readelf -h -d -s /usr/lib/libgcc_s.so.1 | grep "emutls_get_addres"
   157: 0001277c   452 FUNC    GLOBAL DEFAULT    9 __emutls_get_address@@GCC_4.3.0
   376: 0001277c   452 FUNC    GLOBAL DEFAULT    9 __emutls_get_address

So, here's the patch:

--- evil/Rules.mak
+++ good/Rules.mak
@@ -720,6 +720,8 @@ else
 DOMULTI:=n
 endif

+LDFLAGS += -lgcc_s
+
 ifneq ($(strip $(UCLIBC_EXTRA_LDFLAGS)),"")
 LDFLAGS += $(call qstrip,$(UCLIBC_EXTRA_LDFLAGS))
 endif
--- evil/test/Rules.mak
+++ good/test/Rules.mak
@@ -76,7 +76,7 @@ CFLAGS         += $(OPTIMIZATION) $(CPU_CFLAGS) $(XWARNINGS)
 # Just adding -Os for now.
 HOST_CFLAGS    += $(XCOMMON_CFLAGS) -Os $(XWARNINGS) -std=gnu99

-LDFLAGS        := $(CPU_LDFLAGS-y) -Wl,-z,now
+LDFLAGS        := $(CPU_LDFLAGS-y) -Wl,-z,now -lgcc_s
 ifeq ($(DODEBUG),y)
     CFLAGS        += -g
     HOST_CFLAGS   += -g
--- evil/libpthread/nptl/Makefile.in
+++ good/libpthread/nptl/Makefile.in
@@ -138,6 +138,8 @@ HEADERCLEAN_libpthread/nptl:
 CLEAN_libpthread/nptl:
     $(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)

+LDFLAGS-libpthread.so += -lgcc_s
+
 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
 LDFLAGS-libpthread.so += $(LDFLAGS_NOSTRIP) -Wl,-z,defs
 else

uClibc build problems: crtn.S and DOMULTI

  MKDIR lib
  AS lib/crt1.o
  AS lib/Scrt1.o
  AS lib/crti.o
  AS lib/crtn.o
initfini.c: Assembler messages:
initfini.c:23: Error: .size expression with symbol `_init' does not evaluate to a constant
initfini.c:23: Error: .size expression with symbol `_fini' does not evaluate to a constant
make: *** [lib/crtn.o] Error 1
make[1]: Nothing to be done for `locale_headers'.
make[2]: *** No rule to make target `libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/clone.c', needed by `libc/libc.oS'.  Stop.
make[1]: *** [../lib/libc.so.0] Error 2
make: *** [utils] Error 2
$ make V=1
make[1]: Nothing to be done for `locale_headers'.
  AS lib/crtn.o -DHAVE_ASM_PPC_REL16 -DHAVE_FORCED_UNWIND -DNDEBUG -D__USE_STDIO_FUTEXES__ -D__ASSEMBLER__ -DUSE___THREAD
initfini.c: Assembler messages:
initfini.c:23: Error: .size expression with symbol `_init' does not evaluate to a constant
initfini.c:23: Error: .size expression with symbol `_fini' does not evaluate to a constant
make: *** [lib/crtn.o] Error 1

GNU 'as' (gas) used to accept and ignore .size directives which referred to undefined symbols. In binutils 2.21, these are treated as errors. So here's the patch:

--- evil/libc/sysdeps/linux/powerpc/crtn.S
+++ good/libc/sysdeps/linux/powerpc/crtn.S
@@ -9,7 +9,6 @@
        addi 1,1,32
        mtlr 0
        blr
-       .size   _init, .-_init

        .section .fini
        .align 2
@@ -20,4 +19,3 @@
        addi 1,1,32
        mtlr 0
        blr
-       .size   _fini, .-_fini

After applying, the problem is gone:

$ make V=1
make[1]: Nothing to be done for `locale_headers'.
  AS lib/crti.o -DHAVE_ASM_PPC_REL16 -DHAVE_FORCED_UNWIND -DNDEBUG -D__USE_STDIO_FUTEXES__ -D__ASSEMBLER__ -DUSE___THREAD
  AS lib/crtn.o -DHAVE_ASM_PPC_REL16 -DHAVE_FORCED_UNWIND -DNDEBUG -D__USE_STDIO_FUTEXES__ -D__ASSEMBLER__ -DUSE___THREAD
  CC ldso/ldso/ldso.oS -DHAVE_ASM_PPC_REL16 -DHAVE_FORCED_UNWIND -DNDEBUG -D__USE_STDIO_FUTEXES__ -DSHARED -DNOT_IN_libc -DIS_IN_rtld -DUCLIBC_RUNTIME_PREFIX="/" -DUCLIBC_LDSO="ld-uClibc.so.0" -DLDSO_ELFINTERP="powerpc/elfinterp.c" -DNOT_IN_libc -DIS_IN_rtld -DUCLIBC_RUNTIME_PREFIX="/" -DUCLIBC_LDSO="ld-uClibc.so.0"
  AS ldso/ldso/powerpc/resolve.oS -DHAVE_ASM_PPC_REL16 -DHAVE_FORCED_UNWIND -DNDEBUG -D__USE_STDIO_FUTEXES__ -DSHARED -DNOT_IN_libc -DIS_IN_rtld -DUCLIBC_RUNTIME_PREFIX="/" -DUCLIBC_LDSO="ld-uClibc.so.0" -D__ASSEMBLER__ -DUSE___THREAD
  AR cr ldso/ldso/ld-uClibc_so.a
  STRIP -x -R .note -R .comment ldso/ldso/ld-uClibc_so.a
...

See also the following uClibc commit:

commit 3e68c52b941636714d2599ea8adda9520ec2de23
Author: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Date:   Tue May 10 10:03:58 2011 +0200

    */crtn.S: Remove .size directive for _init and _fini

    These are split across objects so setting size does not (and never did)
    work since the expression cannot be computed at assembly time.

    This avoids errors from recent (> 2.21) gas.

The second problem ("No rule to make target ‘libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/clone.c’, needed by ‘libc/libc.oS’. Stop.") may rise if so called 'DOMULTI mode' is enabled. The workaround is to never "do multi":

-DOMULTI=y
+# DOMULTI is not set

uClibc and make

# make --version
make: can't resolve symbol 'bsd_signal' in lib 'make'.

Solution: try enabling "SuSv3 LEGACY" in uClibc config (UCLIBC_SUSV3_LEGACY=y). That is what the symbol 'bsd_signal' is under.

/make-3.81 # make
dir.c:1201: error: 'glob_t' has no member named 'gl_opendir'
...

UCLIBC_HAS_GNU_GLOB is what you want. Also, 'grep' the uClibc source for the symbol that is missing and figure out what config option/define it is under.

Without 'make' you can't make even 'make'.

uClibc and binutils

/binutils-build/binutils/rename.c:103: undefined reference to `utime'

utime is under UCLIBC_SUSV4_LEGACY.

uClibc and GDB

Don't forget to enable the following in uClibc .config:

PTHREADS_DEBUG_SUPPORT=y

Git

Git & pread() or "cannot clone any remote repos"

Getting index-pack failed for any repo? This means your pread() syscall is not thread-safe. Don't worry, we'll fix that.

This feature has been introduced with commit b8a2486f1524947f232f657e9f2ebf ("index-pack: support multithreaded delta resolving").
And now it is up to you to deal with it when you don't have thread-safe pread().

Earlier, we were forced to patch Makefile. I used the following patch:

--- evil/Makefile
+++ good/Makefile
@@ -961,6 +961,7 @@
     HAVE_PATHS_H = YesPlease
     LIBC_CONTAINS_LIBINTL = YesPlease
     HAVE_DEV_TTY = YesPlease
+    NO_THREAD_SAFE_PREAD = YesPlease
 endif
 ifeq ($(uname_S),GNU/kFreeBSD)
     NO_STRLCPY = YesPlease

Then Git developers drastically changed their Makefile, so the current solution is:

# NO_THREAD_SAFE_PREAD fixes "cannot clone any remote repos" (index-pack failed) regression, produced
# by commit b8a2486f1524947f232f657e9f2ebf ("index-pack: support multithreaded delta resolving")
sed -i 's/# Define NO_THREAD_SAFE_PREAD if/NO_THREAD_SAFE_PREAD = YesPlease  #/' ./Makefile

sed -i 's/# Define HAVE_PATHS_H if/HAVE_PATHS_H = YesPlease  #/' ./Makefile
sed -i 's/# Define NO_GETTEXT if/NO_GETTEXT = YesPlease  #/' ./Makefile
sed -i 's/# Define NO_CROSS_DIRECTORY_HARDLINKS if/NO_CROSS_DIRECTORY_HARDLINKS = YesPlease  #/' ./Makefile
sed -i 's/# Define NO_INSTALL_HARDLINKS if/NO_INSTALL_HARDLINKS = YesPlease  #/' ./Makefile

Note: passing NO_THREAD_SAFE_PREAD to ‘make’ wouldn't work:

make NO_THREAD_SAFE_PREAD=Yes NO_INSTALL_HARDLINKS=Yes

Problems with autotools

macro ‘AM_xxx’ not found / possibly undefined

If you stumbled upon something like this:

warning: macro `AM_INIT_AUTOMAKE' not found in library
warning: macro `AM_CONDITIONAL' not found in library
...
configure.ac: error: possibly undefined macro: AM_INIT_AUTOMAKE

Then your autotools are broken somehow. At first, make sure to re-build the following packages, in that order:

  1. libtool
  2. m4
  3. autoconf, automake

Also, make sure to not to play with symbolic links etc. I've solved my

configure.ac:3: warning: macro 'AM_INIT_AUTOMAKE' not found in library
configure.ac:6: warning: macro 'AM_CONFIG_HEADER' not found in library
configure.ac:62: warning: macro 'AM_CONDITIONAL' not found in library
...

issues by commenting out (removing) the following in postcmds-automake:

    rm -f aclocal-*
    rm -f automake-*
    ln -s aclocal aclocal-"${automake_version}"
    ln -s automake automake-"${automake_version}"
    cd "${INSTALL_PATH}"/usr/share
    mv `find . -type d -name "automake-*" | head -1` automake 2>/dev/null
    mv `find . -type d -name "aclocal-*" | head -1` aclocal 2>/dev/null
    ln -s automake automake-"${automake_version}"
    ln -s aclocal aclocal-"${automake_version}"
    cd "${INSTALL_PATH}"/usr/share/man/man1
    rm -f automake-* aclocal-*

and postcmds-autoconf:

    ln -s autoconf autoconf-"${autoconf_version}"
    ln -s autoreconf autoreconf-"${autoconf_version}"
    ln -s autoheader autoheader-"${autoconf_version}"
    ln -s autom4te autom4te-"${autoconf_version}"
    ln -s autoscan autoscan-"${autoconf_version}"
    ln -s autoupdate autoupdate-"${autoconf_version}"
    ln -s ifnames ifnames-"${autoconf_version}"

(And, of course, re-build them both after that.)

"Please use exactly Autoconf 2.64 instead of x.yz."

(Originally: Please use exactly Autoconf 2.64 instead of 2.65.) No way, I will use sed -i 's/2.64/2.65/' config/override.m4 instead. Never force people to use ancient versions of software just because you (or RHEL, or whatever) do.

The universal solution for any autoconf version you have:

# never force people to use ancient versions of software just because you (or RHEL, or Obama The President, or whatever) do
sed -i '/dnl Ensure exactly this Autoconf version is used/d' ./config/override.m4
autoconf_version=`autoconf -V | grep "autoconf" | tr ' ' '\n' | tail -1`
sed -i "s/2.64/${autoconf_version}/g" ./config/override.m4

NOTE: this is known to work for binutils. For other packages (complaining like binutils), just grep the source tree for "Please use exactly".

GCC

GCC and GMP, MPFR, MPC

It is recommended to build and install 'gmp', 'mpfr' and 'mpc' separately from GCC.

About some ./configure options for GCC

--disable-nls
Disable Native Language Support (NLS), so GCC output is in American English only.
--with-system-zlib
Use installed ‘zlib’ rather than that included with GCC.
--disable-checking
Disable internal consistency checks. This does not change the generated code, but adds error checking within the compiler. Disabling assertions will make the compiler and runtime slightly faster but increase the risk of undetected internal errors causing wrong code to be generated.
--disable-werror
Controls whether certain files in the compiler are built without -Werror in bootstrap stage2 and later.
--disable-multilib
Specify that multiple target libraries to support different target variants, calling conventions, etc. should not be built.
--disable-libssp
Specify that the run-time libraries for stack smashing protection should not be built.
--enable-shared
Build shared versions of libraries (libgcc, libstdc++, etc.).
--enable-threads=single
Disable thread support, should work for all platforms.
--disable-tls
Specify that the target does not support Thread Local Storage.
--disable-__cxa_atexit
Don't use __cxa_atexit (use atexit instead) to register C++ destructors for local statics and global objects. __cxa_atexit is currently only available on systems with GNU libc.
--enable-linker-build-id
Pass --build-id option to the linker for all links performed without the -r (or --relocatable) option.
--disable-gnu-unique-object
Don't use the gnu_unique_object relocation for C++ template static data members and inline function local statics.
--disable-libunwind-exceptions
Don't use libunwind, to avoid undefined reference to `_Unwind_GetIPInfo'.

"Official" GCC git repositories

git://git.infradead.org/toolchain/gcc.git

Post from mailing list.

git://gcc.gnu.org/git/gcc.git

Article from GCC Wiki.

Important: build libtool right after GCC

You'll need to re-build libtool each time after you bootstrap new version of GCC. It's because libtool uses hard-coded GCC-related paths.

binutils

binutils vs texinfo

Note: binutils refuses to build without 'cmp' (from diffutils; also available in busybox) and 'makeinfo' (from texinfo), so you can install them first.

If you still get the error message "WARNING: ‘makeinfo’ is missing on your system." and you're sure that makeinfo is properly installed on your path, try
$ makeinfo --version
If your makeinfo version is 4.11 or higher, then you may have encountered a well-known ‘binutils’ bug. In short, the build scripts incorrectly thinks 4.11 is an older version than 4.4. If you are sure that you have a correct version of makeinfo, then you can manually remove this broken check. In binutils' Makefile, find MAKEINFO = <...>/missing makeinfo and change it to MAKEINFO = /usr/bin/makeinfo. Also you can fix build scripts:

     if ${MAKEINFO} --version \
-       | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])' >/dev/null 2>&1; then
+       | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.([2-9]|[1-9][0-9])|[5-9])' >/dev/null 2>&1; then

Another solution, which doesn't require any texinfo's ‘makeinfo’ (if you don't want to install texinfo):

echo '#!/bin/sh' > /usr/bin/makeinfo
echo 'if [ "$1" = "--version" ]; then echo "makeinfo (GNU texinfo) 4.10"; fi' >> /usr/bin/makeinfo
chmod +x /usr/bin/makeinfo

How to (re)build binutils to remove libgcc_s.so.1 dependency from ld

./configure binutils with --disable-shared --enable-static and build with make AM_LDFLAGS="-all-static".

SBU

The time it takes to compile Binutils is what is referred to as the Standard Build Unit (SBU) in LFS book. So, on my PowerPC 7400 466.666665MHz 'time make' prints

real     18m 51.57s
user     13m 53.34s
sys      2m 4.43s

OpenSSH

If you choose not to use OpenSSH on Unix, the following free SSH implementations are available for interoperating with OpenSSH:

  • OSSH is an SSH1-only implementation. BSD Licence. Björn Grönvall was the original person to remind our community that very old versions of the real ssh had a free licence. This is his own implementation, based on the old Tatu code. OpenSSH was based on an early version of OSSH, but OpenSSH added SSH2 and extended the SSH1 protocol support.
  • Dropbear is a small SSH2 server-only implementation written by Matt Johnston. It is available under a MIT-style license.
  • LSH/psst is an SSH2-only implementation, by Niels Möller in Sweden, GPL Licence.

OpenSSL

Upgrading OpenSSL

After an upgrade of OpenSSL package to the newer version, make sure to create links for old .so files (libssl.so.x.x.x and libcrypto.so.x.x.x). For example:

cd /usr/lib
ln -s libssl.so.1.0.0 libssl.so.0.9.8
ln -s libcrypto.so.1.0.0 libcrypto.so.0.9.8

Otherwise, some packages (built with old version of openssl), will refuse to run.

Wget

wget 1.13 vs OpenSSL

This version loves GNU TLS, but not OpenSSL (that's good). But even without --with-ssl specified explicitly, ./configure fails with:

configure: error: --with-ssl was given, but GNUTLS is not available.

wget and texinfo

There is absolutely no need for 'texinfo' to build wget, period. Unless of course you're using development sources, rather than release sources. Even there, it's pretty straightforward to build without it. After doing 'autogen' and 'configure', just go directly into src/ and do a make there. I'd do the "make install" within src/, too, but really you could just copy wget to /usr/bin (or wherever).
Guess you'd also need to go into lib, and md5, and make in those places too. If you continue to run into problems, it might be well just to replace the "all" and "install" targets in doc/Makefile with empty targets or something.

Subversion

It requires a lot. First of all, arp and arp-util libraries ("Apache Portable Runtime Library"; the base portability library and a number of helpful abstractions on top of ‘libapr’). Then sqlite.
But even when svn has been successfully built with all those dependencies met, you will have… no support for http:// subversion repositories (like the subversion repo itself, hmm)!
Solution is to choose from libneon or libserf. At first, I tried the first one. It builds perfectly, configured with --without-webdav and nothing about XML (it is really not required for libneon, absolutely)…
What have I got? Working (also with HTTP) subversion? Nope! "configure: error: cannot find Neon" at svn configure stage!

configure: Apache Portable Runtime (APR) library configuration
checking for APR... yes
checking APR version... 1.4.5
configure: Apache Portable Runtime Utility (APRUTIL) library configuration
checking for APR-util... yes
checking APR-UTIL version... 1.3.12
checking for pkg-config... /usr/bin/pkg-config
configure: checking neon library
checking neon library version... 0.29.6
configure: error: cannot find Neon
ERROR: './configure' error. Abort.

Also, one script inside svn's tarball does use ancient snake-2 syntax (as opposed to modern python 3 syntax). But there's a trivial fix:

# fix wrong (python2-specific) syntax
sed -i 's/IOError, e/IOError as e/' ./build/getversion.py

htop

htop requres ncurses to be built with wide-characters support (see --enable-widec option for ncurses).

It also complains about "gnu-style" malloc/realloc (rpl_malloc, rpl_realloc). As always, the workaround is:

export ac_cv_func_malloc_0_nonnull=yes
export ac_cv_func_realloc_0_nonnull=yes

before running ./configure.

pkgconfig v0.26 versus glib

As stated in ./NEWS:

pkg-config 0.26
===
...
- Drop embedded glib

pkgconfig package now depends on another package to be installed before building — glib.
Otherwise, build will fail on ./configure stage:

checking for pkg-config... pkg-config
configure: error: pkg-config and glib-2.0 not found, please set GLIB_CFLAGS and GLIB_LIBS to the correct values

Considering this removal of embedded glib, it looks like pkgconfig devs do think that glib is installed everywhere ;-) Well, we have two choices: to stuck with v0.25 (which is impossible for Manulix), or get that glib. LFS team has a nice how-to about this topic. Gnome dev center too. The latter also says:

The two tools needed during the build process (as differentiated from the tools used in when creating GLib mentioned above such as autoconf) are pkg-config and GNU make.

Heh, very nice. Another "chicken and egg", which makes it harder to bootstrap new systems "from scratch".

bootstrap failure: AutoGen requires autogen to bootstrap

Take autogen sources from get repo (git://git.savannah.gnu.org/autogen.git) to build it, and enjoy the requirement to already have it installed before building it. Chicken and egg story.
bootstrap (originally located inside ./config/) performs a check for AutoGen version 5.*.
The solution is to get "released" tarball (official site: http://www.gnu.org/software/autogen/, tarballs: http://ftp.gnu.org/gnu/autogen/) and to build and to install it first.

Guile 2.0

Guile package now requires the following libraries:

Guile also complains about "gnu-style malloc", where calling malloc(0) returns not NULL, but a scary pointer to something(!?!?): guile-v2.0.0.builddir/libguile/<stdout>:2163: undefined reference to `rpl_malloc'. Workaround is to export the following variables before running autoreconf:

export ac_cv_func_malloc_0_nonnull=yes
export ac_cv_func_realloc_0_nonnull=yes

GPM (General Purpose Mouse daemon)

To build GPM, you'll need gpm.h header, which is included in GPM. (Circular reference.) So, to bootstrap GPM, the easiest solution would be:

[ -f /usr/include/gpm.h ] || cp ./src/headers/gpm.h /usr/include/

libiconv

You should install the gettext package at the same time (!) as libiconv due to a circular dependency that is present between the two.
To bootstrap libiconv+gettext, build (1) libiconv, then (2) gettext, then (3) libiconv again.

Mercurial

Note: mercurial still requires python 2.x (>=2.4), but not 3.x. This is considered impossible for Manulix to have multiple versions of the same package, especially for ancient versions which are kept alive (as in zombie) only due to inertia of RHEL and other "corporate" (read: "slowpoke") users.

So again: there will be no parallel install of Python2 in Manulix.

See also: http://mercurial.selenic.com/wiki/Py3kPort

cd mercurial-build
curr_wd=`pwd`
mkdir -p "${curr_wd}"/DEST/usr
# correct, no ./configure and make, just this command
make install-home-bin HOME="${curr_wd}/DEST/usr"
sys_python_path=`stat -c %n /usr/lib/python* | sort | tail -1`
cd "${curr_wd}"/DEST/usr/lib
mv python `basename "${sys_python_path}"`

man-1.6f: configuring

sed -i 's/DEFAULTLESSOPT="-is"/DEFAULTLESSOPT=""/' configure
./configure +fhs +lang none

Note: groff package is required for man.

e2fsprogs

You'll need a patch to build e2fsprogs. Fixed in cc84d86 -> 1d18a55.
Note: your uClibc must have been built with UCLIBC_HAS_FTW=y (and probably UCLIBC_HAS_NFTW=y too), otherwise e2fsprogs will complain on "ftw.h".

./configure --prefix=/usr --sysconfdir=/etc --with-root-prefix="" \
--build=powerpc-gnu-linux-uclibc --host=powerpc-gnu-linux-uclibc --target=powerpc-gnu-linux-uclibc \
--disable-nls --enable-elf-shlibs --disable-tls --disable-resizer --disable-imager \
--disable-rpath --enable-fsck #--enable-verbose-makecmds
make ## make check
mkdir DEST ; make install DESTDIR=`pwd`/DEST && make install-libs DESTDIR=`pwd`/DEST
cd DEST
rmdir usr/share/info
/sstrip-ET_EXECs.sh

Dependencies: e2fsprogs depends on pkg-config. yaboot depends on e2fsprogs.

Building module-init-tools

aclocal -I m4
automake --add-missing --copy
autoconf
./configure --prefix=/ --sysconfdir=/etc --mandir=/usr/share/man
##--build=... --host=... --target=...
make

Yep, an error:

if [ "docbook2man" = "docbook2man" ]; then                     \
        docbook2man ../doc/modprobe.conf.sgml > /dev/null 2>&1;                       \
    else                                                               \
        docbook2man ../doc/modprobe.conf.sgml 2>&1 > modprobe.conf.5 | sed 's/^[^:]*://';              \
    fi
make[1]: *** [modprobe.conf.5] Error 127

Workaround: find the line dist_man_MANS = $(MAN5) $(MAN8) inside ./Makefile.am in vanilla tarball, and remove that line. Use sed -i to automate it: sed -i 's/dist_man_MANS = $(MAN5) $(MAN8)//' ./Makefile.am 2>/dev/null
(Or, for current build only, edit Makefile.in just before running the ./configure script. Remove the dist_man_MANS = $(MAN5) $(MAN8) line.)

Building flex

Flex complains about glibc behavior for malloc(0):

/flex-2.5.35/dfa.c:716: undefined reference to `rpl_realloc'
/flex-2.5.35/parse.c:1274: undefined reference to `rpl_malloc'

The workaround:

export ac_cv_func_malloc_0_nonnull=yes
export ac_cv_func_realloc_0_nonnull=yes
aclocal -I m4
automake --add-missing --copy
autoconf

./configure --prefix=/usr --sysconfdir=/etc \
--disable-nls --disable-rpath --with-gnu-ld

# checking for GNU libc compatible malloc... (cached) yes
# checking for GNU libc compatible realloc... (cached) yes
# ... oh yes! ...

Then 'make', etc.

How to ./configure ncurses (to also build ' libncurses.so.5')

./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man \
--build=powerpc-gnu-linux-uclibc --host=powerpc-gnu-linux-uclibc --target=powerpc-gnu-linux-uclibc \
--disable-nls --with-normal --with-shared --with-gpm --disable-termcap \
--enable-symlinks --without-debug --without-profile --without-ada

Using lynx

Don't forget to change 'Preferred encoding' to '[(1)None__]' in 'O'ptions screen.

Installing cowsay

How to build some old ncurses-based programs

cc -O -o sl sl.c -lcurses -ltermcap
/usr/lib/gcc/powerpc-gnu-linux-uclibc/4.4.2/../../../../powerpc-gnu-linux-uclibc/bin/ld: cannot find -ltermcap
collect2: ld returned 1 exit status
cc  -o nethack monst.o objects.o allmain.o alloc.o apply.o artifact.o attrib.o ball.o bones.o botl.o cmd.o dbridge.o decl.o detect.o dig.o display.o dlb.o do.o do_name.o do_wear.o dog.o dogmove.o dokick.o dothrow.o drawing.o dungeon.o eat.o end.o engrave.o exper.o explode.o extralev.o files.o fountain.o hack.o hacklib.o invent.o light.o lock.o mail.o makemon.o mapglyph.o mcastu.o mhitm.o mhitu.o minion.o mklev.o mkmap.o mkmaze.o mkobj.o mkroom.o mon.o mondata.o monmove.o monstr.o mplayer.o mthrowu.o muse.o music.o o_init.o objnam.o options.o pager.o pickup.o pline.o polyself.o potion.o pray.o priest.o quest.o questpgr.o read.o rect.o region.o restore.o rip.o rnd.o role.o rumors.o save.o shk.o shknam.o sit.o sounds.o sp_lev.o spell.o steal.o steed.o teleport.o timeout.o topten.o track.o trap.o u_init.o uhitm.o vault.o vision.o vis_tab.o weapon.o were.o wield.o windows.o wizard.o worm.o worn.o write.o zap.o  ioctl.o unixmain.o unixtty.o unixunix.o unixres.o getline.o termcap.o topl.o wintty.o version.o -ltermlib 
/usr/lib/gcc/powerpc-gnu-linux-uclibc/4.7.1/../../../../powerpc-gnu-linux-uclibc/bin/ld: cannot find -ltermlib
collect2: error: ld returned 1 exit status
make[1]: *** [Sysunix] Error 1

libtermcap and libtermlib are obsoleted by libncurses. Just create in /usr/lib links 'libtermcap.so' and 'libtermlib.so' pointing to 'libncurses.so' (ln -s libncurses.so libtermlib.so) or even better — replace all occurrences of -ltermcap and -ltermlib with -lncurses, examples:

  • sed -i -e 's/-ltermcap/-lncurses/' -e 's/-ltermlib/-lncurses/' ./Makefile
  • sed -i 's/ltermlib/lncurses/' ./src/Makefile.
Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.