-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building out of tree results in build products in original source tree #1082
Comments
oops.. I meant to open this in the SPL project. I'd guess both trees suffer from the same defect though. |
Could the problem be that you are not passing --with-linux-obj=? |
I don't think so. Why would that option change anything? |
That tells the kernel build system where the object build directory is. The default is the Linux source tree, but it can be some place else. |
@ryao The issue here isn't locating the kernel objects, the problem is the resulting spl/zfs objects are being created in the spl/zfs source tree. They should be created in the alternate build directory. |
I've looked at trying to fix this for quite a few hours now, but there seems NO way to run autoreconf in anything but the source directory.... I've tried
but nothing I've tried worked :(. Anyone know how to run autoreconf inside an empty directory? |
We shouldn't need to run autoreconf outside the source tree. It's OK for the autoreconf products (*.in, *.m4, files, ./config/ scripts, etc) to exist in the source tree. They aren't tried to a specific build and you'd expect them to be part of any distributed tarball. The issue are the *.o and *.cmd files which should be in the build NOT source directory. |
Ok, if we're ok with the autoreconf results in the source dir, then I'll see what I can do. |
clutter the source with build results (such as Makefiles, *.o and *.a files etc). Closes: openzfs#1082
clutter the source with build results (such as Makefiles, *.o and *.a files etc). Closes: openzfs/zfs#1082
That was surprisingly simple! :). @prakashsurya could you test the pull requests I just issued? There's one for SPL and one for ZFS. |
@FransUrbo Sure, anything which is part of the The patch almost worked for me. It correctly handled everything for the user space build but since every under |
I suspected as much (an hour or so after I submitted the pull request :), but I didn't remove the .gitignores so I didn't see them in the status. I'll update those Makefile.ins as well... |
do the build in a different directory and not clutter the source with build results (such as Makefiles, *.o and *.a files etc). Closes: openzfs#1082
I've done a force push that really don't leave any build results in the source directory (I missed some because I haven't tested by removing the .gitignore files which filters out a lot). I still don't know how to fix the module directory... But the base for it should be there. |
do the build in a different directory and not clutter the source with build results (such as Makefiles, *.o and *.a files etc). Closes: openzfs/zfs#1082
ure it's possible to do the build in a different directory and not clutter the source with build results (such as Makefiles, *.o and *.a files etc). Closes: openzfs/zfs#1082
Managed to find the solution for modules. Instead of VPATH, use
Please test the new commits and comment. |
These latest ones aren't as pretty and simple as the first (they remove basically all paths to code etc and instead rely on the VPATH/src/obj variables). |
sure it's possible to do the build in a different directory and not clutter the source with build results (such as Makefiles, *.o and *.a files etc). Closes: openzfs#1082
* Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
I've added some changes to config/kernel.m4 to be able to find the build directory (for a VPATH build). I've added it as a separate commit, in case you don't like it... |
Oh, that's a much bigger change. Definitely something for after 0.6.3, I'll look at after the tag. |
Oh, I didn't think for a moment even that simple one I posted first would end up in 0.6.3! :). You need to stop accepting more, and get it rolled out already :D |
and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082
* Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. * For VPATH builds (addition for openzfs#1082): + Add '../../spl' to spl source directory list to search + Do a find in the found spl source for spl_config.h Closes: openzfs#1082
* Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. * For VPATH builds (addition for openzfs#1082): + Add '../../spl' to spl source directory list to search + Do a find in the found spl source for spl_config.h Closes: openzfs#1082
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Closes: openzfs#1082 For VPATH builds (addition for openzfs#1082): * Add '../../spl' to spl source directory list to search * Do a find in the found spl source for spl_config.h
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Signed-off-by: Turbo Fredriksson <[email protected]> Closes openzfs#1082
Support 'out of tree' builds by adding the 'src' and 'obj' variables and removing the absolute path to the build results to the Makefile.in files below the module directory. Signed-off-by: Turbo Fredriksson <[email protected]> Closes openzfs#1082
Build products from an out of tree build should be written relative to the build directory. Sources should be referred to by their locations in the source directory. This is accomplished by adding the 'src' and 'obj' variables for the module Makefile.am, using relative paths to reference source files, and by setting VPATH when source files are not co-located with the Makefile. This enables the following: $ mkdir build $ cd build $ ../configure $ make -s This change also has the advantage of resolving the following warning which is generated by modern versions of automake. Makefile.am:00: warning: source file 'xxx' is in a subdirectory, Makefile.am:00: but option 'subdir-objects' is disabled Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue openzfs/zfs#1082
@FransUrbo thanks for doing the heavy lifting on this one. I ended up having to slightly modify your patch to cleanly handle the libraries which have source which isn't co-located with the Makefile but I was able to sort it out. This have been merged to master and I have to say it's a nice improvement. |
No worries. I was thinking that we could/should get rid of the .gitignore files eventually to. With this, they shouldn't be needed. On the other hand, maybe not everyone chooses to do the build in a sub directory.. |
The .gitigore files are pretty standard fare these days. Unless a better solution comes along I think those are here to stay. |
Worst problem I have with the But it was just a thought... |
@FransUrbo Ahh, that's what the |
Build products from an out of tree build should be written relative to the build directory. Sources should be referred to by their locations in the source directory. This is accomplished by adding the 'src' and 'obj' variables for the module Makefile.am, using relative paths to reference source files, and by setting VPATH when source files are not co-located with the Makefile. This enables the following: $ mkdir build $ cd build $ ../configure \ --with-spl=$HOME/src/git/spl/ \ --with-spl-obj=$HOME/src/git/spl/build $ make -s This change also has the advantage of resolving the following warning which is generated by modern versions of automake. Makefile.am:00: warning: source file 'xxx' is in a subdirectory, Makefile.am:00: but option 'subdir-objects' is disabled Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#1082
Building the modules out of tree leaves the original source tree tainted with build products. For example:
The text was updated successfully, but these errors were encountered: