glibc upgrade error: gawk: error while loading shared libraries: /lib64/libm.so.6: invalid ELF header - glibc

I am trying to path CVE-2015-7547 which base on glibc2.22, everything is good but getting make install error
My linux version: 2.6.32.43
Upgrade glibc-2.12 to glibc-2.22
glibc-2.22> mkdir build
glibc-2.22/build> cat config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by GNU C Library configure (see version.h), which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ../configure --enable-languages=c,c++ --with-arch_32=i686 --build=x86_64-redhat-linux --prefix=/usr
...
make is done
But make install:
...
/usr/bin/install -c -m 644 bits/math-finite.h /usr/include/bits/math-finite.h
/usr/bin/install -c -m 644 ../sysdeps/x86/fpu/bits/math-vector.h /usr/include/bits/math-vector.h
/usr/bin/install -c -m 644 ../bits/libm-simd-decl-stubs.h /usr/include/bits/libm-simd-decl-stubs.h
/usr/bin/install -c -m 644 ../sysdeps/ieee754/ieee754.h /usr/include/ieee754.h
(echo '/* GNU ld script'; echo '*/';\
cat /home/xxxx/data/test/glibc-2.22/build/format.lds; \
echo 'GROUP ( /lib64/libm.so.6 ' \
'AS_NEEDED ( /lib64/libmvec.so.1 ) )' \
) > /usr/lib64/libm.so
/usr/bin/install -c /home/xxxx/data/test/glibc-2.22/build/math/libm.so /lib64/libm-2.22.so.new
mv -f /lib64/libm-2.22.so.new /lib64/libm-2.22.so
echo `../scripts/rellns-sh -p /lib64/libm-2.22.so /lib64/libm.so.6` /lib64/libm.so.6 >> /home/qspace/data/test/glibc-2.22/build/elf/symlink.list
/usr/bin/install -c -m 644 /home/xxxx/data/test/glibc-2.22/build/math/libieee.a /usr/lib64/libieee.a
/usr/bin/install -c -m 644 /home/xxxx/data/test/glibc-2.22/build/math/libm.a /usr/lib64/libm.a
/usr/bin/install -c -m 644 /home/xxxx/data/test/glibc-2.22/build/gnu/lib-names-64.h /usr/include/gnu/lib-names-64.h
(cd /home/xxxx/data/test/glibc-2.22/build/math/.; /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../x86_64-unknown-linux-gnu/bin/objdump -h s_isinf.o s_isnan.o s_finite.o s_copysign.o s_modf.o s_scalbn.o s_frexp.o s_ldexp.o s_signbit.o s_isinff.o s_isnanf.o s_finitef.o s_copysignf.o s_modff.o s_scalbnf.o s_frexpf.o s_ldexpf.o s_signbitf.o s_isinfl.o s_isnanl.o s_finitel.o s_copysignl.o s_modfl.o s_scalbnl.o s_frexpl.o s_ldexpl.o s_signbitl.o setfpucw.o fpu_control.o s_isinf.os s_isnan.os s_finite.os s_copysign.os s_modf.os s_scalbn.os s_frexp.os s_ldexp.os s_signbit.os s_isinff.os s_isnanf.os s_finitef.os s_copysignf.os s_modff.os s_scalbnf.os s_frexpf.os s_ldexpf.os s_signbitf.os s_isinfl.os s_isnanl.os s_finitel.os s_copysignl.os s_modfl.os s_scalbnl.os s_frexpl.os s_ldexpl.os s_signbitl.os setfpucw.os fpu_control.os libieee.a ieee-math.o s_lib_version.o s_matherr.o s_signgam.o fclrexcpt.o fgetexcptflg.o fraiseexcpt.o fsetexcptflg.o ftestexcept.o fegetround.o fesetround.o fegetenv.o feholdexcpt.o fesetenv.o feupdateenv.o t_exp.o fedisblxcpt.o feenablxcpt.o fegetexcept.o powl_helper.o e_acos.o e_acosh.o e_asin.o e_atan2.o e_atanh.o e_cosh.o e_exp.o e_fmod.o e_hypot.o e_j0.o e_j1.o e_jn.o e_lgamma_r.o e_log.o e_log10.o e_pow.o e_rem_pio2.o e_remainder.o e_scalb.o e_sinh.o e_sqrt.o e_gamma_r.o e_ilogb.o k_cos.o k_rem_pio2.o k_sin.o k_tan.o s_asinh.o s_atan.o s_cbrt.o s_ceil.o s_cos.o s_erf.o s_expm1.o s_fabs.o s_floor.o s_log1p.o w_log1p.o s_logb.o s_nextafter.o s_nexttoward.o s_rint.o s_scalbln.o w_scalbln.o s_significand.o s_sin.o s_tan.o s_tanh.o w_acos.o w_acosh.o w_asin.o w_atan2.o w_atanh.o w_cosh.o w_drem.o w_exp.o w_exp2.o w_exp10.o w_fmod.o w_tgamma.o w_hypot.o w_j0.o w_j1.o w_jn.o w_lgamma.o w_lgamma_r.o w_log.o w_log10.o w_pow.o w_remainder.o w_scalb.o w_sinh.o w_sqrt.o w_ilogb.o s_fpclassify.o s_fmax.o s_fmin.o s_fdim.o s_nan.o s_trunc.o s_remquo.o e_log2.o e_exp2.o s_round.o s_nearbyint.o s_sincos.o conj.o cimag.o creal.o cabs.o carg.o s_cexp.o s_csinh.o s_ccosh.o s_clog.o s_catan.o s_casin.o s_ccos.o s_csin.o s_ctan.o s_ctanh.o s_cacos.o s_casinh.o s_cacosh.o s_catanh.o s_csqrt.o s_cpow.o s_cproj.o s_clog10.o s_fma.o s_lrint.o s_llrint.o s_lround.o s_llround.o e_exp10.o w_log2.o s_isinf_ns.o s_issignaling.o m_isinf.o m_isnan.o m_finite.o m_copysign.o m_modf.o m_scalbn.o m_frexp.o m_ldexp.o m_signbit.o x2y2m1.o k_casinh.o gamma_product.o k_standard.o e_acosf.o e_acoshf.o e_asinf.o e_atan2f.o e_atanhf.o e_coshf.o e_expf.o e_fmodf.o e_hypotf.o e_j0f.o e_j1f.o e_jnf.o e_lgammaf_r.o e_logf.o e_log10f.o e_powf.o e_rem_pio2f.o e_remainderf.o e_scalbf.o e_sinhf.o e_sqrtf.o e_gammaf_r.o e_ilogbf.o k_cosf.o k_rem_pio2f.o k_sinf.o k_tanf.o s_asinhf.o s_atanf.o s_cbrtf.o s_ceilf.o s_cosf.o s_erff.o s_expm1f.o s_fabsf.o s_floorf.o s_log1pf.o w_log1pf.o s_logbf.o s_nextafterf.o s_nexttowardf.o s_rintf.o s_scalblnf.o w_scalblnf.o s_significandf.o s_sinf.o s_tanf.o s_tanhf.o w_acosf.o w_acoshf.o w_asinf.o w_atan2f.o w_atanhf.o w_coshf.o w_dremf.o w_expf.o w_exp2f.o w_exp10f.o w_fmodf.o w_tgammaf.o w_hypotf.o w_j0f.o w_j1f.o w_jnf.o w_lgammaf.o w_lgammaf_r.o w_logf.o w_log10f.o w_powf.o w_remainderf.o w_scalbf.o w_sinhf.o w_sqrtf.o w_ilogbf.o s_fpclassifyf.o s_fmaxf.o s_fminf.o s_fdimf.o s_nanf.o s_truncf.o s_remquof.o e_log2f.o e_exp2f.o s_roundf.o s_nearbyintf.o s_sincosf.o conjf.o cimagf.o crealf.o cabsf.o cargf.o s_cexpf.o s_csinhf.o s_ccoshf.o s_clogf.o s_catanf.o s_casinf.o s_ccosf.o s_csinf.o s_ctanf.o s_ctanhf.o s_cacosf.o s_casinhf.o s_cacoshf.o s_catanhf.o s_csqrtf.o s_cpowf.o s_cprojf.o s_clog10f.o s_fmaf.o s_lrintf.o s_llrintf.o s_lroundf.o s_llroundf.o e_exp10f.o w_log2f.o s_isinf_nsf.o s_issignalingf.o m_isinff.o m_isnanf.o m_finitef.o m_copysignf.o m_modff.o m_scalbnf.o m_frexpf.o m_ldexpf.o m_signbitf.o x2y2m1f.o k_casinhf.o gamma_productf.o k_standardf.o e_acosl.o e_acoshl.o e_asinl.o e_atan2l.o e_atanhl.o e_coshl.o e_expl.o e_fmodl.o e_hypotl.o e_j0l.o e_j1l.o e_jnl.o e_lgammal_r.o e_logl.o e_log10l.o e_powl.o e_rem_pio2l.o e_remainderl.o e_scalbl.o e_sinhl.o e_sqrtl.o e_gammal_r.o e_ilogbl.o k_cosl.o k_rem_pio2l.o k_sinl.o k_tanl.o s_asinhl.o s_atanl.o s_cbrtl.o s_ceill.o s_cosl.o s_erfl.o s_expm1l.o s_fabsl.o s_floorl.o s_log1pl.o w_log1pl.o s_logbl.o s_nextafterl.o s_nexttowardl.o s_rintl.o s_scalblnl.o w_scalblnl.o s_significandl.o s_sinl.o s_tanl.o s_tanhl.o w_acosl.o w_acoshl.o w_asinl.o w_atan2l.o w_atanhl.o w_coshl.o w_dreml.o w_expl.o w_exp2l.o w_exp10l.o w_fmodl.o w_tgammal.o w_hypotl.o w_j0l.o w_j1l.o w_jnl.o w_lgammal.o w_lgammal_r.o w_logl.o w_log10l.o w_powl.o w_remainderl.o w_scalbl.o w_sinhl.o w_sqrtl.o w_ilogbl.o s_fpclassifyl.o s_fmaxl.o s_fminl.o s_fdiml.o s_nanl.o s_truncl.o s_remquol.o e_log2l.o e_exp2l.o s_roundl.o s_nearbyintl.o s_sincosl.o conjl.o cimagl.o creall.o cabsl.o cargl.o s_cexpl.o s_csinhl.o s_ccoshl.o s_clogl.o s_catanl.o s_casinl.o s_ccosl.o s_csinl.o s_ctanl.o s_ctanhl.o s_cacosl.o s_casinhl.o s_cacoshl.o s_catanhl.o s_csqrtl.o s_cpowl.o s_cprojl.o s_clog10l.o s_fmal.o s_lrintl.o s_llrintl.o s_lroundl.o s_llroundl.o e_exp10l.o w_log2l.o s_isinf_nsl.o s_issignalingl.o m_isinfl.o m_isnanl.o m_finitel.o m_copysignl.o m_modfl.o m_scalbnl.o m_frexpl.o m_ldexpl.o m_signbitl.o x2y2m1l.o k_casinhl.o gamma_productl.o k_standardl.o t_sincosl.o k_sincosl.o branred.o doasin.o dosincos.o halfulp.o mpa.o mpatan2.o mpatan.o mpexp.o mplog.o mpsqrt.o mptan.o sincos32.o slowexp.o slowpow.o sincostab.o s_floor-c.o s_ceil-c.o s_floorf-c.o s_ceilf-c.o s_rint-c.o s_rintf-c.o s_nearbyint-c.o s_nearbyintf-c.o e_exp-fma4.o e_log-fma4.o e_pow-fma4.o s_atan-fma4.o e_asin-fma4.o e_atan2-fma4.o s_sin-fma4.o s_tan-fma4.o mplog-fma4.o mpa-fma4.o slowexp-fma4.o slowpow-fma4.o sincos32-fma4.o doasin-fma4.o dosincos-fma4.o halfulp-fma4.o mpexp-fma4.o mpatan2-fma4.o mpatan-fma4.o mpsqrt-fma4.o mptan-fma4.o e_exp-avx.o e_log-avx.o s_atan-avx.o e_atan2-avx.o s_sin-avx.o s_tan-avx.o mplog-avx.o mpa-avx.o slowexp-avx.o mpexp-avx.o s_lib_version.os s_matherr.os s_signgam.os fclrexcpt.os fgetexcptflg.os fraiseexcpt.os fsetexcptflg.os ftestexcept.os fegetround.os fesetround.os fegetenv.os feholdexcpt.os fesetenv.os feupdateenv.os t_exp.os fedisblxcpt.os feenablxcpt.os fegetexcept.os powl_helper.os e_acos.os e_acosh.os e_asin.os e_atan2.os e_atanh.os e_cosh.os e_exp.os e_fmod.os e_hypot.os e_j0.os e_j1.os e_jn.os e_lgamma_r.os e_log.os e_log10.os e_pow.os e_rem_pio2.os e_remainder.os e_scalb.os e_sinh.os e_sqrt.os e_gamma_r.os e_ilogb.os k_cos.os k_rem_pio2.os k_sin.os k_tan.os s_asinh.os s_atan.os s_cbrt.os s_ceil.os s_cos.os s_erf.os s_expm1.os s_fabs.os s_floor.os s_log1p.os w_log1p.os s_logb.os s_nextafter.os s_nexttoward.os s_rint.os s_scalbln.os w_scalbln.os s_significand.os s_sin.os s_tan.os s_tanh.os w_acos.os w_acosh.os w_asin.os w_atan2.os w_atanh.os w_cosh.os w_drem.os w_exp.os w_exp2.os w_exp10.os w_fmod.os w_tgamma.os w_hypot.os w_j0.os w_j1.os w_jn.os w_lgamma.os w_lgamma_r.os w_log.os w_log10.os w_pow.os w_remainder.os w_scalb.os w_sinh.os w_sqrt.os w_ilogb.os s_fpclassify.os s_fmax.os s_fmin.os s_fdim.os s_nan.os s_trunc.os s_remquo.os e_log2.os e_exp2.os s_round.os s_nearbyint.os s_sincos.os conj.os cimag.os creal.os cabs.os carg.os s_cexp.os s_csinh.os s_ccosh.os s_clog.os s_catan.os s_casin.os s_ccos.os s_csin.os s_ctan.os s_ctanh.os s_cacos.os s_casinh.os s_cacosh.os s_catanh.os s_csqrt.os s_cpow.os s_cproj.os s_clog10.os s_fma.os s_lrint.os s_llrint.os s_lround.os s_llround.os e_exp10.os w_log2.os s_isinf_ns.os s_issignaling.os m_isinf.os m_isnan.os m_finite.os m_copysign.os m_modf.os m_scalbn.os m_frexp.os m_ldexp.os m_signbit.os x2y2m1.os k_casinh.os gamma_product.os k_standard.os e_acosf.os e_acoshf.os e_asinf.os e_atan2f.os e_atanhf.os e_coshf.os e_expf.os e_fmodf.os e_hypotf.os e_j0f.os e_j1f.os e_jnf.os e_lgammaf_r.os e_logf.os e_log10f.os e_powf.os e_rem_pio2f.os e_remainderf.os e_scalbf.os e_sinhf.os e_sqrtf.os e_gammaf_r.os e_ilogbf.os k_cosf.os k_rem_pio2f.os k_sinf.os k_tanf.os s_asinhf.os s_atanf.os s_cbrtf.os s_ceilf.os s_cosf.os s_erff.os s_expm1f.os s_fabsf.os s_floorf.os s_log1pf.os w_log1pf.os s_logbf.os s_nextafterf.os s_nexttowardf.os s_rintf.os s_scalblnf.os w_scalblnf.os s_significandf.os s_sinf.os s_tanf.os s_tanhf.os w_acosf.os w_acoshf.os w_asinf.os w_atan2f.os w_atanhf.os w_coshf.os w_dremf.os w_expf.os w_exp2f.os w_exp10f.os w_fmodf.os w_tgammaf.os w_hypotf.os w_j0f.os w_j1f.os w_jnf.os w_lgammaf.os w_lgammaf_r.os w_logf.os w_log10f.os w_powf.os w_remainderf.os w_scalbf.os w_sinhf.os w_sqrtf.os w_ilogbf.os s_fpclassifyf.os s_fmaxf.os s_fminf.os s_fdimf.os s_nanf.os s_truncf.os s_remquof.os e_log2f.os e_exp2f.os s_roundf.os s_nearbyintf.os s_sincosf.os conjf.os cimagf.os crealf.os cabsf.os cargf.os s_cexpf.os s_csinhf.os s_ccoshf.os s_clogf.os s_catanf.os s_casinf.os s_ccosf.os s_csinf.os s_ctanf.os s_ctanhf.os s_cacosf.os s_casinhf.os s_cacoshf.os s_catanhf.os s_csqrtf.os s_cpowf.os s_cprojf.os s_clog10f.os s_fmaf.os s_lrintf.os s_llrintf.os s_lroundf.os s_llroundf.os e_exp10f.os w_log2f.os s_isinf_nsf.os s_issignalingf.os m_isinff.os m_isnanf.os m_finitef.os m_copysignf.os m_modff.os m_scalbnf.os m_frexpf.os m_ldexpf.os m_signbitf.os x2y2m1f.os k_casinhf.os gamma_productf.os k_standardf.os e_acosl.os e_acoshl.os e_asinl.os e_atan2l.os e_atanhl.os e_coshl.os e_expl.os e_fmodl.os e_hypotl.os e_j0l.os e_j1l.os e_jnl.os e_lgammal_r.os e_logl.os e_log10l.os e_powl.os e_rem_pio2l.os e_remainderl.os e_scalbl.os e_sinhl.os e_sqrtl.os e_gammal_r.os e_ilogbl.os k_cosl.os k_rem_pio2l.os k_sinl.os k_tanl.os s_asinhl.os s_atanl.os s_cbrtl.os s_ceill.os s_cosl.os s_erfl.os s_expm1l.os s_fabsl.os s_floorl.os s_log1pl.os w_log1pl.os s_logbl.os s_nextafterl.os s_nexttowardl.os s_rintl.os s_scalblnl.os w_scalblnl.os s_significandl.os s_sinl.os s_tanl.os s_tanhl.os w_acosl.os w_acoshl.os w_asinl.os w_atan2l.os w_atanhl.os w_coshl.os w_dreml.os w_expl.os w_exp2l.os w_exp10l.os w_fmodl.os w_tgammal.os w_hypotl.os w_j0l.os w_j1l.os w_jnl.os w_lgammal.os w_lgammal_r.os w_logl.os w_log10l.os w_powl.os w_remainderl.os w_scalbl.os w_sinhl.os w_sqrtl.os w_ilogbl.os s_fpclassifyl.os s_fmaxl.os s_fminl.os s_fdiml.os s_nanl.os s_truncl.os s_remquol.os e_log2l.os e_exp2l.os s_roundl.os s_nearbyintl.os s_sincosl.os conjl.os cimagl.os creall.os cabsl.os cargl.os s_cexpl.os s_csinhl.os s_ccoshl.os s_clogl.os s_catanl.os s_casinl.os s_ccosl.os s_csinl.os s_ctanl.os s_ctanhl.os s_cacosl.os s_casinhl.os s_cacoshl.os s_catanhl.os s_csqrtl.os s_cpowl.os s_cprojl.os s_clog10l.os s_fmal.os s_lrintl.os s_llrintl.os s_lroundl.os s_llroundl.os e_exp10l.os w_log2l.os s_isinf_nsl.os s_issignalingl.os m_isinfl.os m_isnanl.os m_finitel.os m_copysignl.os m_modfl.os m_scalbnl.os m_frexpl.os m_ldexpl.os m_signbitl.os x2y2m1l.os k_casinhl.os gamma_productl.os k_standardl.os t_sincosl.os k_sincosl.os branred.os doasin.os dosincos.os halfulp.os mpa.os mpatan2.os mpatan.os mpexp.os mplog.os mpsqrt.os mptan.os sincos32.os slowexp.os slowpow.os sincostab.os s_floor-c.os s_ceil-c.os s_floorf-c.os s_ceilf-c.os s_rint-c.os s_rintf-c.os s_nearbyint-c.os s_nearbyintf-c.os e_exp-fma4.os e_log-fma4.os e_pow-fma4.os s_atan-fma4.os e_asin-fma4.os e_atan2-fma4.os s_sin-fma4.os s_tan-fma4.os mplog-fma4.os mpa-fma4.os slowexp-fma4.os slowpow-fma4.os sincos32-fma4.os doasin-fma4.os dosincos-fma4.os halfulp-fma4.os mpexp-fma4.os mpatan2-fma4.os mpatan-fma4.os mpsqrt-fma4.os mptan-fma4.os e_exp-avx.os e_log-avx.os s_atan-avx.os e_atan2-avx.os s_sin-avx.os s_tan-avx.os mplog-avx.os mpa-avx.os slowexp-avx.os mpexp-avx.os) | \
gawk '/\.gnu\.glibc-stub\./ { \
sub(/\.gnu\.glibc-stub\./, "", $2); \
stubs[$2] = 1; } \
END { for (s in stubs) print "#define __stub_" s }' > /home/xxxx/data/test/glibc-2.22/build/math/stubsT
gawk: error while loading shared libraries: /lib64/libm.so.6: invalid ELF header
make[2]: *** [/home/xxxx/data/test/glibc-2.22/build/math/stubs] Error 127
make[2]: Leaving directory `/data/xxxx/data/test/glibc-2.22/math'
make[1]: *** [math/subdir_install] Error 2
make[1]: Leaving directory `/data/xxxx/data/test/glibc-2.22'
make: *** [install] Error 2
and the old /lib64/libm-2.12.so content was changed and wrong.
/home/xxxx/data/test/glibc-2.22/build> cat /lib64/libm-2.12.so
/* GNU ld script
*/
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /lib64/libm.so.6 AS_NEEDED ( /lib64/libmvec.so.1 ) )
/home/xxxx/data/test/glibc-2.22/build>
The cause of this error seems to be the old libm-2.12. So changed it and the new not set property, which step went wrong?
Any suggestion is appreciated.

