<div dir="ltr"><div class="gmail_default" style="font-size:large">Here are the ldd outputs: </div><div class="gmail_default" style="font-size:large">>> ldd petsc_3.18_gnu/arch-linux-c-debug/lib/libpetsc.so<br> linux-vdso.so.1 => (0x00007f23e5ff2000)<br> libflexiblas.so.3 => /cluster/software/FlexiBLAS/3.0.4-GCC-11.2.0/lib/libflexiblas.so.3 (0x00007f23e1b60000)<br> libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007f23e1944000)<br> libm.so.6 => /usr/lib64/libm.so.6 (0x00007f23e1642000)<br> libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007f23e143e000)<br> libmpi_usempif08.so.40 => /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libmpi_usempif08.so.40 (0x00007f23e5fb0000)<br> libmpi_usempi_ignore_tkr.so.40 => /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libmpi_usempi_ignore_tkr.so.40 (0x00007f23e5fa2000)<br> libmpi_mpifh.so.40 => /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libmpi_mpifh.so.40 (0x00007f23e5f2a000)<br> libmpi.so.40 => /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libmpi.so.40 (0x00007f23e5e18000)<br> libgfortran.so.5 => /cluster/software/GCCcore/11.2.0/lib64/libgfortran.so.5 (0x00007f23e1191000)<br> libgcc_s.so.1 => /cluster/software/GCCcore/11.2.0/lib64/libgcc_s.so.1 (0x00007f23e5dfe000)<br> libquadmath.so.0 => /cluster/software/GCCcore/11.2.0/lib64/libquadmath.so.0 (0x00007f23e1149000)<br> libc.so.6 => /usr/lib64/libc.so.6 (0x00007f23e0d7b000)<br> /lib64/ld-linux-x86-64.so.2 (0x00007f23e5dd3000)<br> libopen-rte.so.40 => /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libopen-rte.so.40 (0x00007f23e0cbf000)<br> libopen-orted-mpir.so => /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libopen-orted-mpir.so (0x00007f23e5df9000)<br> libopen-pal.so.40 => /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libopen-pal.so.40 (0x00007f23e0c0b000)<br> librt.so.1 => /lib64/librt.so.1 (0x00007f23e09f6000)<br> libutil.so.1 => /lib64/libutil.so.1 (0x00007f23e07f3000)<br> libhwloc.so.15 => /cluster/software/hwloc/2.5.0-GCCcore-11.2.0/lib/libhwloc.so.15 (0x00007f23e0796000)<br> libpciaccess.so.0 => /cluster/software/libpciaccess/0.16-GCCcore-11.2.0/lib/libpciaccess.so.0 (0x00007f23e078b000)<br> libxml2.so.2 => /cluster/software/libxml2/2.9.10-GCCcore-11.2.0/lib/libxml2.so.2 (0x00007f23e0617000)<br> libz.so.1 => /cluster/software/zlib/1.2.11-GCCcore-11.2.0/lib/libz.so.1 (0x00007f23e05fe000)<br> liblzma.so.5 => /cluster/software/XZ/5.2.5-GCCcore-11.2.0/lib/liblzma.so.5 (0x00007f23e05d6000)<br> libevent_core-2.0.so.5 => /lib64/libevent_core-2.0.so.5 (0x00007f23e03ab000)<br> libevent_pthreads-2.0.so.5 => /lib64/libevent_pthreads-2.0.so.5 (0x00007f23e01a8000)<br></div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">And /cluster/software/GCCcore/11.2.0 is pretty recent (around 2020/2021). You can see that I am using openmpi. Now I am trying compiling petsc without MPI.</div><div class="gmail_default" style="font-size:large"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 8, 2022 at 4:43 PM Satish Balay <<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, 8 Nov 2022, Satish Balay via petsc-users wrote:<br>
<br>
> You don't see 'libstdc++' in the output from 'ldd libptsc.so' below - so there is no reference<br>
> to libstdc++ from petsc<br>
> <br>
> Try a clean build of PETSc and see if you still have these issues.<br>
> <br>
> ./configure --with-cc=gcc --with-cxx=0 --with-fc=gfortran --download-fblaslapack --download-mpich<br>
<br>
Perhaps good to also add: --with-hwloc=0<br>
<br>
Satish<br>
<br>
> <br>
> Another way to avoid this issue is to use /usr/bin/gcc, gfortran - i.e avoid using tools from /cluster/software/GCCcore<br>
> Are they super old versions - that are not suitable?<br>
> <br>
> Satish<br>
> <br>
> <br>
> <br>
> On Tue, 8 Nov 2022, Jianbo Long wrote:<br>
> <br>
> > I am suspecting something else as well ...<br>
> > <br>
> > Could you elaborate more about "mixing c++ codes compiled with /usr/bin/g++<br>
> > and compilers in /cluster/software/GCCcore/11.2.0" ? My own Fortran code<br>
> > does not have any c++ codes, and for some reason, the compiled petsc<br>
> > library is dependent on this libstdc++.so.6. I am sure about this because<br>
> > without linking the petsc, I don't have this libstdc++ trouble.<br>
> > <br>
> > Thanks,<br>
> > Jianbo<br>
> > <br>
> > On Mon, Nov 7, 2022 at 7:10 PM Satish Balay <<a href="mailto:balay@mcs.anl.gov" target="_blank">balay@mcs.anl.gov</a>> wrote:<br>
> > <br>
> > > Likely due to mixing c++ codes compiled with /usr/bin/g++ and compilers in<br>
> > > /cluster/software/GCCcore/11.2.0<br>
> > ><br>
> > > if you still get this with --with-cxx=0 - then the issue with some other<br>
> > > [non-petsc library]<br>
> > ><br>
> > > Satish<br>
> > ><br>
> > > On Mon, 7 Nov 2022, Jianbo Long wrote:<br>
> > ><br>
> > > > Hi Satish,<br>
> > > ><br>
> > > > I wonder if you know anything about another issue: after compiling petsc<br>
> > > on<br>
> > > > a cluster, when I tried to link my Fortran code with compiled<br>
> > > libpetsc.so,<br>
> > > > the shared library, I got the following errors:<br>
> > > > /cluster/software/binutils/2.37-GCCcore-11.2.0/bin/ld.gold:<br>
> > > > /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by<br>
> > > > /cluster/software/binutils/2.37-GCCcore-11.2.0/bin/ld.gold)<br>
> > > > /cluster/software/binutils/2.37-GCCcore-11.2.0/bin/ld.gold:<br>
> > > > /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by<br>
> > > > /cluster/software/binutils/2.37-GCCcore-11.2.0/bin/ld.gold)<br>
> > > > /cluster/software/binutils/2.37-GCCcore-11.2.0/bin/ld.gold:<br>
> > > > /lib64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by<br>
> > > > /cluster/software/binutils/2.37-GCCcore-11.2.0/bin/ld.gold)<br>
> > > > /cluster/software/binutils/2.37-GCCcore-11.2.0/bin/ld.gold:<br>
> > > > /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by<br>
> > > > /cluster/software/binutils/2.37-GCCcore-11.2.0/bin/ld.gold)<br>
> > > > /cluster/software/binutils/2.37-GCCcore-11.2.0/bin/ld.gold:<br>
> > > > /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by<br>
> > > > /cluster/software/binutils/2.37-GCCcore-11.2.0/bin/ld.gold)<br>
> > > ><br>
> > > > Not sure if it is related to discussion in this post (<br>
> > > > <a href="https://gitlab.com/petsc/petsc/-/issues/997" rel="noreferrer" target="_blank">https://gitlab.com/petsc/petsc/-/issues/997</a>), but after I tried the<br>
> > > > configure option --with-cxx=0, I still got the same errors.<br>
> > > > My make.log file for compiling petsc is attached here. Also, the<br>
> > > > dependencies of the compiled petsc is:<br>
> > > ><br>
> > > > >>: ldd arch-linux-c-debug/lib/libpetsc.so<br>
> > > > linux-vdso.so.1 => (0x00007ffd80348000)<br>
> > > > libflexiblas.so.3 =><br>
> > > > /cluster/software/FlexiBLAS/3.0.4-GCC-11.2.0/lib/libflexiblas.so.3<br>
> > > > (0x00007f6e8b93f000)<br>
> > > > libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007f6e8b723000)<br>
> > > > libm.so.6 => /usr/lib64/libm.so.6 (0x00007f6e8b421000)<br>
> > > > libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007f6e8b21d000)<br>
> > > > libmpi_usempif08.so.40 =><br>
> > > > /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libmpi_usempif08.so.40<br>
> > > > (0x00007f6e8fd92000)<br>
> > > > libmpi_usempi_ignore_tkr.so.40 =><br>
> > > ><br>
> > > /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libmpi_usempi_ignore_tkr.so.40<br>
> > > > (0x00007f6e8fd84000)<br>
> > > > libmpi_mpifh.so.40 =><br>
> > > > /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libmpi_mpifh.so.40<br>
> > > > (0x00007f6e8fd0c000)<br>
> > > > libmpi.so.40 =><br>
> > > /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libmpi.so.40<br>
> > > > (0x00007f6e8fbfa000)<br>
> > > > libgfortran.so.5 =><br>
> > > /cluster/software/GCCcore/11.2.0/lib64/libgfortran.so.5<br>
> > > > (0x00007f6e8af70000)<br>
> > > > libgcc_s.so.1 => /cluster/software/GCCcore/11.2.0/lib64/libgcc_s.so.1<br>
> > > > (0x00007f6e8fbe0000)<br>
> > > > libquadmath.so.0 =><br>
> > > /cluster/software/GCCcore/11.2.0/lib64/libquadmath.so.0<br>
> > > > (0x00007f6e8af28000)<br>
> > > > libc.so.6 => /usr/lib64/libc.so.6 (0x00007f6e8ab5a000)<br>
> > > > /lib64/ld-linux-x86-64.so.2 (0x00007f6e8fbb3000)<br>
> > > > libopen-rte.so.40 =><br>
> > > > /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libopen-rte.so.40<br>
> > > > (0x00007f6e8aa9e000)<br>
> > > > libopen-orted-mpir.so =><br>
> > > > /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libopen-orted-mpir.so<br>
> > > > (0x00007f6e8fbdb000)<br>
> > > > libopen-pal.so.40 =><br>
> > > > /cluster/software/OpenMPI/4.1.1-GCC-11.2.0/lib/libopen-pal.so.40<br>
> > > > (0x00007f6e8a9ea000)<br>
> > > > librt.so.1 => /lib64/librt.so.1 (0x00007f6e8a7d5000)<br>
> > > > libutil.so.1 => /lib64/libutil.so.1 (0x00007f6e8a5d2000)<br>
> > > > libhwloc.so.15 =><br>
> > > > /cluster/software/hwloc/2.5.0-GCCcore-11.2.0/lib/libhwloc.so.15<br>
> > > > (0x00007f6e8a575000)<br>
> > > > libpciaccess.so.0 =><br>
> > > > /cluster/software/libpciaccess/0.16-GCCcore-11.2.0/lib/libpciaccess.so.0<br>
> > > > (0x00007f6e8a56a000)<br>
> > > > libxml2.so.2 =><br>
> > > > /cluster/software/libxml2/2.9.10-GCCcore-11.2.0/lib/libxml2.so.2<br>
> > > > (0x00007f6e8a3f6000)<br>
> > > > libz.so.1 => /cluster/software/zlib/1.2.11-GCCcore-11.2.0/lib/libz.so.1<br>
> > > > (0x00007f6e8a3dd000)<br>
> > > > liblzma.so.5 =><br>
> > > /cluster/software/XZ/5.2.5-GCCcore-11.2.0/lib/liblzma.so.5<br>
> > > > (0x00007f6e8a3b5000)<br>
> > > > libevent_core-2.0.so.5 => /lib64/libevent_core-2.0.so.5<br>
> > > (0x00007f6e8a18a000)<br>
> > > > libevent_pthreads-2.0.so.5 => /lib64/libevent_pthreads-2.0.so.5<br>
> > > > (0x00007f6e89f87000)<br>
> > > ><br>
> > > > Thanks very much,<br>
> > > > Jianbo<br>
> > > ><br>
> > > > On Mon, Nov 7, 2022 at 6:01 PM Satish Balay <<a href="mailto:balay@mcs.anl.gov" target="_blank">balay@mcs.anl.gov</a>> wrote:<br>
> > > ><br>
> > > > > Glad you have it working. Thanks for the update.<br>
> > > > ><br>
> > > > > Satish<br>
> > > > ><br>
> > > > > On Mon, 7 Nov 2022, Jianbo Long wrote:<br>
> > > > ><br>
> > > > > > Hi Satish and Barry,<br>
> > > > > ><br>
> > > > > > Thanks very much for the feedback !<br>
> > > > > ><br>
> > > > > > It looks like my include file path was not correct !<br>
> > > > > ><br>
> > > > > > Bests,<br>
> > > > > > Jianbo<br>
> > > > > ><br>
> > > > > ><br>
> > > > > > On Fri, Nov 4, 2022 at 6:08 AM Satish Balay <<a href="mailto:balay@mcs.anl.gov" target="_blank">balay@mcs.anl.gov</a>><br>
> > > wrote:<br>
> > > > > ><br>
> > > > > > > For ex83f.F90:<br>
> > > > > > ><br>
> > > > > > > >>>>><br>
> > > > > > > balay@p1 /home/balay/test<br>
> > > > > > > $ ls<br>
> > > > > > > ex83f.F90<br>
> > > > > > > balay@p1 /home/balay/test<br>
> > > > > > > $ ls<br>
> > > > > > > ex83f.F90<br>
> > > > > > > balay@p1 /home/balay/test<br>
> > > > > > > $ export PETSC_DIR=$HOME/petsc<br>
> > > > > > > balay@p1 /home/balay/test<br>
> > > > > > > $ cp $PETSC_DIR/src/ksp/ksp/tests/makefile .<br>
> > > > > > > balay@p1 /home/balay/test<br>
> > > > > > > $ make ex83f<br>
> > > > > > > mpif90 -fPIC -Wall -ffree-line-length-none -ffree-line-length-0<br>
> > > > > > > -Wno-lto-type-mismatch -Wno-unused-dummy-argument -g -O0<br>
> > > > > > > -I/home/balay/petsc/include<br>
> > > > > > > -I/home/balay/petsc/arch-linux-c-debug/include ex83f.F90<br>
> > > > > > > -Wl,-rpath,/home/balay/petsc/arch-linux-c-debug/lib<br>
> > > > > > > -L/home/balay/petsc/arch-linux-c-debug/lib<br>
> > > > > > > -Wl,-rpath,/home/balay/soft/mpich-4.0.1/lib<br>
> > > > > > > -L/home/balay/soft/mpich-4.0.1/lib<br>
> > > > > > > -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/12<br>
> > > > > > > -L/usr/lib/gcc/x86_64-redhat-linux/12 -lpetsc -llapack -lblas -lm<br>
> > > -lX11<br>
> > > > > > > -lstdc++ -ldl -lmpifort -lmpi -lgfortran -lm -lgfortran -lm -lgcc_s<br>
> > > > > > > -lquadmath -lstdc++ -ldl -o ex83f<br>
> > > > > > > balay@p1 /home/balay/test<br>
> > > > > > > $<br>
> > > > > > > <<<<<<<br>
> > > > > > ><br>
> > > > > > > Also when you are adding PETSc to your current project - are you<br>
> > > using<br>
> > > > > > > source files with .f or .f90 suffix? If so rename them to .F or<br>
> > > .F90<br>
> > > > > suffix.<br>
> > > > > > ><br>
> > > > > > > If you still have issues send more details - As Barry indicated -<br>
> > > the<br>
> > > > > > > makefile [with the sources compiled by this makefile] - and the<br>
> > > > > compile log<br>
> > > > > > > when you attempt to build these sources with this makefile.<br>
> > > > > > ><br>
> > > > > > > Satish<br>
> > > > > > ><br>
> > > > > > > On Thu, 3 Nov 2022, Barry Smith wrote:<br>
> > > > > > ><br>
> > > > > > > ><br>
> > > > > > > > Please send your attempted makefile and we'll see if we can get<br>
> > > it<br>
> > > > > > > working.<br>
> > > > > > > ><br>
> > > > > > > > I am not sure if we can organize the include files as Fortran<br>
> > > > > compiler<br>
> > > > > > > include files easily. We've always used the preprocessor approach.<br>
> > > The<br>
> > > > > > > Intel compiler docs indicate the procedure for finding the Fortran<br>
> > > > > compiler<br>
> > > > > > > include files<br>
> > > > > > ><br>
> > > > ><br>
> > > <a href="https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/program-structure/use-include-files.html" rel="noreferrer" target="_blank">https://www.intel.com/content/www/us/en/develop/documentation/fortran-compiler-oneapi-dev-guide-and-reference/top/program-structure/use-include-files.html</a><br>
> > > > > > > is the same as for the preprocessor include files so I don't<br>
> > > > > understand how<br>
> > > > > > > the using the Fortran compiler include file approach would make the<br>
> > > > > > > makefiles any simpler for users?<br>
> > > > > > > ><br>
> > > > > > > ><br>
> > > > > > > > Barry<br>
> > > > > > > ><br>
> > > > > > > ><br>
> > > > > > > > > On Nov 3, 2022, at 8:58 PM, Jianbo Long <<br>
> > > <a href="mailto:longtuteng249@gmail.com" target="_blank">longtuteng249@gmail.com</a>><br>
> > > > > > > wrote:<br>
> > > > > > > > ><br>
> > > > > > > > > Hello,<br>
> > > > > > > > ><br>
> > > > > > > > > I'm struggling to make my FORTRAN code work with petsc as I<br>
> > > cannot<br>
> > > > > > > link the required header files (e.g., petscksp.h) and compiled<br>
> > > library<br>
> > > > > > > files to my FORTRAN code.<br>
> > > > > > > > ><br>
> > > > > > > > > Compiling petsc was not a problem. However, even with the<br>
> > > fortran<br>
> > > > > > > examples (see those on <a href="https://petsc.org/main/docs/manual/fortran/" rel="noreferrer" target="_blank">https://petsc.org/main/docs/manual/fortran/</a><br>
> > > )<br>
> > > > > and<br>
> > > > > > > the guide on using petsc in c++ and fortran codes (see Section<br>
> > > "Writing<br>
> > > > > > > C/C++ or Fortran Applications" at<br>
> > > > > > > <a href="https://petsc.org/main/docs/manual/getting_started/" rel="noreferrer" target="_blank">https://petsc.org/main/docs/manual/getting_started/</a>), I still<br>
> > > cannot<br>
> > > > > make<br>
> > > > > > > my FORTRAN code work.<br>
> > > > > > > > ><br>
> > > > > > > > > The Fortran test code is exactly the example code ex83f.F90<br>
> > > (see<br>
> > > > > > > attached files). Aftering following the 2nd method in the Guide<br>
> > > (see<br>
> > > > > the<br>
> > > > > > > picture below), I still get errors:<br>
> > > > > > > > ><br>
> > > > > > > > > petsc/finclude/petscksp.h: No such file or directory<br>
> > > > > > > > ><br>
> > > > > > > > > Even if I set up the path of the header file correctly in my<br>
> > > own<br>
> > > > > > > makefile without using environment variables, I still can only<br>
> > > find the<br>
> > > > > > > file "petscksp.h" for my code. Of course, the trouble is that all<br>
> > > other<br>
> > > > > > > headers files required by KSP are recursively included in this<br>
> > > > > petscksp.h<br>
> > > > > > > file, and I have no way to link them together for my Fortran code.<br>
> > > > > > > > ><br>
> > > > > > > > > So, here are my questions:<br>
> > > > > > > > > 1) in the Guide, how exactly are we supposed to set up the<br>
> > > > > environment<br>
> > > > > > > variables PETSC_DIR and PETSC_ARCH ? More details and examples<br>
> > > would<br>
> > > > > be<br>
> > > > > > > extremely helpful !<br>
> > > > > > > > > 2) Is there a way to get rid of the preprocessor statement<br>
> > > > > > > > > #include <petsc/finclude/petscvec.h><br>
> > > > > > > > > when using c++/Fortran codes ?<br>
> > > > > > > > ><br>
> > > > > > > > > For example, when using MUMPS package in a Fortran code, we can<br>
> > > > > simply<br>
> > > > > > > use compiler 'include', rather than a preprocessor, to extract all<br>
> > > > > required<br>
> > > > > > > variables for the user's codes :<br>
> > > > > > > > > INCLUDE 'zmumps_struc.h'<br>
> > > > > > > > > where the header file zmumps_struc.h is already provided in the<br>
> > > > > > > package. Similarly, I think it's much more portable and easier when<br>
> > > > > using<br>
> > > > > > > petsc in other codes if we can make it work to use petsc.<br>
> > > > > > > > ><br>
> > > > > > > > > (Note: similar issues were discussed before, see<br>
> > > > > > ><br>
> > > > ><br>
> > > <a href="https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2019-January/037499.html" rel="noreferrer" target="_blank">https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2019-January/037499.html</a><br>
> > > > > .<br>
> > > > > > > Unfortunately, I have no clue about the solution archived there<br>
> > > ...)<br>
> > > > > > > > ><br>
> > > > > > > > > Any thoughts and solutions would be much appreciated !<br>
> > > > > > > > ><br>
> > > > > > > > > Thanks,<br>
> > > > > > > > > Jianbo Long<br>
> > > > > > > > ><br>
> > > > > > > > > <image.png><br>
> > > > > > > > > <ex83f.F90><br>
> > > > > > > ><br>
> > > > > > > ><br>
> > > > > > ><br>
> > > > > > ><br>
> > > > > ><br>
> > > > ><br>
> > > > ><br>
> > > ><br>
> > ><br>
> > ><br>
> > <br>
> <br>
<br>
</blockquote></div>