ch 10 compile errors
ssilverman999 opened this issue · comments
errors on unfem.c:
--------------------------------------/home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:299: undefined reference to UMGetNodeCoordArrayRead' /usr/bin/ld: /home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:305: undefined reference to
UMRestoreNodeCoordArrayRead'
/usr/bin/ld: unfem.o: in function FormFunction': /home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:328: undefined reference to
UMGetNodeCoordArrayRead'
/usr/bin/ld: /home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:405: undefined reference to UMRestoreNodeCoordArrayRead' /usr/bin/ld: unfem.o: in function
FormPicard':
/home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:435: undefined reference to UMGetNodeCoordArrayRead' /usr/bin/ld: /home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:482: undefined reference to
UMRestoreNodeCoordArrayRead'
/usr/bin/ld: unfem.o: in function main': /home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:163: undefined reference to
UMInitialize'
/usr/bin/ld: /home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:164: undefined reference to UMReadNodes' /usr/bin/ld: /home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:165: undefined reference to
UMReadISs'
/usr/bin/ld: /home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:166: undefined reference to UMStats' /usr/bin/ld: /home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:173: undefined reference to
UMViewASCII'
/usr/bin/ld: /home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:282: undefined reference to UMViewSolutionBinary' /usr/bin/ld: /home/steve/PETSc/petsc/p4pdes-master/c/ch10/unfem.c:290: undefined reference to
UMDestroy'
collect2: error: ld returned 1 exit status
make: [makefile:6: unfem] Error 1 (ignored)
/usr/bin/rm -f unfem.o
also on um.c , 👍 (.text+0x1b): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: [makefile:12: um] Error 1 (ignored)
/usr/bin/rm -f um.o
root@steve-OMEN-by-HP-Laptop:/home/steve/PETSc/petsc/p4pdes-master/c/ch10#
This is surprising and I don't know what is going on. Your linker is not picking up um.h
. Note the line #include "um.h"
does appear at the top of um.c
and unfem.c
.
When I build unfem
it looks like this:
$ make unfem
/home/bueler/petsc/linux-c-dbg/bin/mpicc -o unfem.o -c -Wall -Wwrite-strings -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-stringop-overflow -fstack-protector -fvisibility=hidden -g3 -O0 -pedantic -std=c99 -I/home/bueler/petsc/include -I/home/bueler/petsc/linux-c-dbg/include `pwd`/unfem.c
/home/bueler/petsc/linux-c-dbg/bin/mpicc -o um.o -c -Wall -Wwrite-strings -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-stringop-overflow -fstack-protector -fvisibility=hidden -g3 -O0 -pedantic -std=c99 -I/home/bueler/petsc/include -I/home/bueler/petsc/linux-c-dbg/include `pwd`/um.c
/home/bueler/petsc/linux-c-dbg/bin/mpicc -Wall -Wwrite-strings -Wno-unknown-pragmas -Wno-lto-type-mismatch -Wno-stringop-overflow -fstack-protector -fvisibility=hidden -g3 -O0 -pedantic -std=c99 -o unfem unfem.o um.o -Wl,-rpath,/home/bueler/petsc/linux-c-dbg/lib -L/home/bueler/petsc/linux-c-dbg/lib -Wl,-rpath,/home/bueler/petsc/linux-c-dbg/lib -L/home/bueler/petsc/linux-c-dbg/lib -Wl,-rpath,/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11 -lpetsc -llapack -lblas -lm -lX11 -lmpifort -lmpi -lgfortran -lm -lgfortran -lm -lgcc_s -lquadmath -lstdc++
/usr/bin/rm -f unfem.o um.o
Some thoughts follow ...
What C compiler do you have? What does
$PETSC_DIR/$PETSC_ARCH/bin/mpicc --version
generate? (I get gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
.) But I can't imagine a C compiler for which this include fails.
What happens in e.g. Chapter 6, where there is also a local include? The following should work:
$ cd c/ch6/
$ make fish
Finally, do you have local modifications?
Also, if things are not resolved, can you let me know what your PETSc and p4pdes versions are? For the former you can do
$ grep PETSC_VERSION $PETSC_DIR/$PETSC_ARCH/lib/petsc/conf/configure.log
@ssilverman999 Feel free to close this issue if it is resolved for you. Otherwise let me know what you have found, and what is blocking? Thanks!
Closed because of lack of activity.