I ran into the same problem. I have my own Linux build and package management system, which is probably unusual. However, essentially my glibc package process is similar to building from source and then installing. I can build a new patched glibc at the same version number without any issues at all. The package system upgrade results in overwriting the original files without removing them first, since the package manifests are identical. All I need to do is restart init. I also reboot as well. My scenario for creating a new glibc package is specific to my situation though, so I won't go into details. This is how I handled CVE-2015-7547.
Updating glibc when the version number changes is more difficult. You should try installing with DESTDIR in the install targets, like this:
make DESTDIR=/tmp/stage install
There are more steps of course. Once you have glibc installed in a staging directory, you need to replace your current glibc files with the new ones properly. You need to do this without ripping out the old glibc files first. I was able to do this by hand for testing purposes by creating my own tar archive of the files in the staging directory. Exactly how to do this is beyond the scope of my answer right now, but I thought I would mention using DESTDIR like this. I am working on exact instructions for doing this on my system, but those would be specific to me in some respects. More information about DESTDIR can be found here.

Related

tinydtls configuration in Contiki

I am currently trying to configure tinydtls as described in the README in order to later include it into an application, or at least, make the examples run.
The first steps, including the resulting warnings:
home/name/contiki/apps/tinydtls$ autoreconf
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
home/name/contiki/apps/tinydtls$ ./configure --with-contiki
home/name/contiki/apps/tinydtls$ make
with both TARGET=native and TARGET=zoul
The compilation always ends with (many) undefined reference errors:
obj_zoul/dtls.o: In function dtls_add_ecdsa_signature_elem':
dtls.c:(.text.dtls_add_ecdsa_signature_elem+0x10): undefined reference to `dtls_ec_key_from_uint32_asn1'
dtls_ec_key_from_uint32_asn1 is located in contiki/apps/tinydtls/crypto.c.
Adding #include crypto.h in dtls.c doesn't fix the problem, but #include crypto.c does (fix this first error). Accordingly I assume the problem must have to do something with the linking.
How should the Makefile, of which I pasted a (hopefully significant) part under this question, be adjusted?
SHELL = /bin/sh
MKDIR = mkdir
ETAGS = /bin/false
prefix = /usr/local
exec_prefix = ${prefix}
abs_builddir = /home/name/contiki/apps/tinydtls
top_builddir = .
libdir = ${exec_prefix}/lib
includedir = ${prefix}/include/tinydtls
package = tinydtls-0.8.2
install := cp
# files and flags
SOURCES:= dtls.c crypto.c ccm.c hmac.c netq.c peer.c dtls_time.c session.c
ifneq ("", "1")
SOURCES += debug.c
endif
SUB_OBJECTS:=aes/rijndael.o ecc/ecc.o sha2/sha2.o
OBJECTS:= $(patsubst %.c, %.o, $(SOURCES)) $(SUB_OBJECTS)
HEADERS:=dtls.h hmac.h debug.h dtls_config.h uthash.h numeric.h crypto.h global.h ccm.h \
netq.h t_list.h alert.h utlist.h prng.h peer.h state.h dtls_time.h session.h \
tinydtls.h
CFLAGS:=-Wall -pedantic -std=c99
CPPFLAGS:= -DDTLSv12 -DWITH_SHA256 -DDTLS_CHECK_CONTENTTYPE
SUBDIRS:=tests doc platform-specific sha2 aes ecc
DISTSUBDIRS:=$(SUBDIRS) examples/contiki
DISTDIR=$(top_builddir)/$(package)
FILES:=Makefile.in configure configure.in dtls_config.h.in tinydtls.h.in \
Makefile.tinydtls $(SOURCES) $(HEADERS)
LIB:=libtinydtls.a
LDFLAGS:=
ARFLAGS:=cru
doc:=doc
Edit: Changed the directory for this post to /home/name/...
Edit2: Added warnings after 'autoreconf'.

Yocto How to overwrite a file of linux rootfs depending on an IMAGE-recipe?

I'm trying to add a simple line in fstab within
the final rootfs that Yocto builds.
My first approach was to add my own fstab in my layer meta-mylayer/recipes-core/base-files/base-files/fstab and the proper meta-mylayer/recipes-core/base-files/base-files/base-files_%.bbappend which only have the following line:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
And it works, but as the title of my question says, i want to modify fstab based on the recipe-image i want to build i.e. dev-image & prod-image.
After some investigation i think i have 2 options
Modify fstab within the recipe image, extending the do_install task...
dev-image.bb
--------------
DESCRIPTION = "Development Image"
[...]
inherit core-image
do_install_append () {
echo "======= Modifying fstab ========"
cat >> ${D}${sysconfdir}/fstab <<EOF
# The line i want to Add
EOF
}
[...]
--------------
Problem is that i'm actually not seeing my modified line in my final /etc/fstab and bitbake is not showing any build error or warning about this, actually, i'm not even able to see the echo-trace i put.
My second attempt was to handle these modifications with packages and depending on the recipe-image i will be able to add the package for *-dev or *-prod. This idea was taken from Oleksandr Poznyak in this answer in summary he suggest the following:
1) Create *.bbappend recipe base-files_%s.bbappend in your layer. It
appends to poky "base-files" recipe.
2) Create your own "python do_package_prepend" function where you should
make your recipe produce two different packages
3) Add them to DEPENDS in your image recipe
And based on his example i made my own recipe:
base-files_%.bbappend
-------------------------
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://fstab-dev \
file://fstab-prod \
"
PACKAGES += " ${PN}-dev ${PN}-prod"
CONFFILES_${PN}-dev = "${CONFFILES_${PN}}"
CONFFILES_${PN}-prod = "${CONFFILES_${PN}}"
pkg_preinst_${PN}-dev = "${pkg_preinst_${PN}}"
pkg_preinst_${PN}-prod = "${pkg_preinst_${PN}}"
RREPLACES_${PN}-dev = "${PN}"
RPROVIDES_${PN}-dev = "${PN}"
RCONFLICTS_${PN}-dev = "${PN}"
RREPLACES_${PN}-prod = "${PN}"
RPROVIDES_${PN}-prod = "${PN}"
RCONFLICTS_${PN}-prod = "${PN}"
python populate_packages_prepend() {
import shutil
packages = ("${PN}-dev", "${PN}-prod")
for package in packages:
# copy ${PN} content to packages
shutil.copytree("${PKGD}", "${PKGDEST}/%s" % package, symlinks=True)
# replace fstab
if package == "${PN}-dev":
shutil.copy("${WORKDIR}/fstab-dev", "${PKGDEST}/${PN}-dev/etc/fstab")
else:
shutil.copy("${WORKDIR}/fstab-prod", "${PKGDEST}/${PN}-prod/etc/fstab")
}
-------------------------
And in my recipe-image(dev-image.bb) i added base-files-dev packet
dev-image.bb
--------------
DESCRIPTION = "Development Image"
[...]
inherit core-image
IMAGE_INSTALL = " \
${MY_PACKETS} \
base-files-dev \
"
[...]
--------------
Problem with this, is that i'm not familiarized with phyton indentation so probably i'm messing things up, the error log shows as follows.
DEBUG: Executing python function populate_packages
ERROR: Error executing a python function in exec_python_func() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:populate_packages(d)
0003:
File: '/home/build/share/build_2/../sources/poky/meta/classes/package.bbclass', lineno: 1138, function: populate_packages
1134:
1135: workdir = d.getVar('WORKDIR')
1136: outdir = d.getVar('DEPLOY_DIR')
1137: dvar = d.getVar('PKGD')
*** 1138: packages = d.getVar('PACKAGES').split()
1139: pn = d.getVar('PN')
1140:
1141: bb.utils.mkdirhier(outdir)
1142: os.chdir(dvar)
File: '/usr/lib/python3.6/shutil.py', lineno: 315, function: copytree
0311: destination path as arguments. By default, copy2() is used, but any
0312: function that supports the same signature (like copy()) can be used.
0313:
0314: """
*** 0315: names = os.listdir(src)
0316: if ignore is not None:
0317: ignored_names = ignore(src, names)
0318: else:
0319: ignored_names = set()
Exception: FileNotFoundError: [Errno 2] No such file or directory: '${PKGD}'
DEBUG: Python function populate_packages finished
DEBUG: Python function do_package finished
I will really appreciate any clue or sort of direction, i'm not an Yocto expert so maybe the options that i suggest are not the most elegant and probably there is a better way to do it, so be free to give me any recommendation.
Thank you very much.
UPDATE:
As always, i was not the only one trying this, the way that i make it work was thanks this answer the only inconvenience with this is that you need to rm what you want to install through a .bbappend but for now is fine for me.
I also tried to do the same with bbclasses, which for me, it is a more elegant wayto do it, but i failed... i got the following error
ERROR: base-files-dev-3.0.14-r89 do_packagedata: The recipe base-files-dev is trying to install files into a shared area when those files already exist. Those files and their manifest location are:
I tried to rm fstab within the .bbappend but the same error is showed
Maybe somebody will share what i'm doing wrong...
If you don't find this post valuable please remove...
Your recipe which base on Oleksandr doesn't work due to dropped support for variables expansion in newer Poky.
https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#migration-2.1-variable-expansion-in-python-functions
Error explicit says:
Exception: FileNotFoundError: [Errno 2] No such file or directory: '${PKGD}'
It didn't expand the variable.
P.S.
This is not a proper answer to Your question but SO blocks comments.

Yocto/Bitbake recipe for adding empty directory to rootfs Embedded Linux

Is there any recipe for adding a new, empty directory to the rootfs? I tried adding this into one of my bbappend file:
do_install() {
install -d ${D}/tmp/myNewDir
}
FILES_${PN} += "/tmp/myNewDir"
but I am getting a non descriptive error, Function failed: do_install
There are several ways. The image command way is already described by StackedUser.
You can also try to extend some of your recipes (as you are doing in your question). I guess that you are seeing the error because you are overwriting the do_install task. You are probably wanting to extend it, so you should add _append to the task name, i.e.:
do_install_append () {
install -d ${D}/tmp/myNewDir
}
BTW, the error "Function failed: do_install" you are hitting usually show an error code or a problematic command. Maybe there is something.
Another way is to create a simple recipe and add it to the image, here is a stub:
SUMMARY = "XXX project directory structure"
# FIXME - add proper license below
LICENSE = "CLOSED"
PV = "1.0"
S = "${WORKDIR}"
inherit allarch
do_install () {
install -d ${D}/foo/bar
}
FILES_${PN} = "/foo/bar"
In our image recipe we have something like this to create a new directory:
create_data_dir() {
mkdir -p ${IMAGE_ROOTFS}/data
}
IMAGE_PREPROCESS_COMMAND += "create_data_dir;"

undefined reference to__aeabi_ldivmod when building kernel for arm32

When building one kernel image for arm32 platform, in the final linking, the error is:
arm-eabi-ld -EL -p --no-undefined -X --build-id -o .tmp_vmlinux1 -T obj/KERNEL/arch/arm/kernel/vmlinux.lds arch/arm/kernel/head.o init/built-in.o --start-group usr/built-in.o arch/arm/vfp/built-in.o arch/arm/kernel/built-in.o arch/arm/mm/built-in.o arch/arm/common/built-in.o arch/arm/net/built-in.o arch/arm/crypto/built-in.o arch/arm/mach-sc/built-in.o kernel/built-in.o mm/built-in.o fs/built-in.o ipc/built-in.o security/built-in.o crypto/built-in.o block/built-in.o arch/arm/lib/lib.a lib/lib.a arch/arm/lib/built-in.o lib/built-in.o drivers/built-in.o sound/built-in.o firmware/built-in.o arch/arm/oprofile/built-in.o net/built-in.o --end-group
drivers/built-in.o:
undefined reference to `__aeabi_ldivmod'
make[2]: *** [vmlinux] Error 1
I know the reason is my using 64bit divison for arm32 which 64bit is not supported, and using do_div() can get rid of the __aeabi_ldivmod error. I know __aeabi_ldivmod is defined in the libgcc.a, so I added the following code in my Kernel Makefile:
--- a/Makefile
+++ b/Makefile
## -677,6 +677,7 ##
LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
$(call cc-ldoption, -Wl$(comma)--build-id,))
KBUILD_LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
+LDFLAGS_vmlinux += -L$(MY_LIBPATH) -lgcc
But it still can't work, so can anybody help on my questions:
1) Why the libgcc.a is not linked default in the kernel building?
2) How to link the libgcc.a to fix the link error?
[Update]
OK, I found the following note for -lgcc in OSDev wiki:
-lgcc
You disable the important libgcc library when you pass -nodefaultlibs (implied by -nostdlib). The compiler needs this library for many operations that it cannot do itself or that is more efficient to put into a shared function. You must pass this library near the end of the link line, after all the other object files and libraries, or the linker won't use it and you get strange linker errors.
So I hard coded -L${MYLIB_PATH} -lgcc into into scripts/link-vmlinux.sh:
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
## -55,7 +55,7 ## vmlinux_link()
if [ "${SRCARCH}" != "um" ]; then
${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \
-T ${lds} ${KBUILD_VMLINUX_INIT} \
- --start-group ${KBUILD_VMLINUX_MAIN} --end-group ${1}
+ --start-group ${KBUILD_VMLINUX_MAIN} --end-group ${1} -L${MYLIB_PATH} -lgcc
else
${CC} ${CFLAGS_vmlinux} -o ${2} \
-Wl,-T,${lds} ${KBUILD_VMLINUX_INIT} \
Then the build went without __aeabi_ldivmod error.
While I want to find the better modifying than just harding coding and to know why kernel doesn't link libgcc default.
Don't edit scripts/link-vmlinux.sh, edit only certain Makefiles. For example if you have this error:
drivers/power/reset/msm-poweroff.c:249: undefined reference to `lge_set_restart_reason'
run cscope -R inside top of linux kernel source code directory, then find global definition for lge_set_restart_reason, it finds file definition in include/soc/qcom/lge/lge_handle_panic.h
But lge_handle_panic.h has only definition of lge_set_restart_reason, you need lge_handle_panic.c, which has this function, looking like this:
void lge_set_restart_reason(unsigned int reason)
{
writel_relaxed(reason, RESTART_REASON);
if(use_hardreset) {
qpnp_pon_set_restart_reason(map_imem_reboot_to_pmic(reason));
qpnp_pon_system_pwr_off(PON_POWER_OFF_HARD_RESET);
}
}
so you need to edit drivers/power/reset/Makefile to include lge_handle_panic.o object file:
obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o lge_handle_panic.o
In custom kernels, a lot of functions is enabled by config, what I mean is:
#ifdef CONFIG_LGE_HANDLE_PANIC
static void __iomem *msm_timer0_base;
void __iomem *wdt_timer_get_timer0_base(void)
{
return msm_timer0_base;
}
static void wdt_timer_set_timer0_base(void __iomem * iomem)
{
msm_timer0_base = iomem;
}
#endif
You need enable CONFIG_LGE_HANDLE_PANIC, or any config if you have again this error, or remove "ifdef" and "endif" (I'm not recommending doing this)

gmake fails immediately in PASE

I'm a security officer on this iSeries, using PASE (Portable Application Security Environment -- essentially a virtual AIX-like sandbox on OS/400) to compile Ghostscript 9.05. I've downloaded and installed RPM for AIX in my PASE environment, and then used the RPMs for gcc (gcc-4.0.0-1.aix5.3.ppc) and the rest of a standard GNU dev environment to install them on PASE, as well. Configure works fine (within /QOpenSys/usr/bin/-sh, I use CALL QP2TERM to get there), but when I then attempt gmake (make defaults to cc instead of gcc here), it fails immediately with:
$ pwd
/QOpenSys/download/ghostscript-9.05/ghostscript-9.05
$ gmake
Makefile:1: *** missing separator. Stop.
I read the previous question on this, and purged my Makefile.in of comments and ran it through cat -vet Makefile.in. Results are included below; they look fine to me, but I still receive the error above. (Note that this was pulled from a 5250 emulator session; line breaks in the display do not correlate with Makefile.in line breaks, which are shown as a $ instead):
$ cat -vet Makefile.in
BINDIR=./$(BUILDDIRPREFIX)bin$
GLSRCDIR=./base$
GLGENDIR=./$(BUILDDIRPREFIX)#OBJDIR_BSDMAKE_WORKAROUND#$
GLOBJDIR=./$(BUILDDIRPREFIX)#OBJDIR_BSDMAKE_WORKAROUND#$
AUXDIR=$(GLGENDIR)/aux$
PSSRCDIR=./psi$
PSLIBDIR=./lib$
PSRESDIR=./Resource$
PSGENDIR=./$(BUILDDIRPREFIX)#OBJDIR_BSDMAKE_WORKAROUND#$
PSOBJDIR=./$(BUILDDIRPREFIX)#OBJDIR_BSDMAKE_WORKAROUND#$
CONTRIBDIR=./contrib$
include $(GLSRCDIR)/version.mak$
DD=$(GLGENDIR)/$
GLD=$(GLGENDIR)/$
PSD=$(PSGENDIR)/$
INSTALL = $(GLSRCDIR)/instcopy -c$
INSTALL_PROGRAM = $(INSTALL) -m 755$
INSTALL_DATA = $(INSTALL) -m 644$
INSTALL_SHARED = #INSTALL_SHARED#$
prefix = #prefix#$
exec_prefix = #exec_prefix#$
bindir = #bindir#$
scriptdir = $(bindir)$
includedir = #includedir#$
libdir = #libdir#$
mandir = #mandir#$
man1ext = 1$
man1dir = $(mandir)/man$(man1ext)$
datadir = #datadir#$
datarootdir = #datarootdir#$
gsdir = #datadir#/ghostscript$
gsdatadir = $(gsdir)/$(GS_DOT_VERSION)$
gssharedir = #libdir#/ghostscript/$(GS_DOT_VERSION)$
gsincludedir = #includedir#/ghostscript/$
docdir=$(gsdatadir)/doc$
exdir=$(gsdatadir)/examples$
GS_DOCDIR=$(docdir)$
CUPSCFLAGS=#CUPSCFLAGS#$
CUPSLIBS=#CUPSLIBS#$
CUPSLIBDIRS=#CUPSLIBDIRS#$
CUPSSERVERBIN=#CUPSSERVERBIN#$
CUPSSERVERROOT=#CUPSSERVERROOT#$
CUPSDATA=#CUPSDATA#$
CUPSPDFTORASTER=#CUPSPDFTORASTER#$
CUPSINSTTARGET=#CUPSINSTALL#$
COMPILE_INITS=#COMPILE_INITS#$
GS_LIB_DEFAULT=$(gsdatadir)/Resource/Init:$(gsdatadir)/lib:$(gsdatadir)/Resou
rce/Font:$(gsdir)/fonts:#fontpath#$
GS_CACHE_DIR="~/.ghostscript/cache/"$
SEARCH_HERE_FIRST=0$
GS_INIT=gs_init.ps$
GENOPT=$
CAPOPT= #HAVE_MKSTEMP# #HAVE_FILE64# #HAVE_MKSTEMP64# #HAVE_FONTCONFIG# #HAVE
_LIBIDN# #HAVE_SETLOCALE# #HAVE_SSE2# #HAVE_DBUS# #HAVE_BSWAP32# #HAVE_BYTESW
AP_H#$
GS=#GS##EXEEXT#$
DEBUGDIRPREFIX=debug$
MEMENTODIRPREFIX=mem$
PGDIRPREFIX=pg$
FT_BRIDGE=#FT_BRIDGE#$
SHARE_FT=#SHARE_FT#$
FTSRCDIR=#FTSRCDIR#$
FT_CFLAGS=#FT_CFLAGS#$
FT_LIBS=#FT_LIBS#$
FT_CONFIG_SYSTEM_ZLIB=#FT_SYS_ZLIB#$
#INSERT_UFST_BRIDGE_EQUAL_ONE#$
UFST_ROOT=#UFST_ROOT#$
UFST_LIB_EXT=#UFST_LIB_EXT#$
UFST_ROMFS_ARGS?=-b \$
-P $(UFST_ROOT)/fontdata/mtfonts/pcl45/mt3/ -d fontdata/mtfonts/pcl45/mt3/ p
cl___xj.fco plug__xi.fco wd____xh.fco \$
-P $(UFST_ROOT)/fontdata/mtfonts/pclps2/mt3/ -d fontdata/mtfonts/pclps2/mt3/
pclp2_xj.fco \$
-c -P $(PSSRCDIR)/../lib/ -d Resource/Init/ FAPIconfig-FCO$
UFSTROMFONTDIR=\"%rom%fontdata/\"$
UFSTDISCFONTDIR?=\"$(UFST_ROOT)/fontdata/\"$
UFST_CFLAGS=#UFST_CFLAGS#$
JSRCDIR=#LIBJPEGDIR#$
SHARE_JPEG=#SHARE_LIBJPEG#$
JPEG_NAME=jpeg$
SHARE_LIBPNG=#SHARE_LIBPNG#$
PNGSRCDIR=#LIBPNGDIR#$
LIBPNG_NAME=png$
SHARE_LIBTIFF=#SHARE_LIBTIFF#$
TIFFSRCDIR=#LIBTIFFDIR#$
TIFFPLATFORM=unix$
TIFFCONFIG_SUFFIX=$
LIBTIFF_NAME=tiff$
SHARE_ZLIB=#SHARE_ZLIB#$
ZSRCDIR=#ZLIBDIR#$
ZLIB_NAME=z$
JBIG2_LIB=#JBIG2_DECODER#$
SHARE_JBIG2=#SHARE_JBIG2#$
JBIG2SRCDIR=#JBIG2DIR#$
JBIG2_CFLAGS=#JBIG2_AUTOCONF_CFLAGS#$
JPX_LIB=#JPX_DECODER#$
SHARE_JPX=#SHARE_JPX#$
JPXSRCDIR=#JPXDIR#$
JPX_CFLAGS=#JPX_AUTOCONF_CFLAGS#$
ICCSRCDIR=icclib$
SHARE_LCMS=#SHARELCMS#$
LCMSSRCDIR=#LCMSDIR#$
LCMS2SRCDIR=#LCMS2DIR#$
LCMS_CFLAGS=#LCMS_ENDIAN#$
LCMS2_CFLAGS=#LCMS2_ENDIAN#$
WHICH_CMS=#WHICHLCMS#$
SHARE_IJS=#SHAREIJS#$
IJS_NAME=#IJSLIB#$
IJSSRCDIR=#IJSDIR#$
IJSEXECTYPE=unix$
SHARE_LCUPS=#SHARELCUPS#$
LCUPS_NAME=cups$
LCUPSSRCDIR=cups$
LCUPSBUILDTYPE=#LCUPSBUILDTYPE#$
CUPS_CC=$(CC)$
SHARE_LCUPSI=#SHARELCUPSI#$
LCUPSI_NAME=cupsimage$
LCUPSISRCDIR=cups$
CUPS_CC=$(CC)$
AR=ar$
ARFLAGS=qc$
RANLIB=#RANLIB#$
CC=#CC#$
CCAUX=#CC#$
CCLD=$(CC)$
CCAUXLD=$(CCAUX)$
GCFLAGS=#CPPFLAGS# #GCFLAGS# #CFLAGS#$
CFLAGS_STANDARD=#OPT_CFLAGS#$
CFLAGS_DEBUG=#DBG_CFLAGS#$
CFLAGS_PROFILE=-pg #OPT_CFLAGS#$
CFLAGS_SO=#DYNAMIC_CFLAGS#$
AC_CFLAGS=#DYNAMIC_FLAGS#$
FONTCONFIG_CFLAGS=#FONTCONFIG_CFLAGS#$
FONTCONFIG_LIBS=#FONTCONFIG_LIBS#$
DBUS_CFLAGS=#DBUS_CFLAGS#$
DBUS_LIBS=#DBUS_LIBS#$
ACDEFS=#DEFS#$
CFLAGS=$(CFLAGS_STANDARD) $(GCFLAGS) $(AC_CFLAGS) $(XCFLAGS)$
AC_LDFLAGS=#X_LDFLAGS#$
LDFLAGS=#LDFLAGS# $(AC_LDFLAGS) $(XLDFLAGS)$
EXTRALIBS=$(XTRALIBS) #LIBS# #DYNAMIC_LIBS# #FONTCONFIG_LIBS# #FT_LIBS#$
STDLIBS=#PTHREAD_LIBS# -lm$
XINCLUDE=#X_CFLAGS#$
XLIBDIRS=#X_LDFLAGS#$
XLIBDIR=$
XLIBS=#X_LIBS#$
SYNC=#SYNC#$
RM=rm -f$
SOC_CFLAGS^I=^I#SOC_CFLAGS#$
SOC_LIBS^I=^I#SOC_LIBS#$
SOC_LOADER^I=^I#SOC_LOADER#$
FEATURE_DEVS=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev
$(PSD)epsf.dev $(GLD)pipe.dev $(GLD)gsnogc.dev $(GLD)htxlib.dev $(PSD)fapi.de
v #JBIG2DEVS# #JPXDEVS# #UTF8DEVS#$
FEATURE_DEVS_ALL=$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.
dev $(PSD)rasterop.dev $(PSD)double.dev $(PSD)trapping.dev $(PSD)stocht.dev $
(GLD)pipe.dev $(GLD)gsnogc.dev $(GLD)htxlib.dev #JBIG2DEVS# #JPXDEVS# #UTF8DE
VS#$
RESOURCE_LIST=Resource/CMap/ Resource/ColorSpace/ Resource/Decoding/ Resource
/Font/ Resource/ProcSet/ Resource/IdiomSet/ Resource/CIDFont/$
BAND_LIST_STORAGE=file$
BAND_LIST_COMPRESSOR=zlib$
FILE_IMPLEMENTATION=stdio$
STDIO_IMPLEMENTATION=c$
GS_DEV_DEFAULT="x11alpha bbox"$
DISPLAY_DEV=$(DD)bbox.dev$
DEVICE_DEVS=$(DISPLAY_DEV) #X11_DEVS#$
DEVICE_DEVS1=#F_DEVS#$
DEVICE_DEVS2=#P_DEVS#$
DEVICE_DEVS3=#CUPS_DEVS#$
DEVICE_DEVS4=#IJS_DEVS#$
DEVICE_DEVS5=#OMNIDEVS#$
DEVICE_DEVS6=#PNG_DEVS#$
DEVICE_DEVS7=#JBIG2_DEVS#$
DEVICE_DEVS8=#SVG_DEVS#$
DEVICE_DEVS9=$
DEVICE_DEVS10=$
DEVICE_DEVS11=$
DEVICE_DEVS12=$
DEVICE_DEVS13=$
DEVICE_DEVS14=$
DEVICE_DEVS15=$
DEVICE_DEVS16=$
DEVICE_DEVS17=$
DEVICE_DEVS18=$
DEVICE_DEVS19=$
DEVICE_DEVS20=$
DEVICE_DEVS21=$
GS_SHARED_OBJS=#DYNAMIC_DEVS#$
MAKEFILE=Makefile$
TOP_MAKEFILES=$(MAKEFILE) $(GLSRCDIR)/unixhead.mak$
AK=$
CCFLAGS=$(GENOPT) $(CAPOPT) $(CFLAGS)$
CC_=$(CC) $(CCFLAGS)$
CCAUX_=$(CCAUX) $(CFLAGS)$
CC_LEAF=$(CC_)$
CC_LEAF_PG=$(CC_)$
CC_NO_WARN=$(CC_)$
CCAUX_NO_WARN=$(CCAUX_)$
CC_SHARED=$(CC_) #DYNAMIC_CFLAGS#$
LD_SET_DT_SONAME=#SET_DT_SONAME#$
FOR_MAC=#SO_FOR_MAC#$
MAKEDIRS=| directories$
MAKEDIRSTOP=$
INSTALL_CONTRIB=#INSTALL_CONTRIB#$
include $(GLSRCDIR)/unixhead.mak$
include $(GLSRCDIR)/gs.mak$
include $(PSSRCDIR)/psromfs.mak$
include $(GLSRCDIR)/lib.mak$
include $(PSSRCDIR)/int.mak$
include $(GLSRCDIR)/freetype.mak$
include $(GLSRCDIR)/jpeg.mak$
include $(GLSRCDIR)/zlib.mak$
include $(GLSRCDIR)/png.mak$
include $(GLSRCDIR)/tiff.mak$
include $(GLSRCDIR)/jbig2.mak$
include $(GLSRCDIR)/jasper.mak$
include $(GLSRCDIR)/ldf_jb2.mak$
include $(GLSRCDIR)/lwf_jp2.mak$
include $(GLSRCDIR)/openjpeg.mak$
include $(GLSRCDIR)/icclib.mak$
include $(GLSRCDIR)/$(WHICH_CMS).mak$
include $(GLSRCDIR)/ijs.mak$
#LCUPSINCLUDE#$
#LCUPSIINCLUDE#$
include $(GLSRCDIR)/devs.mak$
include $(GLSRCDIR)/contrib.mak$
include $(GLSRCDIR)/unix-aux.mak$
include $(GLSRCDIR)/unixlink.mak$
include $(GLSRCDIR)/unix-dll.mak$
include $(GLSRCDIR)/unix-end.mak$
include $(GLSRCDIR)/unixinst.mak$
#CONTRIBINCLUDE#$
#CUPSINCLUDE#$
distclean : clean config-clean soclean pgclean debugclean$
^I-$(RM_) -r $(BINDIR) $(GLOBJDIR) $(PSOBJDIR) $(AUXDIR)$
^I-$(RM_) -r autom4te.cache$
^I-$(RM_) config.log config.status$
^I-$(RM_) Makefile$
^I#-rmdir $(BINDIR) $(GLOBJDIR) $(PSOBJDIR)$
^I-$(RM_) $(TIFFSRCDIR)$(D)libtiff$(D)tif_config.h $(TIFFSRCDIR)$(D)libtiff$(
D)tiffconf.h$
debug-clean : debugclean$
memento-clean : mementoclean$
maintainer-clean : distclean$
^I-$(RM_) configure.ac$
^I-$(RM_) configure$
^I-$(RM_) Makefile.in$
check : default$
^I$(NO_OP)$
Figured this out. Full details and steps to reproduce are here: http://hewhocutsdown.net/blog/2012/04/25/how-to-compile-ghostscript-for-pase/
It came down to three items:
Using gcc 4.2.0 instead of older versions.
Running configure with the –build=”powerpc-ibmaix5.3.0.0” option.
Apply an AIX-specific patch to opj_malloc.h (an OpenJPEG libray), patch here: http://openjpeg.googlecode.com/issues/attachment?aid=1390001000&name=Issue_139-AIX-memalign.patch&token=fTYKtT77eCQohWNtP2epWWxP2xQ%3A1335385237594
gmake most likely does not do any character conversion, so it just reads raw EBCDIC.
Check the CCSID on the IFS file is 819.
(My usual trick for creating an empty file is touch -C 819 file. Also if at all possible compile on native AIX)
What's the value of the environment variable BUILDDIRPREFIX? Should it end with a '/'?

Resources