[Bugs] [Bug 1377341] New: out-of-tree builds generate XDR headers and source files in the original directory

bugzilla at redhat.com bugzilla at redhat.com
Mon Sep 19 13:11:48 UTC 2016


https://bugzilla.redhat.com/show_bug.cgi?id=1377341

            Bug ID: 1377341
           Summary: out-of-tree builds generate XDR headers and source
                    files in the original directory
           Product: GlusterFS
           Version: mainline
         Component: build
          Keywords: Triaged
          Assignee: bugs at gluster.org
          Reporter: kkeithle at redhat.com
                CC: anoopcs at redhat.com, bugs at gluster.org,
                    kkeithle at redhat.com, ndevos at redhat.com
        Depends On: 1330604, 1369124
            Blocks: 1374278, 1374280, 1279164



.c and .h files are blindly regenerated. If you run `make` followed by `make
install` the `make install` will redundantly recompile everything because the
unnecessarily regenerated header files are newer than the prior builds .o files


+++ This bug was initially created as a clone of Bug #1330604 +++

Description of problem:
out-of-tree builds are expected to not modify or add files in the original
source tree. Our rpc/xdr/src/Makefile.am and the xdrgen script generate files
in the wrong directory.

How reproducible:
100%

Steps to Reproduce:
1. checkout a git repository, say $SOURCES
2. run ./autogen.sh in $SOURCES (just like a 'make dist' tarball)
3. cd into a different directory, say $BUILD
4. run "$SOURCES/configure && make" from $BUILD
5. find newly generated files under $SOURCES/rpc/xdr/src

Actual results:
new generated files under $SOURCES/rpc/xdr/src

Expected results:
newly generated files should be created under $BUILD/rpc/xdr/src

