Re: [patch] Fix in-src-tree builds by gdbserver/gnulib/ copy [Re: [PATCH] Link gnulib in gdbserver.]

Pedro Alves
2012-04-16T10:58:01Z

On 04/15/2012 05:49 PM, Jan Kratochvil wrote:

> On Sat, 14 Apr 2012 05:39:52 +0200, Yao Qi wrote:
>> On 04/14/2012 05:25 AM, Jan Kratochvil wrote:
> This broke in-src-tree build:
> [...]
>>> gcc: error: gnulib/libgnu.a: No such file or directory
>>> make[4]: *** [gdbserver] Error 1
>>> make[4]: Leaving directory `/home/jkratoch/redhat/gdb-clean/gdb/gdbserver'
>>
>> It is wired. I don't see such failure in in-source-tree (CVS trunk) build.
>
> I do, on {x86_64,i686}-fedora{15,16,17,rawhide}-linux-gnu, not sure why it is
> not reproducible for you - I also see it logical why it fails - using VPATH
> make finds gnulib/libgnu.a in the gnulib source directory (gdb/gnulib/) and
> therefore it does not rebuild libgnu.a in gdbserver/gnulib/ .
>
> I also tried to force some phony dependency for libgnu.a in gdbserver/gnulib/
> to force its rebuild there but it had other disadvantages. Also one could not
> do make -C gdb/gdbserver/gnulib as the command-line variables overrides would
> not apply, as was stated here.
>
> * Using libgnu.a from gdb/gnulib/ for gdbserver is not good as they may have
> different compilation options, also gdb/ may not be compilable for that host
> etc.
> * Copyting gdb/gnulib/ into gdbserver/gnulib/ in the CVS repository itself
> would be possible but it would be just too much work to maintain etc.
>
> AFAIK the GNU tools do not provide good enough support for the exact problem
> here, therefore for building in-source-tree and having another build directory
> of the source directory already containing pre-build binaries.
>
> Therefore proposing to:
> * Have single copy gdb/gnulib/ in CVS repository.
> * Have two copies in the .tar distribution, it does not cost much:
> 225280 uncompressed
> 40970 gzip
> 32676 xz
> * For direct build from repository in-source-tree do a clean binaries-less
> copy from gdb/gnulib/ into gdbserver/gnulib/ .
> * For direct build from repository out-of-source-tree do a clean binaries-less
> copy from srcdir-gdb/gnulib/ into objdir-gdbserver/gnulib/ patching there
> @*srcdir*@ variables so that it does not try
> to access srcdir-gdbserver/gnulib/ which does not exist and where we must
> not write anything.
>
> Tested the combinations by the script below. As the gnulib/*.h files are not
> yet in use in gdbserver/ it may not be well tested but I hope
> GNULIB_INCLUDE_CFLAGS is right there.

Let me give a different approach a try. Will post it in a bit.

--
Pedro Alves