From: <ed...@op...> - 2019-12-30 10:41:13
|
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...@op... 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...@op... 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...@vf... > > 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 > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libmesh-users ------------------------------------------------- This free account was provided by VFEmail.net - report spam to ab...@vf... 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! |