--- Additional comment from Vijay Bellur on 2016-04-26 17:46:02 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generate XDR
files in the original directory) posted (#1) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-04-26 18:28:45 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generate XDR
files in the original directory) posted (#2) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-04-26 18:40:25 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generate XDR
files in the original directory) posted (#3) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-04-26 18:54:39 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generate XDR
files in the original directory) posted (#4) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-04-27 09:38:18 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generate XDR
files in the original directory) posted (#5) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-05-02 14:12:26 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds creates XDR
files in the wrong directory) posted (#6) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-05-02 14:49:01 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds creates XDR
files in the wrong directory) posted (#7) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-05-03 09:08:58 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#8) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-05-03 14:00:33 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#9) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-05-03 14:13:32 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#10) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-06-13 11:17:53 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#11) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-06-13 13:03:06 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#12) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Vijay Bellur on 2016-08-17 14:37:34 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#13) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Worker Ant on 2016-08-22 08:53:20 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#14) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Worker Ant on 2016-09-15 12:04:55 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#15) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Worker Ant on 2016-09-15 21:21:19 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#16) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Worker Ant on 2016-09-16 03:07:32 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#17) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Worker Ant on 2016-09-16 08:37:30 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#18) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Worker Ant on 2016-09-17 10:08:04 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#19) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Worker Ant on 2016-09-17 22:27:16 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#20) for review on master by Kaleb
KEITHLEY (kkeithle at redhat.com)

--- Additional comment from Worker Ant on 2016-09-18 02:31:20 EDT ---

REVIEW: http://review.gluster.org/14085 (build: out-of-tree builds generates
files in the wrong directory) posted (#21) for review on master by Niels de Vos
(ndevos at redhat.com)

--- Additional comment from Worker Ant on 2016-09-18 12:34:41 EDT ---

COMMIT: http://review.gluster.org/14085 committed in master by Niels de Vos
(ndevos at redhat.com) 
------
commit e38dff5b4e0f0a25db664810fc3617eac44673ce
Author: Kaleb S KEITHLEY <kkeithle at redhat.com>
Date:   Tue Apr 26 17:04:04 2016 -0400

    build: out-of-tree builds generates files in the wrong directory

    And minor cleanup of a few of the Makefile.am files while we're
    at it.

    Rewrite the make rules to do what xdrgen does. Now we can get rid
    of xdrgen.

    Note 1. netbsd6's sed doesn't do -i. Why are we still running
    smoke tests on netbsd6 and not netbsd7? We barely support netbsd7
    as it is.

    Note 2. Why is/was libgfxdr.so (.../rpc/xdr/src/...) linked with
    libglusterfs? A cut-and-paste mistake? It has no references to
    symbols in libglusterfs.

    Note3. "/#ifndef\|#define\|#endif/" (note the '\'s) is a _basic_
    regex that matches the same lines as the _extended_ regex
    "/#(ifndef|define|endif)/". To match the extended regex sed needs to
    be run with -r on Linux; with -E on *BSD. However NetBSD's and
    FreeBSD's sed helpfully also provide -r for compatibility. Using a
    basic regex avoids having to use a kludge in order to run sed with
    the correct option on OS X.

    Note 4. Not copying the bit of xdrgen that inserts copyright/license
    boilerplate. AFAIK it's silly to pretend that machine generated
    files like these can be copyrighted or need license boilerplate.
    The XDR source files have their own copyright and license; and
    their copyrights are bound to be more up to date than old
    boilerplate inserted by a script. From what I've seen of other
    Open Source projects -- e.g. gcc and its C parser files generated
    by yacc and lex -- IIRC they don't bother to add copyright/license
    boilerplate to their generated files.

    It appears that it's a long-standing feature of make (SysV, BSD,
    gnu) for out-of-tree builds to helpfully pretend that the source
    files it can find in the VPATH "exist" as if they are in the $cwd.
    rpcgen doesn't work well in this situation and generates files
    with "bad" #include directives.

    E.g. if you `rpcgen ../../../../$srcdir/rpc/xdr/src/glusterfs3-xdr.x`,
    you get an #include directive in the generated .c file like this:

      ...
      #include "../../../../$srcdir/rpc/xdr/src/glusterfs3-xdr.h"
      ...

    which (obviously) results in compile errors on out-of-tree build
    because the (generated) header file doesn't exist at that location.
    Compared to `rpcgen ./glusterfs3-xdr.x` where you get:

      ...
      #include "glusterfs3-xdr.h"
      ...

    Which is what we need. We have to resort to some Stupid Make Tricks
    like the addition of various .PHONY targets to work around the VPATH
    "help".

    Warning: When doing an in-tree build, -I$(top_builddir)/rpc/xdr/...
    looks exactly like -I$(top_srcdir)/rpc/xdr/...  Don't be fooled though.
    And don't delete the -I$(top_builddir)/rpc/xdr/... bits

    Change-Id: Iba6ab96b2d0a17c5a7e9f92233993b318858b62e
    BUG: 1330604
    Signed-off-by: Kaleb S KEITHLEY <kkeithle at redhat.com>
    Reviewed-on: http://review.gluster.org/14085
    Tested-by: Niels de Vos <ndevos at redhat.com>
    Smoke: Gluster Build System <jenkins at build.gluster.org>
    NetBSD-regression: NetBSD Build System <jenkins at build.gluster.org>
    CentOS-regression: Gluster Build System <jenkins at build.gluster.org>
    Reviewed-by: Niels de Vos <ndevos at redhat.com>


Referenced Bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1279164
[Bug 1279164] [RFE] Gluster should support out of tree builds
https://bugzilla.redhat.com/show_bug.cgi?id=1330604
[Bug 1330604] out-of-tree builds generate XDR headers and source files in
the original directory
https://bugzilla.redhat.com/show_bug.cgi?id=1369124
[Bug 1369124] fix unused variable warnings from out-of-tree builds generate
XDR headers and source files i...
https://bugzilla.redhat.com/show_bug.cgi?id=1374278
[Bug 1374278] rpc/xdr: generated files are filtered with a sed extended
regex
https://bugzilla.redhat.com/show_bug.cgi?id=1374280
[Bug 1374280] rpc/xdr: generated files are filtered with a sed extended
regex
-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list