mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-02-07 19:30:14 +00:00
Unbreak static cross-gdb.
GDB's configure mishandles the libexpat.{so,a} libraries when it is given -static in CFLAGS AND --with-libexpat-prefix in configure's args: it checks for <prefix>/lib/libexpat.so and finding that, attempts to link it as `gcc -static .. conftest.c <prefix>/lib/libexpat.so`; this obviously fails (.so cannot be statically linked), so configure assumes libexpat is unusable. Thus, --with-libexpat-prefix is dangerous and should be avoided; instead, configure should find the libraries via the supplied CC/LD definitions.
This commit is contained in:
parent
2c7f7cf847
commit
62d357d3c0
@ -69,7 +69,11 @@ do_debug_gdb_build() {
|
|||||||
|
|
||||||
cross_extra_config=("${extra_config[@]}")
|
cross_extra_config=("${extra_config[@]}")
|
||||||
cross_extra_config+=("--with-expat")
|
cross_extra_config+=("--with-expat")
|
||||||
cross_extra_config+=("--with-libexpat-prefix=${CT_HOST_COMPLIBS_DIR}")
|
# NOTE: DO NOT USE --with-libexpat-prefix (until GDB configure is smarter)!!!
|
||||||
|
# It conflicts with a static build: GDB's configure script will find the shared
|
||||||
|
# version of expat and will attempt to link that, despite the -static flag.
|
||||||
|
# The link will fail, and configure will abort with "expat missing or unusable"
|
||||||
|
# message.
|
||||||
case "${CT_THREADS}" in
|
case "${CT_THREADS}" in
|
||||||
none) cross_extra_config+=("--disable-threads");;
|
none) cross_extra_config+=("--disable-threads");;
|
||||||
*) cross_extra_config+=("--enable-threads");;
|
*) cross_extra_config+=("--enable-threads");;
|
||||||
@ -88,11 +92,11 @@ do_debug_gdb_build() {
|
|||||||
cross_extra_config+=("--disable-nls")
|
cross_extra_config+=("--disable-nls")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CC_for_gdb=
|
CC_for_gdb="${CT_HOST}-gcc ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST}"
|
||||||
LD_for_gdb=
|
LD_for_gdb="${CT_HOST}-ld ${CT_LDFLAGS_FOR_HOST}"
|
||||||
if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
|
if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
|
||||||
CC_for_gdb="${CT_HOST}-gcc -static"
|
CC_for_gdb+=" -static"
|
||||||
LD_for_gdb="${CT_HOST}-ld -static"
|
LD_for_gdb+=" -static"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Disable binutils options when building from the binutils-gdb repo.
|
# Disable binutils options when building from the binutils-gdb repo.
|
||||||
@ -162,6 +166,11 @@ do_debug_gdb_build() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
native_extra_config+=("--with-expat")
|
native_extra_config+=("--with-expat")
|
||||||
|
# NOTE: DO NOT USE --with-libexpat-prefix (until GDB configure is smarter)!!!
|
||||||
|
# It conflicts with a static build: GDB's configure script will find the shared
|
||||||
|
# version of expat and will attempt to link that, despite the -static flag.
|
||||||
|
# The link will fail, and configure will abort with "expat missing or unusable"
|
||||||
|
# message.
|
||||||
|
|
||||||
CT_DoLog EXTRA "Configuring native gdb"
|
CT_DoLog EXTRA "Configuring native gdb"
|
||||||
|
|
||||||
|
@ -509,6 +509,8 @@ if [ -z "${CT_RESTART}" ]; then
|
|||||||
CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_CFLAGS_FOR_HOST}"
|
CT_CFLAGS_FOR_HOST+=" ${CT_EXTRA_CFLAGS_FOR_HOST}"
|
||||||
CT_LDFLAGS_FOR_HOST=
|
CT_LDFLAGS_FOR_HOST=
|
||||||
CT_LDFLAGS_FOR_HOST+=" ${CT_EXTRA_LDFLAGS_FOR_HOST}"
|
CT_LDFLAGS_FOR_HOST+=" ${CT_EXTRA_LDFLAGS_FOR_HOST}"
|
||||||
|
CT_CFLAGS_FOR_HOST+=" -I${CT_HOST_COMPLIBS_DIR}/include"
|
||||||
|
CT_LDFLAGS_FOR_HOST+=" -L${CT_HOST_COMPLIBS_DIR}/lib"
|
||||||
CT_DoLog DEBUG "CFLAGS for host compiler: '${CT_CFLAGS_FOR_HOST}'"
|
CT_DoLog DEBUG "CFLAGS for host compiler: '${CT_CFLAGS_FOR_HOST}'"
|
||||||
CT_DoLog DEBUG "LDFLAGS for host compiler: '${CT_LDFLAGS_FOR_HOST}'"
|
CT_DoLog DEBUG "LDFLAGS for host compiler: '${CT_LDFLAGS_FOR_HOST}'"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user