$ git grep DMPlexSNESComputeJacobianFEM include/petscdmplex.h:PETSC_EXTERN PetscErrorCode DMPlexSNESComputeJacobianFEM(DM, Vec, Mat, Mat, void *); src/dm/impls/plex/landau/plexland.c: ierr = DMPlexSNESComputeJacobianFEM(plex, locX, *Amat, *Amat, ctx);CHKERRQ(ierr); src/snes/utils/dmplexsnes.c:PetscErrorCode DMPlexSNESComputeJacobianFEM(DM dm, Vec X, Mat Jac, Mat JacP,void *user) So the function is in -lpetscsnes - but its referred to from -lpetscdm [not just examples] - hence a circular dependency. You should be able to reproduce this issue on your laptop - instead of using CI for this. Just build with --with-single-library=0 --with-shared-libraries=0 Satish On Tue, 14 Jul 2020, Mark Adams wrote:
I am pretty sure I've removed stray includes (this did fix one undefined reference), but I am not fixing DMPlexSNESComputeJacobianFEM.
DMPlexSNESComputeJacobianFEM is not called from any other source. Just examples. And it is NOT called from the examples that fail:
/home/petsc/builds/KFnbdjNX/0/petsc/petsc/arch-ci-linux-cuda-single-cxx/lib/libpetscdm.so: undefined reference to `DMPlexSNESComputeJacobianFEM' collect2: error: ld returned 1 exit status make[2]: *** [arch-ci-linux-cuda-single-cxx/tests/mat/tests/ex240] Error 1
https://gitlab.com/petsc/petsc/-/jobs/637821856 https://gitlab.com/petsc/petsc/-/jobs/637821886 https://gitlab.com/petsc/petsc/-/jobs/637821944
This seems to be saying that libpetscdm can not find my reference to DMPlexSNESComputeJacobianFEM, called from in the lib.
Maybe DMPlexSNESComputeJacobianFEM is set to be external but I am now using it internally and it would need to be declared differently?
On Mon, Jul 13, 2020 at 8:19 PM Mark Adams <[email protected]> wrote:
On Mon, Jul 13, 2020 at 7:11 PM Satish Balay <[email protected]> wrote:
$ git grep DMPlexLandFormLandau_Internal include/petsc/private/dmpleximpl.h:PETSC_INTERN PetscErrorCode DMPlexLandFormLandau_Internal(Vec, Mat, const PetscInt, void *); src/dm/impls/plex/landau/plexland.c: DMPlexLandFormLandau_Internal - Evaluates Jacobian matrix. src/dm/impls/plex/landau/plexland.c:PetscErrorCode DMPlexLandFormLandau_Internal(Vec a_X, Mat JacP, const PetscInt dim, void *a_ctx) src/ts/utils/dmplexts.c:PETSC_INTERN PetscErrorCode DMPlexLandFormLandau_Internal(Vec, Mat, const PetscInt, void *); src/ts/utils/dmplexts.c: ierr = DMPlexLandFormLandau_Internal(X,ctx->J,dim,(void*)ctx);CHKERRQ(ierr); src/ts/utils/dmplexts.c: ierr = DMPlexLandFormLandau_Internal(X,ctx->J,dim,(void*)ctx); CHKERRQ(ierr);
You'll need the PETSC_EXTERN in include/petsc/private/dmpleximpl.h and remove the duplicate prototype listing from src/ts/utils/dmplexts.c
Thanks, the first error that I got was undefined again:
arch-ci-linux-cuda-single-cxx/obj/ts/utils/dmplexts.o: In function `DMPlexLandIFunction': 2264 <https://gitlab.com/petsc/petsc/-/jobs/636864970#L2264>/home/petsc/builds/KFnbdjNX/0/petsc/petsc/src/ts/utils/dmplexts.c:266: undefined reference to `DMPlexLandFormLandau_Internal' 2265 <https://gitlab.com/petsc/petsc/-/jobs/636864970#L2265>arch-ci-linux-cuda-single-cxx/obj/ts/utils/dmplexts.o: In function `DMPlexLandIJacobian': 2266 <https://gitlab.com/petsc/petsc/-/jobs/636864970#L2266>/home/petsc/builds/KFnbdjNX/0/petsc/petsc/src/ts/utils/dmplexts.c:305: undefined reference to `DMPlexLandFormLandau_Internal' 2267 <https://gitlab.com/petsc/petsc/-/jobs/636864970#L2267>/usr/bin/ld: arch-ci-linux-cuda-single-cxx/lib/libpetscts.so.3.013.3: hidden symbol `DMPlexLandFormLandau_Internal' isn't defined 2268 <https://gitlab.com/petsc/petsc/-/jobs/636864970#L2268>/usr/bin/ld: final link failed: Bad value 2269 <https://gitlab.com/petsc/petsc/-/jobs/636864970#L2269>collect2: error: ld returned 1 exit status 2270 <https://gitlab.com/petsc/petsc/-/jobs/636864970#L2270>gmakefile:149: recipe for target 'arch-ci-linux-cuda-single-cxx/lib/libpetscts.so.3.013.3' failed 2271 <https://gitlab.com/petsc/petsc/-/jobs/636864970#L2271>make[3]: *** [arch-ci-linux-cuda-single-cxx/lib/libpetscts.so.3.013.3] Error 1 2272 <https://gitlab.com/petsc/petsc/-/jobs/636864970#L2272>make[3]: *** Waiting for unfinished jobs.... 2273 <https://gitlab.com/petsc/petsc/-/jobs/636864970#L2273> FC arch-ci-linux-cuda-single-cxx/obj/tao/f90-mod/petsctaomod.o 2274 <https://gitlab.com/petsc/petsc/-/jobs/636864970#L2274>/home/petsc/builds/KFnbdjNX/0/petsc/petsc/lib/petsc/conf/rules:49: recipe for target 'libs' failed
https://gitlab.com/petsc/petsc/-/jobs/636864970
I'll try extern
Satish
I tried to add code to DMPlexts.c and am getting this error:
https://gitlab.com/petsc/petsc/-/jobs/636828148
dmplexts.c:(.text+0x1a0f): undefined reference to `DMPlexLandFormLandau_Internal' 1648 <https://gitlab.com/petsc/petsc/-/jobs/636828148#L1648>
with this code:
PETSC_INTERN PetscErrorCode DMPlexLandFormLandau_Internal(Vec a_X, Mat JacP, const PetscInt dim, void *a_ctx); /*@ DMPlexLandIFunction @*/ PetscErrorCode DMPlexLandIFunction(TS ts,PetscReal time_dummy,Vec X,Vec X_t,Vec F,void *actx) { ..... ierr = DMPlexLandFormLandau_Internal(X,ctx->J,dim,(void*)ctx);CHKERRQ(ierr);
I tried with EXTERN also. Any ideas? Thanks, Mark