I think that I found a way to use my system's netcdf with libMesh (make check gave no errors).

- System: Parabola GNU/Linux x86_64 AMD Ryzen 2500
- PETSc from Git commit 5f77d1e0e5
- libMesh from Git commit 19706028f
- a bunch of packagees from repositories (cgns 3.4.0-2, hdf5-openmpi 1.10.5-1, hdf5-openmpi 1.10.5-1, netcdf-openmpi 4.7.1-2, paraview 5.7.0-3, pnetcdf-openmpi 1.12.0-1, python-h5py-openmpi 2.10.0-1, vtk 8.2.0-9, hwloc 2.1.0-2, metis 5.1.0.p7-1, openmp 9.0.0-2, openmpi 4.0.2-3, suitesparse 5.6.0-1, scotch 6.0.6-1) - some from AUR's user-contributed packages (fftw-mpi 3.3.8-1, hypre-sm 2.14.0-1, mumps 5.2.1-3, superlu 5.2.1-9)

If you want to try, my recipe is here:
https://notabug.org/broncodev/libmesh-pkgbuild.git (commit e3d46fc)
https://notabug.org/broncodev/petsc-pkgbuild.git (commit 3e9d679)

MUMPS is still not detected by libMesh :( .
Let me know if I did something unwise. Thanks!


On 2019-12-30 10:40, ed...@openmail.cc wrote:
I can still not compile with my system's netcdf. With this code, I can
compile and run a test:

  #+begin_SRC cpp
    #include "netcdf.h"

    int main(void){
             static int ncid;
             nc_create("test.nc", NC_NETCDF4|NC_CLOBBER, &ncid);}
  #+end_SRC

  #+begin_SRC bash
    gcc -Wall -lnetcdf -L/usr/lib -I/usr/include -o run-test test.cpp
    ./run-test
    ls test.nc
  #+end_SRC

  #+RESULTS:
  : test.nc

I added what I thought would be the same to netcdf.m4, but it seems
that it cannot compile. I show the relevant portions of the attached
file

  #+begin_SRC autoconf
    m4_define([_AX_CXX_COMPILE_NETCDF_preamble],
    [[
    @%:@include "netcdf.h"
    ]])

    m4_define([_AX_CXX_COMPILE_NETCDF_body],
    [[
    static int ncid;
    nc_create("test.nc", NC_NETCDF4|NC_CLOBBER, &ncid);
    ]])
  #+END_SRC

This message does not show up in the log

  #+begin_SRC autoconf
    AS_IF([test "$netcdfincFound" = "no"],
    [
    AC_MSG_RESULT(NETCDF header files not found!)
    enablenetcdf=no;
    ])
  #+end_SRC

So I think that this should work

  #+BEGIN_SRC autoconf
    NETCDF_INCLUDE="-I$NETCDF_INC"
  #+END_SRC
---8<--- snip
  #+begin_SRC autoconf
    AS_IF([test "x$RPATHFLAG" != "x" && test -d $NETCDF_LIB],
          [NETCDF_RPATH_FLAGS="${RPATHFLAG}${NETCDF_LIB}"
           NETCDF_LIBRARY="${RPATHFLAG}${NETCDF_LIB} $NETCDF_LIBRARY"
          ],
          [NETCDF_LIBRARY="-L${NETCDF_LIB} -lnetcdf $NETCDF_LIBRARY"])
    LIBS="$LIBS $NETCDF_LIBRARY"
    CPPFLAGS="$CPPFLAGS $NETCDF_INCLUDE"
  #+end_SRC

But I get the error from here

  #+begin_SRC autoconf

AC_LINK_IFELSE([AC_LANG_PROGRAM([_AX_CXX_COMPILE_NETCDF_preamble],[_AX_CXX_COMPILE_NETCDF_body])],
    [AC_DEFINE(HAVE_NETCDF, 1, [Flag indicating whether the library
will be compiled with Netcdf support])],
    [AC_MSG_ERROR(*** Linking a test program against the NETCDF
libraries failed)])
  #+end_SRC

What I find funny is that if I force

  #+begin_SRC autoconf
    LIBS="$LIBS -lnetcdf -L/usr/lib"
    CPPFLAGS="$CPPFLAGS -I/usr/include"
  #+end_SRC

then, configure runs well, but still picks up the =contrib/netcdf4=. I
think that I will live with this. I am sure that there is a silly
mistake. I hope that it is useful to others. If you want more
debugging information, let me know.

On 2019-12-30 00:21, ed...@openmail.cc wrote:
I attach a patch for netcdf.m4 which can help to use the system's
netcdf. Mind you, this is the first autoconf script that I prepare.
=make= is currently running. If there is a better solution, let me
know. You can also find the file here:
https://notabug.org/broncodev/libmesh-pkgbuild and you need to run
=autoconf= in the libmesh root directory

On 2019-12-25 13:40, ed...@openmail.cc wrote:
Hello,

Is there a way to use my system's netcdf instead of the one in the
contrib directory? Thanks!


-------------------------------------------------
This free account was provided by VFEmail.net - report spam to ab...@vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out
of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  15GB disk! No
bandwidth quotas!
Commercial and Bulk Mail Options!
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users


-------------------------------------------------
This free account was provided by VFEmail.net - report spam to ab...@vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out
of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  15GB disk! No
bandwidth quotas!
Commercial and Bulk Mail Options!
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to ab...@vfemail.net

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features! 15GB disk! No bandwidth quotas! Commercial and Bulk Mail Options!

_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to