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
AutotoolsPackage: minor improvements #2859
AutotoolsPackage: minor improvements #2859
Conversation
There's another thing that I could do either here or in a separate PR: turn If we do that we may write something like: build_directory = 'whatever' instead of: def build_directory(self):
return 'whatever' in packages that don't need complex recipes to compute it. Let me know what is the general feeling about it. |
I like that idea. Things that rarely need access to the spec, like build_directory, should be attributes. |
looks good, but i must admit i did not went through it thoroughly. |
Out of curiosity, did you run into the problem I described here? I'm assuming that if you can compile |
@adamjstewart Yes, and I compiled out of source. All the autotools packages have been modified this way and compile on my ubuntu 14.04. |
Should we consider always building Autotools packages out of source by default like we do for |
@adamjstewart I would like to say yes, but as far as I can tell most of the projects written for autotools won't compile if configured out of source. Not a fault of the tool I guess, rather bad habits taken from the community using it. Bottomline: I wouldn't change the default... |
@alalazo: @krafczyk has been thinking about building more packages out of source, in the context of Spack as a development environment. I think he might like the stuff you're doing here. This is mostly OT for this PR, but I'm curious about whether we could provide a more general way to expose out of source builds to Spack. The idea would be to give the user or site control over where the source gets staged, and take that out of the hands of the packager. e.g., we could provide a variable called with working_directory(source_dir):
# do build or a special context handler: with out_of_source():
# do build The idea would be that the framework passes in the source directory. Packages could say whether they support out of source builds with a top-level package attribute: class Foo(Package):
builds_out_of_source = True Why do this? This would allow you to stage the source in the install prefix, so that it can stay after the build for use by debuggers and tools. @mplegendre and I had talked about this a while ago, but we never got around to implementing a mechanism for it. Potential pitfalls: this wouldn't work for all packages, but it would be a start. It doesn't handle things like keeping generated code around for debuggers -- those would still go in the build directory and get removed afterwards. So maybe something more general is needed. @mplegendre and I talked about building in place, copying source files to the prefix, and rewriting file paths in Anyway, not trying to divert the thread, just throwing this out there. |
@alalazo: back on topic, I like the idea of making the simple stuff into properties. |
@tgamblin But if we build in the stage, as we do, we can pass in relative paths that are just strings and make them absolute in the base class. This is what I do here. Don't know if there are cases where that would create problems... |
@alalazo: true, that could work. worst case we could provide some known format strings that culd be used for things that need to be subbed in later, e.g. |
@tgamblin Good idea. Maybe we can reuse what @scheibelp has done already for spec substitution if need be. |
@@ -52,7 +52,7 @@ def setup_environment(self, spack_env, run_env): | |||
run_env.set('TK_LIBRARY', join_path(self.prefix.lib, 'tk{0}'.format( | |||
self.spec.version.up_to(2)))) | |||
|
|||
def build_directory(self): | |||
def configure_directory(self): | |||
return 'unix' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and tcl need to be converted from functions to attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, missed those two.
@@ -97,10 +97,11 @@ def configure(self, spec, prefix): | |||
|
|||
extends('python') | |||
|
|||
def setup_file(self, spec, prefix): | |||
def setup_file(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this particular change? This function is only needed for a single file, and that package needs to access the spec.
We might want to save things that change between self and self/spec/prefix for another PR. You, @tgamblin, and I all disagree on the best way to handle this 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it's not a phase... but I would have pointed out the change before tagging this ready (if you didn't precede me to it) 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Since it's only a single file, I don't mind as much. But it is annoying to try to convert things to use configure_args
and look out for whether or not they use spec
. I think I'm more interested in convenience and you're more interested in maintaining a well-designed system. There are merits to both, obviously.
Leave the change in for now. You've convinced me, at least for this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm more interested in convenience and you're more interested in maintaining a well-designed system. There are merits to both, obviously.
dependency injection = convenience + modular design
m.aclocal() | ||
m.autoconf() | ||
autogen = Executable('./autogen.sh') | ||
autogen() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is how swiftsim
does things, but is this generic enough for other packages? Most packages that need it seem to run something like:
autoreconf('--install', '--verbose', '--force')
Is your method a more robust version of the same thing?
We may want to comment out the autoreconf
method I added to AutoreconfPackageTemplate
in spack create
, just to let users know that there is now a default and it should suffice most of the time. I would be interested in seeing how many of the other packages in Spack that need to generate a configure script could be converted to use the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last time I tried to generate a configure script, a lot of m4 modules were missing. Autoreconf generated some warnings, but I think it went ok. If possible, we should figure out what is actually necessary to get rid of those warnings. Packages like libquo
, for example, explicitly define where automake and libtool can be found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll dig deeper into this but I think autogen.sh
does an:
autoreconf('--install', '--verbose', '--force')
plus other things. The first two calls should update files in the configure directory if need be. If you have other cases than swiftsim
at hand I can try them in this PR to see if I can come up with a recipe that works for the most part of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to docs:
aclocal
adds m4 macros that may be needed byconfigure.ac
in the folder aclocal.m4libtoolize
provides a way to add support for libtoolautoconf
creates a new configure fromaclocal.m4
andconfigure.ac
autoreconf
does a few of the above things repeatedly to generate a configure (but I remember I saw cases were the order was not right and plain autoreconf was failing)- to my surprise
autogen.sh
seems not to be a generated file, but an hand maintained one, even though it is mentioned in the FAQ.
Given all of the above I would remove:
autogen()
and substitute it with:
autoreconf('--install', '--verbose', '--force')
and hope that @mathstuf and colleagues will take over the market with CMake. Does it sound good @adamjstewart ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing some research @alalazo. I would say, take the packages currently in Spack that call autoreconf and see how many of them will work with your new default method. Go by whatever works for most packages.
6d2f7b3
to
634805c
Compare
@adamjstewart @davydden @tgamblin and others. Seeing the pattern here while working on this (in particular 634805c) I am tempted to push:
into the base |
@alalazo I would rather add an |
@adamjstewart This doesn't solve the issue. There are packages that need the phase at some version and doesn't need them at some other version. |
I don't have anything against it as long as those dependencies build robustly enough not to break every |
As far as I know, GCC, Intel, PGI, and NAG can build all of these packages and their dependencies, so I think they are fairly robust, for what it's worth. |
that's generally my experience as well. |
@davydden See the argument above for
That's a very good point (even though if those won't build I think you won't be able to build a lot of stuff). Another option is to rediscuss when we will have CDash + package testing in place |
as long as we do tests before |
I agree that simplicity is important, although |
@adamjstewart I think I miss that change! Well, after this PR I hope it will be rarely necessary to override |
…urce. The configure script executable is now invoked with an absolute path. Modified a few packages accordingly.
634805c
to
8371ee7
Compare
I just understood I overlooked a thing in the last issue I raised: circular dependencies on the tools themselves (autoconf depends on autoconf and so on...). I'll leave this PR as it is and consider it ready from my side.
@adamjstewart I took a brief look at This argument anyhow comes in order of importance after the other one: some packages needs both behaviors. |
@alalazo I got this error while installing
And this is the spack-build.out:
Before this merge I could install it correctly but now I get this, do you think that could be related with the commit or maybe I have to install it in a different way now? |
@JavierCVilla i think it's better to open a new issue for that. |
* AutotoolsPackage: added configure_directory to permit build out of source. The configure script executable is now invoked with an absolute path. Modified a few packages accordingly. * build_systems: functions returning directories are now properties * build_systems: fixed issues with tcl and tk * AutotoolsPackage: reworked recipe for autoreconf
* AutotoolsPackage: added configure_directory to permit build out of source. The configure script executable is now invoked with an absolute path. Modified a few packages accordingly. * build_systems: functions returning directories are now properties * build_systems: fixed issues with tcl and tk * AutotoolsPackage: reworked recipe for autoreconf
* AutotoolsPackage: added configure_directory to permit build out of source. The configure script executable is now invoked with an absolute path. Modified a few packages accordingly. * build_systems: functions returning directories are now properties * build_systems: fixed issues with tcl and tk * AutotoolsPackage: reworked recipe for autoreconf
Modifications:
configure_directory
to permit build out of sourceautoreconf
phase