Skip to content

Commit

Permalink
Merge pull request #7574 from rakhmets/topic/fuse-static-link
Browse files Browse the repository at this point in the history
CONFIG/M4: Support static link of FUSE3 library.
  • Loading branch information
yosefe authored Nov 17, 2021
2 parents c8860e6 + e9583f9 commit 3edb6f3
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 13 deletions.
22 changes: 22 additions & 0 deletions buildlib/tools/builds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions buildlib/tools/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
47 changes: 35 additions & 12 deletions config/m4/fuse3.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -34,15 +53,19 @@ AS_IF([test "x$with_fuse3" != xno],
[[#define FUSE_USE_VERSION 30
#include <fuse.h>]])
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])]
)
Expand Down
1 change: 1 addition & 0 deletions src/tools/vfs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ucs/vfs/fuse/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3edb6f3

Please sign in to comment.