=^.^=

Portage Errors: ld: cannot find -lpng12

karma

After upgrading libpng you may encounter this error when compiling packages that depend on it or related libraries:

/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lpng12
collect2: ld returned 1 exit status
make[2]: *** [librsvg-2.la] Error 1
make[2]: Leaving directory `/var/tmp/portage/gnome-base/librsvg-2.34.1-r1/work/librsvg-2.34.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/gnome-base/librsvg-2.34.1-r1/work/librsvg-2.34.1'
make: *** [all] Error 2
 * ERROR: gnome-base/librsvg-2.34.1-r1 failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of 'emerge --info =gnome-base/librsvg-2.34.1-r1',
 * the complete build log and the output of 'emerge -pqv =gnome-base/librsvg-2.34.1-r1'.
 * The complete build log is located at '/var/tmp/portage/gnome-base/librsvg-2.34.1-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/gnome-base/librsvg-2.34.1-r1/temp/environment'.
 * S: '/var/tmp/portage/gnome-base/librsvg-2.34.1-r1/work/librsvg-2.34.1'

Resolve by recompiling reverse dependencies:

# revdep-rebuild --library libpng12.so.0

Portage Errors: libcairo.la: No such file or directory

karma

To resolve:

/bin/grep: /usr/lib/libcairo.la: No such file or directory
/usr/bin/sed: can't read /usr/lib/libcairo.la: No such file or directory
libtool: link: `/usr/lib/libcairo.la' is not a valid libtool archive
make[2]: *** [librsvg-2.la] Error 1
make[2]: Leaving directory `/var/tmp/portage/gnome-base/librsvg-2.34.1-r1/work/librsvg-2.34.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/gnome-base/librsvg-2.34.1-r1/work/librsvg-2.34.1'
make: *** [all] Error 2
 * ERROR: gnome-base/librsvg-2.34.1-r1 failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of 'emerge --info =gnome-base/librsvg-2.34.1-r1',
 * the complete build log and the output of 'emerge -pqv =gnome-base/librsvg-2.34.1-r1'.
 * The complete build log is located at '/var/tmp/portage/gnome-base/librsvg-2.34.1-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/gnome-base/librsvg-2.34.1-r1/temp/environment'.
 * S: '/var/tmp/portage/gnome-base/librsvg-2.34.1-r1/work/librsvg-2.34.1'

Emerge lafilefixer if you do not already have it installed:

# emerge lafilefixer

Now run:

# lafilefixer --justfixit

Portage Errors: gcc must provide the cpuid.h header

karma

When compiling glibc or gcc you may encounter:

configure: error: gcc must provide the  header
 * ERROR: sys-libs/glibc-2.12.2 failed (compile phase):
 *   failed to configure glibc
 * 
 * Call stack:
 *           ebuild.sh, line   56:  Called src_compile
 *         environment, line 3723:  Called eblit-run 'src_compile'
 *         environment, line 1175:  Called eblit-glibc-src_compile
 *   src_compile.eblit, line  217:  Called toolchain-glibc_src_compile
 *   src_compile.eblit, line  128:  Called glibc_do_configure 'nptl'
 *   src_compile.eblit, line  104:  Called die
 * The specific snippet of code:
 *      "${S}"/configure ${myconf} || die "failed to configure glibc"

This is because your currently selected GCC profile is too old.

# gcc-config -l
 [1] i686-pc-linux-gnu-3.4.6
 [2] i686-pc-linux-gnu-3.4.6-hardened
 [3] i686-pc-linux-gnu-3.4.6-hardenednopie
 [4] i686-pc-linux-gnu-3.4.6-hardenednopiessp
 [5] i686-pc-linux-gnu-3.4.6-hardenednossp
 [6] i686-pc-linux-gnu-4.1.2 *
 [7] i686-pc-linux-gnu-4.3.4

# gcc-config 7 
 * Switching native-compiler to i686-pc-linux-gnu-4.3.4 ...
>>> Regenerating /etc/ld.so.cache...

 * If you intend to use the gcc from the new profile in an already
 * running shell, please remember to do:

 *   # source /etc/profile

# source /etc/profile

Now update your gcc (if applicable) and switch to its profile repeating the steps above:

# emerge --update gcc

Portage Errors: Cairo Fails to Compile on libiberty.h

karma

You may encounter the following error while compiling Cairo:

/usr/include/libiberty.h:589: error: expected declaration specifiers or '...' before numeric constant
/usr/include/libiberty.h:589: error: conflicting types for '__asprintf_chk'
/usr/include/bits/stdio2.h:135: error: previous declaration of '__asprintf_chk' was here
make[4]: *** [libcairo_trace_la-lookup-symbol.lo] Error 1
make[4]: Leaving directory `/var/tmp/portage/x11-libs/cairo-1.10.2-r1/work/cairo-1.10.2/util/cairo-trace'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/var/tmp/portage/x11-libs/cairo-1.10.2-r1/work/cairo-1.10.2/util'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/var/tmp/portage/x11-libs/cairo-1.10.2-r1/work/cairo-1.10.2/util'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/x11-libs/cairo-1.10.2-r1/work/cairo-1.10.2'
make: *** [all] Error 2
emake failed
 * ERROR: x11-libs/cairo-1.10.2-r1 failed (compile phase):
 *   emake failed
 *
 * Call stack:
 *     ebuild.sh, line   56:  Called src_compile
 *   environment, line 3089:  Called _eapi2_src_compile
 *     ebuild.sh, line  669:  Called die
 * The specific snippet of code:
 *              emake || die "emake failed"

This error is a result of how old versions of glibc behave when compiled with SSP. Temporarily remove -fstack-protector or -PIC from your CFLAGS and update glibc:

# emerge --update glibc gcc
# emerge cairo

Portage Errors: Package 'libpng12', required by 'cairo', not found

karma

If you recently updated libpng you may encounter the following error when compiling packages depending on cairo, such as librsvg:

Package 'libpng12', required by 'cairo', not found

Update cairo before proceeding:

# emerge --update --deep cairo