From 1e4eeb5c3b0f9156ed679c4aed50ba5f97c3939b Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Thu, 31 Aug 2017 12:13:51 -0700 Subject: Workaround for static uClibc-ng issue with -lpthread Also, preserve .config when running test-package.sh. Signed-off-by: Alexey Neyman diff --git a/maintainer/test-packages.sh b/maintainer/test-packages.sh index 26caaf8..d6b84be 100755 --- a/maintainer/test-packages.sh +++ b/maintainer/test-packages.sh @@ -189,6 +189,8 @@ EOF CT_EndStep } +mv .config .config-saved . maintainer/package-versions +mv .config-saved .config rm -rf ${CT_TARBALLS_DIR} ${CT_COMMON_SRC_DIR} diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh index 6e9036f..5430341 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/gcc.sh @@ -233,7 +233,11 @@ do_cc_core_pass_2() { # later, we need to build libgcc case "${CT_THREADS}" in nptl) - core_opts+=( "mode=shared" ) + if [ "${CT_SHARED_LIBS}" = "y" ]; then + core_opts+=( "mode=shared" ) + else + core_opts+=( "mode=static" ) + fi core_opts+=( "build_libgcc=yes" ) ;; win32) @@ -873,10 +877,13 @@ do_gcc_backend() { fi done - [ "${CT_SHARED_LIBS}" = "y" ] || extra_config+=("--disable-shared") [ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}") [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") + if [ "${CT_SHARED_LIBS}" != "y" ]; then + extra_config+=("--disable-shared") + fi + case "${CT_CC_GCC_SJLJ_EXCEPTIONS}" in y) extra_config+=("--enable-sjlj-exceptions");; m) ;; diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh index 0cf58f3..a3cb87b 100644 --- a/scripts/build/libc/glibc.sh +++ b/scripts/build/libc/glibc.sh @@ -150,6 +150,9 @@ do_libc_backend_once() { ;; esac + # FIXME static version of glibc seems to be broken: + # build tries to use libc-modules.h which is generated from + # soversions.i, which is only created for builds with shared libs. case "${CT_SHARED_LIBS}" in y) extra_config+=("--enable-shared");; *) extra_config+=("--disable-shared");; @@ -308,42 +311,39 @@ do_libc_backend_once() { "${extra_make_args[@]}" \ install-headers - # For glibc, a few headers need to be manually installed - if [ "${CT_LIBC}" = "glibc" ]; then - # Two headers -- stubs.h and features.h -- aren't installed by install-headers, - # so do them by hand. We can tolerate an empty stubs.h for the moment. - # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html - mkdir -p "${CT_HEADERS_DIR}/gnu" - CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h" - CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc/include/features.h" \ - "${CT_HEADERS_DIR}/features.h" - - # Building the bootstrap gcc requires either setting inhibit_libc, or - # having a copy of stdio_lim.h... see - # http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html - CT_DoExecLog ALL cp -v bits/stdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h" - - # Following error building gcc-4.0.0's gcj: - # error: bits/syscall.h: No such file or directory - # solved by following copy; see http://sourceware.org/ml/crossgcc/2005-05/msg00168.html - # but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html - # Of course, only copy it if it does not already exist - case "${CT_ARCH}" in - arm) ;; - *) if [ -f "${CT_HEADERS_DIR}/bits/syscall.h" ]; then - CT_DoLog ALL "Not over-writing existing bits/syscall.h" - elif [ -f "misc/bits/syscall.h" ]; then - CT_DoExecLog ALL cp -v "misc/bits/syscall.h" \ - "${CT_HEADERS_DIR}/bits/syscall.h" - else - # "Old" glibces do not have the above file, - # but provide this one: - CT_DoExecLog ALL cp -v "misc/syscall-list.h" \ - "${CT_HEADERS_DIR}/bits/syscall.h" - fi - ;; - esac - fi + # Two headers -- stubs.h and features.h -- aren't installed by install-headers, + # so do them by hand. We can tolerate an empty stubs.h for the moment. + # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html + mkdir -p "${CT_HEADERS_DIR}/gnu" + CT_DoExecLog ALL touch "${CT_HEADERS_DIR}/gnu/stubs.h" + CT_DoExecLog ALL cp -v "${CT_SRC_DIR}/glibc/include/features.h" \ + "${CT_HEADERS_DIR}/features.h" + + # Building the bootstrap gcc requires either setting inhibit_libc, or + # having a copy of stdio_lim.h... see + # http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html + CT_DoExecLog ALL cp -v bits/stdio_lim.h "${CT_HEADERS_DIR}/bits/stdio_lim.h" + + # Following error building gcc-4.0.0's gcj: + # error: bits/syscall.h: No such file or directory + # solved by following copy; see http://sourceware.org/ml/crossgcc/2005-05/msg00168.html + # but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html + # Of course, only copy it if it does not already exist + case "${CT_ARCH}" in + arm) ;; + *) if [ -f "${CT_HEADERS_DIR}/bits/syscall.h" ]; then + CT_DoLog ALL "Not over-writing existing bits/syscall.h" + elif [ -f "misc/bits/syscall.h" ]; then + CT_DoExecLog ALL cp -v "misc/bits/syscall.h" \ + "${CT_HEADERS_DIR}/bits/syscall.h" + else + # "Old" glibces do not have the above file, + # but provide this one: + CT_DoExecLog ALL cp -v "misc/syscall-list.h" \ + "${CT_HEADERS_DIR}/bits/syscall.h" + fi + ;; + esac elif [ "${libc_mode}" = "final" -a -r "${multi_root}/.libc_headers_installed" ]; then CT_DoExecLog ALL rm -f "${multi_root}/.libc_headers_installed" fi # installing headers diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index 9c09b5e..cc216f9 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -164,9 +164,22 @@ CT_PREFIX_DIR="$( ${sed} -r -e 's:/+:/:g; s:/*$::;' <<<"${CT_PREFIX_DIR}" )" # Put user-supplied flags at the end, so that they take precedence. CT_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_TARGET_CFLAGS}" CT_TARGET_LDFLAGS="${CT_ARCH_TARGET_LDFLAGS} ${CT_TARGET_LDFLAGS}" + +# FIXME move to gcc.sh CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_CORE_EXTRA_CONFIG} "${CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY[@]}" ) CT_CC_GCC_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_EXTRA_CONFIG} "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" ) +# Starting with 1.0.20, applications using uClibc-ng do not link with +# the default libgcc_c_spec used by GCC if only static libc.a exists - unless +# -static is thrown in. The difference is that with -static, gcc passes +# "--start-group -lgcc -lc --end-group" and without -static, it passes +# "-lgcc -lc -lgcc" instead. The latter leaves a symbol from 2nd libgcc +# (dl_iterate_phdr) unresolved because -lc is already done at this point. +# Force static link on the target. +if [ "${CT_SHARED_LIBS}" != "y" ]; then + CT_TARGET_LDFLAGS+=" -static" +fi + # Compute the package version string if [ "${CT_SHOW_CT_VERSION}" = "y" ]; then CT_PKGVERSION="crosstool-NG ${CT_VERSION}${CT_TOOLCHAIN_PKGVERSION:+ - ${CT_TOOLCHAIN_PKGVERSION}}" diff --git a/scripts/functions b/scripts/functions index dde3eb7..b8b4913 100644 --- a/scripts/functions +++ b/scripts/functions @@ -318,10 +318,24 @@ CT_DoExecLog() { local level="$1" local cur_cmd local ret + local cmd_seen shift + ( for i in "$@"; do - cur_cmd+="'${i}' " + case "${i}" in + *=*) + if [ -z "${cmd_seen}" ]; then + cur_cmd+=" ${i%%=*}='${i#*=}'" + else + cur_cmd+=" '${i}'" + fi + ;; + *) + cur_cmd+=" '${i}'" + cmd_seen=y + ;; + esac done while true; do case "${1}" in -- cgit v0.10.2-6-g49f6