diff --git a/buildlib/tools/builds.sh b/buildlib/tools/builds.sh index fdd6f73637a..9daf4534a2f 100755 --- a/buildlib/tools/builds.sh +++ b/buildlib/tools/builds.sh @@ -350,6 +350,27 @@ build_cmake_examples() { fi } +# +# Build with FUSE +# +build_fuse() { + if az_module_load $FUSE3_MODULE + then + echo "==== Build with FUSE (dynamic link) ====" + ${WORKSPACE}/contrib/configure-devel --prefix=$ucx_inst --with-fuse3 + $MAKEP + make_clean distclean + + echo "==== Build with FUSE (static link) ====" + ${WORKSPACE}/contrib/configure-devel --prefix=$ucx_inst --with-fuse3-static + $MAKEP + + az_module_unload $FUSE3_MODULE + else + azure_log_warning "cannot load FUSE module, skipping build with FUSE" + fi +} + # # Do a given task and update progress indicator # @@ -380,6 +401,7 @@ do_task "${prog}" build_cuda do_task "${prog}" build_no_verbs do_task "${prog}" build_release_pkg do_task "${prog}" build_cmake_examples +do_task "${prog}" build_fuse if [ "${long_test}" = "yes" ] then diff --git a/buildlib/tools/common.sh b/buildlib/tools/common.sh index 015d1506192..e375203ceeb 100644 --- a/buildlib/tools/common.sh +++ b/buildlib/tools/common.sh @@ -13,6 +13,7 @@ PGI_MODULE="hpc-sdk/nvhpc/21.2" GCC_MODULE="dev/gcc-10.1.0" ARM_MODULE="arm-compiler/armcc-19.0" INTEL_MODULE="intel/ics-19.1.1" +FUSE3_MODULE="dev/fuse-3.10.5" # # Parallel build command runs with 4 tasks, or number of cores on the system, diff --git a/config/m4/fuse3.m4 b/config/m4/fuse3.m4 index c79b31a5019..aaf59550c42 100644 --- a/config/m4/fuse3.m4 +++ b/config/m4/fuse3.m4 @@ -10,21 +10,40 @@ AC_ARG_WITH([fuse3], [Enable the use of FUSEv3 (default is guess).])], [], [with_fuse3=guess]) -AS_IF([test "x$with_fuse3" != xno], +AC_ARG_WITH([fuse3-static], + [AS_HELP_STRING([--with-fuse3-static=(DIR)], + [Static link FUSEv3 library (default is no).])], + [], [with_fuse3_static=no]) + +AS_IF([test "x$with_fuse3" != "xno" -o "x$with_fuse3_static" != "xno"], [ - AS_IF([test "x$with_fuse3" = "xguess" \ - -o "x$with_fuse3" = "xyes" \ - -o "x$with_fuse3" = "x"], - [FUSE3_CPPFLAGS=$(pkg-config --cflags fuse3) - FUSE3_LIBS=$(pkg-config --libs fuse3)], - [FUSE3_CPPFLAGS="-I${with_fuse3}/include/fuse3" - FUSE3_LIBS="-L${with_fuse3}/lib -L${with_fuse3}/lib64"]) + AS_IF([test "x$with_fuse3_static" != "xno"], + [with_fuse3="$with_fuse3_static"]) + + save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" + + AS_IF([test "x$with_fuse3" != "xguess" \ + -a "x$with_fuse3" != "xyes" \ + -a "x$with_fuse3" != "x"], + [AS_IF([test -d "$with_fuse3/lib64"], + [libsuff="64"], [libsuff=""]) + ucx_fuse3_pkgconfig="$with_fuse3/lib$libsuff/pkgconfig" + export PKG_CONFIG_PATH="$ucx_fuse3_pkgconfig:$PKG_CONFIG_PATH"]) + + FUSE3_CPPFLAGS=$(pkg-config --cflags-only-I fuse3) + FUSE3_LDFLAGS=$(pkg-config --libs-only-L fuse3) + AS_IF([test "x$with_fuse3_static" != "xno"], + [FUSE3_LIBS=$(pkg-config --libs-only-l --static fuse3) + FUSE3_LIBS=${FUSE3_LIBS//"-lfuse3"/"-l:libfuse3.a"}], + [FUSE3_LIBS=$(pkg-config --libs-only-l fuse3)]) save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" + save_LIBS="$LIBS" CPPFLAGS="$FUSE3_CPPFLAGS $CPPFLAGS" - LDFLAGS="$FUSE3_LIBS $LDFLAGS" + LDFLAGS="$FUSE3_LDFLAGS $LDFLAGS" + LIBS="$FUSE3_LIBS $LIBS" fuse3_happy="yes" AC_CHECK_DECLS([fuse_open_channel, fuse_mount, fuse_unmount], @@ -34,15 +53,19 @@ AS_IF([test "x$with_fuse3" != xno], [[#define FUSE_USE_VERSION 30 #include ]]) - AC_CHECK_FUNCS([fuse_open_channel fuse_mount fuse_unmount], - [AC_SUBST([FUSE3_LIBS], [$FUSE3_LIBS])], - [fuse3_happy="no"]) + AS_IF([test "x$fuse3_happy" = "xyes"], + [AC_CHECK_FUNCS([fuse_open_channel fuse_mount fuse_unmount], + [AC_SUBST([FUSE3_LIBS], ["$FUSE3_LIBS"]) + AC_SUBST([FUSE3_LDFLAGS], [$FUSE3_LDFLAGS])], + [fuse3_happy="no"])]) AS_IF([test "x$fuse3_happy" != "xyes" -a "x$with_fuse3" != "xguess"], [AC_MSG_ERROR([FUSEv3 requested but could not be found])]) CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH" ], [AC_MSG_WARN([FUSEv3 was explicitly disabled])] ) diff --git a/src/tools/vfs/Makefile.am b/src/tools/vfs/Makefile.am index 62408f8aea7..fa52b1c3741 100644 --- a/src/tools/vfs/Makefile.am +++ b/src/tools/vfs/Makefile.am @@ -8,6 +8,7 @@ if HAVE_FUSE3 bin_PROGRAMS = ucx_vfs ucx_vfs_CPPFLAGS = $(BASE_CPPFLAGS) $(FUSE3_CPPFLAGS) +ucx_vfs_LDFLAGS = $(FUSE3_LDFLAGS) ucx_vfs_CFLAGS = $(BASE_CFLAGS) ucx_vfs_SOURCES = vfs_main.c vfs_server.c noinst_HEADERS = vfs_daemon.h diff --git a/src/ucs/vfs/fuse/Makefile.am b/src/ucs/vfs/fuse/Makefile.am index 66915040cb8..d7c5433bb32 100644 --- a/src/ucs/vfs/fuse/Makefile.am +++ b/src/ucs/vfs/fuse/Makefile.am @@ -12,7 +12,7 @@ libucs_fuse_la_CFLAGS = $(BASE_CFLAGS) libucs_fuse_la_LIBADD = $(FUSE3_LIBS) \ $(top_builddir)/src/ucs/vfs/sock/libucs_vfs_sock.la \ $(top_builddir)/src/ucs/libucs.la -libucs_fuse_la_LDFLAGS = -version-info $(SOVERSION) +libucs_fuse_la_LDFLAGS = $(FUSE3_LDFLAGS) -version-info $(SOVERSION) libucs_fuse_la_SOURCES = vfs_fuse.c include $(top_srcdir)/config/module.am