Message ID | 24f301216ef944e8d403.1370562034@nipigon.dssd.com |
---|---|
State | Rejected |
Headers | show |
On Thu, Jun 6, 2013 at 4:40 PM, Daniel Price <daniel.price@gmail.com> wrote: ... > Enable download and build of expat when cross-static gdb is requested > > Signed-off-by: Daniel Price <daniel.price@gmail.com> This patch, for me at least, solves my recent problems with expat and static cross-gdb. I don't know if this is really the right answer, but I thought I'd submit it for others to look at, and if needed, improve. I've tested building cross-gdb with and without the static option set but not e.g. with a wide range of architectures. I agree that, longer term, it seems like breaking expat out into a separate file would be the right thing to do. -dp -- Daniel.Price@gmail.com; Twitter: @danielbprice -- For unsubscribe information see http://sourceware.org/lists.html#faq
Daniel, On 6/6/13 4:40 PM, "Daniel Price" <daniel.price@gmail.com> wrote: ># HG changeset patch ># User Daniel Price <daniel.price@gmail.com> ># Date 1370561887 25200 ># Node ID 24f301216ef944e8d40350845d117a6da5eecdae ># Parent 2685dfa9de14fbe356ba76cb201bf5c039cf6860 >Enable download and build of expat when cross-static gdb is requested > >Signed-off-by: Daniel Price <daniel.price@gmail.com> > >diff -r 2685dfa9de14 -r 24f301216ef9 scripts/build/debug/300-gdb.sh >--- a/scripts/build/debug/300-gdb.sh Thu May 23 17:51:15 2013 +0200 >+++ b/scripts/build/debug/300-gdb.sh Thu Jun 06 16:38:07 2013 -0700 >@@ -16,6 +16,9 @@ > > if [ "${CT_GDB_CROSS}" = y ]; then > need_gdb_src=y >+ if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then >+ need_expat_src=y >+ fi > fi > > if [ "${CT_GDB_GDBSERVER}" = "y" ]; then >@@ -123,8 +126,21 @@ > cd "${CT_BUILD_DIR}/build-gdb-cross" > > cross_extra_config=("${extra_config[@]}") >+ >+ if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then >+ # Build libexpat >+ CT_DoLog EXTRA "Building static cross expat" >+ CT_mkdir_pushd >"${CT_BUILD_DIR}/build-expat-cross-${CT_TARGET}" (See note after the next note) >+ do_gdb_expat_backend host="" \ Shouldn't host="${CT_TARGET}" ? >+ prefix="${CT_BUILD_DIR}/static-cross" \ Since this build of expat is the same build as what is built for the native gdb, we should save some time and set the prefix to "${CT_BUILD_DIR}/static-target" and pushd to "${CT_BUILD_DIR}/build-ncurses-target-${CT_TARGET}". Then during native, in the same code section, before building expat, we could just check to see if it exists there and skip or build if it isn't. Just an idea ;) (cross-gdb builds before native-gdb, if you are building both) >+ cflags="" \ >+ ldflags="" >+ CT_Popd >+ >cross_extra_config+=("--with-libexpat-prefix=${CT_BUILD_DIR}/static-cross" >) >+ fi > cross_extra_config+=("--enable-expat") > cross_extra_config+=("--with-expat=yes") >+ > case "${CT_THREADS}" in > none) cross_extra_config+=("--disable-threads");; > *) cross_extra_config+=("--enable-threads");; > >-- >For unsubscribe information see http://sourceware.org/lists.html#faq I've started working on breaking out ncurses and expat from the debug/gdb script, but I feel that these changes should be incorporated before they are broken out. if [ x"$my_suggestions" == x"valid" ]; then echo "Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>" fi -Bryan -- For unsubscribe information see http://sourceware.org/lists.html#faq
On Thu, Jun 6, 2013 at 6:58 PM, Bryan Hundven <bryanhundven@gmail.com> wrote: ... > > (See note after the next note) > >>+ do_gdb_expat_backend host="" \ > > Shouldn't host="${CT_TARGET}" ? I set it to "" so that we'd build expat for the system we're building on... > >>+ prefix="${CT_BUILD_DIR}/static-cross" \ > > Since this build of expat is the same build as what is built for the > native gdb, we should save some time and set the prefix to > "${CT_BUILD_DIR}/static-target" and pushd to > "${CT_BUILD_DIR}/build-ncurses-target-${CT_TARGET}". > Then during native, in the same code section, before building expat, we > could just check to see if it exists there and skip or build if it isn't. > Just an idea ;) (cross-gdb builds before native-gdb, if you are building > both) Hi Bryan, thanks for the response-- Hmm. Now I'm worried that I don't understand the problem I set out to solve :) I thought that "native gdb" meant "a gdb cross-compiled to run on the target." Whereas I thought that cross-gdb meant "a gdb compiled to run on this host, targetted at a remote target." So for the first, we need a cross-compiled expat, and for the second we need one which is compiled for the (for lack of a better term) "host" system. I'm confused as to why we could reuse the same build of expat? Maybe I've missed something major here. Thanks again, -dp -- Daniel.Price@gmail.com; Twitter: @danielbprice -- For unsubscribe information see http://sourceware.org/lists.html#faq
Daniel, Bryan, All, On 2013-06-06 22:16 -0700, Daniel Price spake thusly: > On Thu, Jun 6, 2013 at 6:58 PM, Bryan Hundven <bryanhundven@gmail.com> wrote: > ... > > > > (See note after the next note) > > > >>+ do_gdb_expat_backend host="" \ > > > > Shouldn't host="${CT_TARGET}" ? This is expat for cross-gdb, not native gdb. So it's not CT_TARGET, but CT_HOST. > I set it to "" so that we'd build expat for the system we're building on... Since we're talking about expat for the cross-gdb, this is wrong. The toolchain may run on a system different from the system it was built on. Think canadian builds, for example, where: - toolchain is built on system A (eg. an x86) - toolchian runs on system B (eg. an PowerPC) - toolchain generates code for system C (eg. an ARM) In this case, you don't want to build expat for system A, but for system B. <rant> Sliding a bit on this topic, we could consider a canadian build to be the norm for a toolchain, and all other cases to be denormalised cases; for example, a cross-toolchain is just a canadian toolchain where build == host; a cross-native another special case where host == target; and a native where build == host == target. The fact that a canadian is more complex is just because it is not common (nowadays at least, it used to be more common long ago), and that native is the norm, cross is a slightly denormalised native, cross- native a relatively rare event, and canadian an exceptionally rare occurence. Life is life, we have to live it. ;-) </rant> > >>+ prefix="${CT_BUILD_DIR}/static-cross" \ > > > > Since this build of expat is the same build as what is built for the > > native gdb, we should save some time and set the prefix to > > "${CT_BUILD_DIR}/static-target" and pushd to > > "${CT_BUILD_DIR}/build-ncurses-target-${CT_TARGET}". > > Then during native, in the same code section, before building expat, we > > could just check to see if it exists there and skip or build if it isn't. > > Just an idea ;) (cross-gdb builds before native-gdb, if you are building > > both) > > Hi Bryan, thanks for the response-- > > Hmm. Now I'm worried that I don't understand the problem I set out to > solve :) I thought that "native gdb" meant "a gdb cross-compiled to > run on the target." Right. > Whereas I thought that cross-gdb meant "a gdb > compiled to run on this host, targetted at a remote target." Mostly. It's not "this host" but simply "the host" (see above, canadian builds). > So for > the first, we need a cross-compiled expat, Right, and we already have it. > and for the second we need > one which is compiled for the (for lack of a better term) "host" > system. Right. > I'm confused as to why we could reuse the same build of > expat? Maybe I've missed something major here. Thanks again, I think you got it right in your explanations. But since you missed the canadian build case, you missed that build != host in some cases. Regards, Yann E. MORIN. PS. Sorry for the delay in anserwing these days, I've a hard time finding enough time to handle real life, then do some computer-related things afterwards... :-/ YEM.
Daniel, On 2013-06-06 16:40 -0700, Daniel Price spake thusly: > # HG changeset patch > # User Daniel Price <daniel.price@gmail.com> > # Date 1370561887 25200 > # Node ID 24f301216ef944e8d40350845d117a6da5eecdae > # Parent 2685dfa9de14fbe356ba76cb201bf5c039cf6860 > Enable download and build of expat when cross-static gdb is requested > > Signed-off-by: Daniel Price <daniel.price@gmail.com> > > diff -r 2685dfa9de14 -r 24f301216ef9 scripts/build/debug/300-gdb.sh > --- a/scripts/build/debug/300-gdb.sh Thu May 23 17:51:15 2013 +0200 > +++ b/scripts/build/debug/300-gdb.sh Thu Jun 06 16:38:07 2013 -0700 > @@ -16,6 +16,9 @@ > > if [ "${CT_GDB_CROSS}" = y ]; then > need_gdb_src=y > + if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then > + need_expat_src=y > + fi > fi > > if [ "${CT_GDB_GDBSERVER}" = "y" ]; then > @@ -123,8 +126,21 @@ > cd "${CT_BUILD_DIR}/build-gdb-cross" > > cross_extra_config=("${extra_config[@]}") > + > + if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then > + # Build libexpat > + CT_DoLog EXTRA "Building static cross expat" > + CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-cross-${CT_TARGET}" > + do_gdb_expat_backend host="" \ As already pointed out, this should be host="${CT_HOST}". You could have seen it since it shall be the same host as for the gdb that is built a few lines below, no? ;-) > + prefix="${CT_BUILD_DIR}/static-cross" \ > + cflags="" \ > + ldflags="" > + CT_Popd > + cross_extra_config+=("--with-libexpat-prefix=${CT_BUILD_DIR}/static-cross") > + fi > cross_extra_config+=("--enable-expat") > cross_extra_config+=("--with-expat=yes") > + > case "${CT_THREADS}" in > none) cross_extra_config+=("--disable-threads");; > *) cross_extra_config+=("--enable-threads");; But in the end, I believe expat (and its development files) should be already available for host. For cross-toolchains, the host is your distro, so you should install the development package (eg. libexpat1-dev on Debian, others may differ slightly). For canadian-cross, it should be previously built by other means. I don't like adding more such dependencies, since they are easily available on common distros (candian is a special case, which should be handled appropriately, but if you are interested in canadian, you'd know what to do anyway). The fact that we have expat for the target is because we can't have a pre-existing expat since we *are* actively building the toolchain. Also, you will notice that we do *not* install expat in the sysroot. This is on purpose, because it is purely an internal library that is built only for our needs, and there's no reason to install it in the sysroot. It is expressly *not* part of the "system" libraries (which come only from the C library, and gcc's helper libs). So, unles you can prove me there are *very* good reasons to include this patch, I'll drop it, for the reasons explained above. Regards, Yann E. MORIN.
diff -r 2685dfa9de14 -r 24f301216ef9 scripts/build/debug/300-gdb.sh --- a/scripts/build/debug/300-gdb.sh Thu May 23 17:51:15 2013 +0200 +++ b/scripts/build/debug/300-gdb.sh Thu Jun 06 16:38:07 2013 -0700 @@ -16,6 +16,9 @@ if [ "${CT_GDB_CROSS}" = y ]; then need_gdb_src=y + if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then + need_expat_src=y + fi fi if [ "${CT_GDB_GDBSERVER}" = "y" ]; then @@ -123,8 +126,21 @@ cd "${CT_BUILD_DIR}/build-gdb-cross" cross_extra_config=("${extra_config[@]}") + + if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then + # Build libexpat + CT_DoLog EXTRA "Building static cross expat" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-cross-${CT_TARGET}" + do_gdb_expat_backend host="" \ + prefix="${CT_BUILD_DIR}/static-cross" \ + cflags="" \ + ldflags="" + CT_Popd + cross_extra_config+=("--with-libexpat-prefix=${CT_BUILD_DIR}/static-cross") + fi cross_extra_config+=("--enable-expat") cross_extra_config+=("--with-expat=yes") + case "${CT_THREADS}" in none) cross_extra_config+=("--disable-threads");; *) cross_extra_config+=("--enable-threads");;
# HG changeset patch # User Daniel Price <daniel.price@gmail.com> # Date 1370561887 25200 # Node ID 24f301216ef944e8d40350845d117a6da5eecdae # Parent 2685dfa9de14fbe356ba76cb201bf5c039cf6860 Enable download and build of expat when cross-static gdb is requested Signed-off-by: Daniel Price <daniel.price@gmail.com> -- For unsubscribe information see http://sourceware.org/lists.html#faq