Discussion:
[Libmesh-users] use of "--with-methods=" and METHOD environment variable for libMesh
Boyce Griffith
2017-05-25 01:52:26 UTC
Permalink
I am working on the build system for IBAMR (https://github.com/IBAMR/IBAMR),
and we are automating building IBAMR's dependencies -- including libMesh.
I want to confirm that I am using the "--with-methods" configure flag
correctly.
I am under the impression that if we configure libMesh with the argument
"--with-methods=dbg", that the METHOD environment variable need not be set
because when we run `make` only the debug version of the library will be
built.
Is that correct? Or should both be set?
On the libMesh side, it's correct that if you use METHODS=dbg or
--with-method=dbg, libMesh will only build dbg mode.
On the application side, I can't speak for IBAMR, but none of the
other libMesh-based-frameworks I've used will try to autodetect which
methods are available; they'll just fail at link time if you try to
build against a method which the current libMesh install doesn't
provide. That's probably a good thing, IMHO; it's better form to tell
the user when they've asked for something inconsistent, rather than to
try and guess what they really meant.
FWIW, we do currently will do what the user asks, but are now trying to set things up so that all dependencies are built automatically --- in which case we need to pick a method unless one is specified.

(Elijah, it might be a good idea to have an optional flag that lets users say which libMesh method to use, and to default to dbg for debugging builds and to opt for non-debugging builds.)
Elijah DeLee
2017-05-24 20:38:35 UTC
Permalink
Great, thanks for the clarification.

--Elijah
Hello all,
I am working on the build system for IBAMR (https://github.com/IBAMR/IBAM
R),
and we are automating building IBAMR's dependencies -- including libMesh.
I want to confirm that I am using the "--with-methods" configure flag
correctly.
I am under the impression that if we configure libMesh with the argument
"--with-methods=dbg", that the METHOD environment variable need not be set
because when we run `make` only the debug version of the library will be
built.
Is that correct? Or should both be set?
I don't think libmesh uses the METHOD environment variable any more,
although application Makefiles may still do so.
--
John
Elijah DeLee
2017-05-25 04:54:49 UTC
Permalink
Post by Boyce Griffith
(Elijah, it might be a good idea to have an optional flag that lets
Post by Boyce Griffith
users say which libMesh method to use, and to default to dbg for
debugging builds and to opt for non-debugging builds.)
libmesh dbg builds are *not* typically ABI-compatible with opt builds!
I suppose we are "scarfing" them, libMesh is built with the same compiler
flags as each build of IBAMR in this system.
Post by Boyce Griffith
1. If you build against libstdc++ and you don't configure with
--disable-glibcxx-debugging, then half the standard library container
classes get different ABIs in dbg mode. In theory I think this should
result in a link-time failure, but in practice I've never seen a mixed
build produce a link error and I have seen mixed builds produce plenty
of segfaults.
What I am understanding is:

If using debugging flags:
1) Use "--with-methods=dbg"
2) Use "--disable-glibcxx-debugging"

If doing optimized build:
1) use "--with-methods=opt"

2. If you don't configure with --disable-reference-counting, then the
Post by Boyce Griffith
struct layout of ReferenceCounter and subclasses (a.k.a. practically
every heavyweight libMesh object) depends on whether or not the
preprocessor macro DEBUG is defined.
3. The error in (2) is just the only one I can name off the top of my
Post by Boyce Griffith
head, because it was the first one that caused a mixed build to
segfault on clang. Since we don't strive for ABI consistency between
build options, I wouldn't be surprised to find other ABI changes that
the failing application just never reached.
So, in which case do we need to make sure "--disable-reference-counting" is
used?

Thanks!
Elijah
Post by Boyce Griffith
4. Matt, if any of the above makes it into a future version of you
guys' "Firetran" parody, try to strip off embarrassing identifying
details? Thanks.
---
Roy
Boyce Griffith
2017-05-25 15:22:47 UTC
Permalink
Post by Boyce Griffith
(Elijah, it might be a good idea to have an optional flag that lets
users say which libMesh method to use, and to default to dbg for
debugging builds and to opt for non-debugging builds.)
libmesh dbg builds are *not* typically ABI-compatible with opt builds!
I suppose we are "scarfing" them, libMesh is built with the same compiler flags as each build of IBAMR in this system.
Yes, we are scarfing these. I am very familiar with libMesh's debugging flags. :-)
Post by Boyce Griffith
1. If you build against libstdc++ and you don't configure with
--disable-glibcxx-debugging, then half the standard library container
classes get different ABIs in dbg mode. In theory I think this should
result in a link-time failure, but in practice I've never seen a mixed
build produce a link error and I have seen mixed builds produce plenty
of segfaults.
1) Use "--with-methods=dbg"
2) Use "--disable-glibcxx-debugging"
1) use "--with-methods=opt"
I think this is correct for the cases where we build libMesh for the user.

We also should have BuildSystem set up to allow users to specify their own external libMesh build. In this case, I think it is reasonable to require the user to pick one method at configure time.
Post by Boyce Griffith
2. If you don't configure with --disable-reference-counting, then the
struct layout of ReferenceCounter and subclasses (a.k.a. practically
every heavyweight libMesh object) depends on whether or not the
preprocessor macro DEBUG is defined.
3. The error in (2) is just the only one I can name off the top of my
head, because it was the first one that caused a mixed build to
segfault on clang. Since we don't strive for ABI consistency between
build options, I wouldn't be surprised to find other ABI changes that
the failing application just never reached.
So, in which case do we need to make sure "--disable-reference-counting" is used?
I think that we do want to use reference counting with debugging. As long as we don't mix-and-match different builds of libMesh, which sounds like a dubious idea to me in any case, then I don't think it is a problem.
Post by Boyce Griffith
Thanks!
Elijah
4. Matt, if any of the above makes it into a future version of you
guys' "Firetran" parody, try to strip off embarrassing identifying
details? Thanks.
---
Roy
Loading...