Skip to content
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

Can't compile chapter 6 exercise #57

Open
ophirnt opened this issue Apr 30, 2024 · 7 comments
Open

Can't compile chapter 6 exercise #57

ophirnt opened this issue Apr 30, 2024 · 7 comments

Comments

@ophirnt
Copy link

ophirnt commented Apr 30, 2024

Hello. I am a new reader. I have been trying to do my setup and am testing it by compiling chapter 6's exercise. Unfortunately, it prints out a bunch of errors which doesn't seem related to my petsc installation (which seems to be installed correctly). Sorry for being incovenient, but could someone help me?

~/p4pdes/c/ch6$ make fish
mpicc -o fish.o -c -fPIC -Wall -Wwrite-strings -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-stringop-overflow -fstack-protector -fvisibility=hidden -g3 -O0 -pedantic -std=c99 -I/opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/petsc/3.19.5d/include -I/opt/ohpc/pub/libs/gnu-13.2.0/suitesparse/7.1.0/include -I/opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/mumps/5.6.1/include -I/opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/trilinos/14.2.0/include -I/opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/scotch/7.0.4/include -I/opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/netcdf/4.9.2/include -I/opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/hdf5/1.14.1d/include -I/opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/parmetis/4.0.3/include -I/opt/ohpc/pub/libs/gnu-13.2.0/metis/5.2.1/include -I/opt/ohpc/pub/libs/gnu-13.2.0/libpng/1.6.40/include -I/opt/ohpc/pub/libs/gnu-13.2.0/zlib/1.2.13/include -I/opt/ohpc/pub/libs/gnu-13.2.0/szip/2.1.1/include -I/opt/ohpc/pub/libs/gnu-13.2.0/eigen3/3.4.0/include/eigen3 -I/opt/ohpc/pub/libs/gnu-13.2.0/googletest/1.13.0/include -I/opt/ohpc/pub/libs/gnu-13.2.0/boost/1.82.0/include -I/opt/ohpc/pub/libs/gnu-13.2.0/hwloc/2.9.2/include    `pwd`/fish.c
/home/ophir/p4pdes/c/ch6/fish.c:92:8: error: unknown type name ‘DMDASNESFunctionFn’
   92 | static DMDASNESFunctionFn* residual_ptr[3]
      |        ^~~~~~~~~~~~~~~~~~
/home/ophir/p4pdes/c/ch6/fish.c:93:9: error: ‘DMDASNESFunctionFn’ undeclared here (not in a function); did you mean ‘DMDASNESFunction’?
   93 |     = {(DMDASNESFunctionFn*)&Poisson1DFunctionLocal,
      |         ^~~~~~~~~~~~~~~~~~
      |         DMDASNESFunction
/home/ophir/p4pdes/c/ch6/fish.c:93:28: error: expected expression before ‘)’ token
   93 |     = {(DMDASNESFunctionFn*)&Poisson1DFunctionLocal,
      |                            ^
/home/ophir/p4pdes/c/ch6/fish.c:97:8: error: unknown type name ‘DMDASNESJacobianFn’
   97 | static DMDASNESJacobianFn* jacobian_ptr[3]
      |        ^~~~~~~~~~~~~~~~~~
/home/ophir/p4pdes/c/ch6/fish.c:98:9: error: ‘DMDASNESJacobianFn’ undeclared here (not in a function); did you mean ‘DMDASNESJacobian’?
   98 |     = {(DMDASNESJacobianFn*)&Poisson1DJacobianLocal,
      |         ^~~~~~~~~~~~~~~~~~
      |         DMDASNESJacobian
/home/ophir/p4pdes/c/ch6/fish.c:98:28: error: expected expression before ‘)’ token
   98 |     = {(DMDASNESJacobianFn*)&Poisson1DJacobianLocal,
      |                            ^
In file included from /opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/petsc/3.19.5d/include/petscsys.h:1086,
                 from /opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/petsc/3.19.5d/include/petscbag.h:5,
                 from /opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/petsc/3.19.5d/include/petsc.h:5,
                 from /home/ophir/p4pdes/c/ch6/fish.c:10:
/home/ophir/p4pdes/c/ch6/fish.c: In function ‘main’:
/home/ophir/p4pdes/c/ch6/fish.c:226:35: error: expected expression before ‘)’ token
  226 |              (DMDASNESFunctionFn *)(residual_ptr[dim-1]),&user));
      |                                   ^
/opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/petsc/3.19.5d/include/petscerror.h:461:28: note: in definition of macro ‘PetscCall’
  461 |       ierr_petsc_call_q_ = __VA_ARGS__; \
      |                            ^~~~~~~~~~~
/home/ophir/p4pdes/c/ch6/fish.c:228:35: error: expected expression before ‘)’ token
  228 |              (DMDASNESJacobianFn *)(jacobian_ptr[dim-1]),&user));
      |                                   ^
/opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/petsc/3.19.5d/include/petscerror.h:461:28: note: in definition of macro ‘PetscCall’
  461 |       ierr_petsc_call_q_ = __VA_ARGS__; \
      |                            ^~~~~~~~~~~
make: *** [/opt/ohpc/pub/libs/gnu-13.2.0/openmpi-4.1.5/petsc/3.19.5d/lib/petsc/conf/rules:148: fish.o] Error 1
@bueler
Copy link
Owner

bueler commented Apr 30, 2024

It looks like your PETSc version is not the most recent. Please do something like
$ ls $PETSC_DIR/$PETSC_ARCH/lib/ |grep libpetsc
to get your installed petsc version number.

Then go to the p4pdes releases list and get/checkout the right tag, or download the version which matches your petsc version number.

If this does not work please let me know and we will try again?

@ophirnt
Copy link
Author

ophirnt commented Apr 30, 2024

Guess that must be it then. I just simply cloned the repo and tried compiling. The apt version must be out of date, as usual. I'll try downloading for version 3.19 or simply compiling the newer PETSc version later and will send news. Thank you very much!

ls $PETSC_DIR/lib/ | grep libpetsc
libpetsc.so
libpetsc.so.3.19
libpetsc.so.3.19.5

@bueler
Copy link
Owner

bueler commented Apr 30, 2024

Got it. Your debian system has petsc 3.19.5 which is a year old (?). You can build petsc from source if you want to use the most recent p4pdes download. Alternatively, you can grab this p4pdes release and it should work:
https://github.com/bueler/p4pdes/releases/tag/v3.20.0

@ophirnt
Copy link
Author

ophirnt commented May 3, 2024

Yes, I just built the new release (very easy actually). Working like a charm now, thank you very much!

I could add a pull request with this caveat added for future users not get confused. What do you think?

@bueler
Copy link
Owner

bueler commented May 3, 2024

I could add a pull request with this caveat added for future users not get confused. What do you think?

I definitely welcome pull requests but I am not quite sure what you have in mind. Thanks, Ed

@ophirnt
Copy link
Author

ophirnt commented May 3, 2024

I've just added this bullet point:

  * My book does not contain PETSc installation instructions, though it has
    minimal advice.  Maintaining installation information is the job of
    PETSc developers, not me.  (Thank goodness.)
  * [CONFIGS.md](CONFIGS.md) contains some of the `configure` commands which
    work on the author's machines.  These are minimal installation suggestions.
  * My book does not help the reader with debugging C programs.k does not help the reader with debugging C programs.
  --> * Make sure to [download a release](https://github.com/bueler/p4pdes/releases/) compatible with your computer's PETSc version. Package managers (such as apt) may only contain older versions of PETSc that are incompatible with newer releases of p4pdes.

I can't upload the changes to a branch and do the pull request, though.

@bueler
Copy link
Owner

bueler commented May 3, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants