Skip to content

Commit

Permalink
debug/gdb: Add comments for untrivial flags.
Browse files Browse the repository at this point in the history
The necessity of --without-libexpat-prefix is not
obvious and needs comments.

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
  • Loading branch information
KirillSmirnov committed Sep 11, 2016
1 parent 5fd69f7 commit f64f561
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/build/debug/300-gdb.sh
Expand Up @@ -68,6 +68,10 @@ do_debug_gdb_build() {
cd "${CT_BUILD_DIR}/build-gdb-cross"

cross_extra_config=("${extra_config[@]}")

# For gdb-cross this combination of flags forces
# gdb configure to fall back to default '-lexpat' flag
# which is acceptable.
cross_extra_config+=("--with-expat")
cross_extra_config+=("--without-libexpat-prefix")

Expand Down Expand Up @@ -169,6 +173,16 @@ do_debug_gdb_build() {
native_extra_config+=("--with-curses")
fi

# Target libexpat resides in sysroot and does not have
# any dependencies, so just passing '-lexpat' to gcc is enough.
#
# By default gdb configure looks for expat in '$prefix/lib'
# directory. In our case '$prefix/lib' resolves to '/usr/lib'
# where libexpat for build platform lives, which is
# unacceptable for cross-compiling.
#
# To prevent this '--without-libexpat-prefix' flag must be passed.
# Thus configure falls back to '-lexpat', which is exactly what we want.
native_extra_config+=("--with-expat")
native_extra_config+=("--without-libexpat-prefix")

Expand Down

2 comments on commit f64f561

@stilor
Copy link
Contributor

@stilor stilor commented on f64f561 Sep 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still mention why --with-libexpat-prefix= does not work - old comment explained how that breaks static builds - we've already had that done once.

Other than that, thanks for the explanation. I am still a bit surprised that it looks at $prefix/lib rather than at ${CT_SYSROOT_DIR}$prefix/lib - after all, we do pass ${CT_SYSROOT_DIR} as the build sysroot. Having seen gdb's configure stupidity at using libexpat prefix, however, I could dismiss the possibility that gdb's configure is buggy though.

So, am I right that the test case is to place a bogus libexpat.so into host's /usr/lib?

@stilor
Copy link
Contributor

@stilor stilor commented on f64f561 Sep 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I might have a look at gdb's configure later - I want to know what test case was manifesting this bug)

Please sign in to comment.