[petsc-users] Confusion/failures about the tests involved in including Hypre

Daniel Stone daniel.stone at opengosim.com
Wed Jul 19 09:52:51 CDT 2023


Hello,

I'm working on getting a petsc build running on windows. One necessary
package to include is Hypre. I've been able to build Hypre seperately using
cmake, and confirmed that the library works
by setting up a VS project to run some of the example programs.

My attempted petsc build is being done through cygwin. I've been able to
(with varying degrees of difficulty), build a fairly plain petsc, and one
that downloads and builds ptscotch (after some modifications
to both ptscotch and the config script). I am now attempting to include
Hypre (using the --hypre-iclude and --hypre-lib flags, etc). Note that the
same compilers are being used for both Hypre and for petsc
through cygwin - the new intel oneapi compilers (icx and ifx, after again
varying amounts of pain to work around their awkwardness with the config
script).

I'm seeing a problem when the config script does some tests on the included
hypre lib. The source code looks like:

#include "confdefs.h"
#include "conffix.h"
/* Override any gcc2 internal prototype to avoid an error. */

#include "HYPRE.h"

char HYPRE_IJMatrixCreate();
static void _check_HYPRE_IJMatrixCreate() { HYPRE_IJMatrixCreate(); }

int main() {
_check_HYPRE_IJMatrixCreate();;
  return 0;
}


As I understand this is a fairly standard type of stub program used by the
config script to check that it is able to link to certain symbols in given
libraries. Tests like this have succeeded in my builds that
include PTScotch.

I keep getting a linker error with the above test, including if I seperate
it out and try to build it seperately:

unresolved external symbol "char __cdel HYPRE_IJMatrixCreate(void)" ....

Ok, it looks like a problem with either the library or linker commands. But
here's the interesting thing - If I transplant this code into VS, with the
same project setting that allows it to build the much more
nontrivial Hypre example programs, I get the same error:

Error LNK2001 unresolved external symbol "char __cdecl
HYPRE_IJMatrixCreate(void)" (?HYPRE_IJMatrixCreate@@YADXZ) hypretry1
C:\Users\DanielOGS\source\repos\hypretry1\hypretry1\Source.obj 1

So it seems like there might be something about this type of stub program
that is not working with my Hypre library. I don't fully understand this
program - it's able to call the function with no arguments, but
it also needs to be linked against a library containing the function,
apparently by wrapping it in a static void function? Not something I've
seen before.

Does anyone have any insight into what might be going wrong - or really
just any explaination of how the stub program works so I can figure out why
it isn't in this case?

Many thanks,

Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230719/1bfe7b18/attachment.html>


More information about the petsc-users mailing list