From acbbfe63e9763cbbe59ec6c5bd5abb4897ef524d Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Fri, 26 Feb 2021 15:27:25 -0600 Subject: [PATCH 1/4] adding in Ward's changed to support github actions --- .github/workflows/test.yml | 51 ++++++++++++++++++++++++++++++++++++++ Makefile.in | 3 +++ configure.ac | 26 +++++++++++++++---- embed/Makefile | 4 +-- pkgs/tcl2lua/Makefile | 4 +-- 5 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..d2bf5b027 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,51 @@ +name: run Lmod tests +on: [push, pull_request] + +jobs: + Lmod_tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + luaVersion: ["5.1", "5.2", "5.3", "5.4"] + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: install dependencies MacOS + if: matrix.os == 'macos-latest' + run: brew install coreutils + - name: install dependencies Linux + if: matrix.os == 'ubuntu-latest' + run: sudo apt install tcsh tcl8.6 tcl8.6-dev uuid r-base r-base-dev cmake fish tclsh zsh + - name: set up lua + uses: leafo/gh-actions-lua@v8.0.0 + with: + luaVersion: ${{ matrix.luaVersion }} + - name: install luarocks + uses: leafo/gh-actions-luarocks@v4.0.0 + - name: install lua dependencies + run: | + luarocks install luaposix + luarocks install luafileSystem + luarocks install luajson + luarocks install lua-term + - name: set up Hermes + run: | + cd /tmp + git clone https://github.com/rtmclay/Hermes.git + echo "$PWD/Hermes/bin" >> $GITHUB_PATH + cd - + - name: Run tests + run: tm + - name: show output of failed tests + if: ${{ failure() }} + run: | + # diff stdout/stderr for all tests in case of failure + for dir in $(ls -pd rt/* | grep '/$'); do + echo ">>>> ${dir}/err.txt" + diff -u ${dir}/t1/*/_err.left ${dir}/t1/*/_err.right || echo + echo ">>>> ${dir}/out.txt" + diff -u ${dir}/out.txt ${dir}/t1/*/out.txt || echo + done + echo ">>>> end2end output" + cat rt/end2end/t1/*/t1.log diff --git a/Makefile.in b/Makefile.in index eb0193248..2124872e4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -185,6 +185,8 @@ ifneq ($(HAVE_LUAFILESYSTEM),yes) PKG_LFS := lfs endif FAST_TCL_INTERP := @FAST_TCL_INTERP@ +TCL_INCLUDE := @TCL_INCLUDE@ +TCL_LIBS := @TCL_LIBS@ ifeq ($(FAST_TCL_INTERP),yes) PKGS := $(PKGS) tcl2lua PKG_T2L := tcl2lua @@ -344,6 +346,7 @@ src/computeHashSum: $(ComputeHashSum) tcl2lua: if [ -d $(srcdir)/pkgs/tcl2lua ]; then \ $(MAKE) -C $(srcdir)/pkgs/tcl2lua LUA_INC=$(LUA_INCLUDE) \ + TCL_INCLUDE=$(TCL_INCLUDE) TCL_LIBS=$(TCL_LIBS) \ LIB=$(DESTDIR)$(LIB) LIBS=@LIBS@ CC=$(CC) \ SHARE=$(DESTDIR)$(LIBEXEC) \ install; \ diff --git a/configure.ac b/configure.ac index 7714e891b..697b14286 100644 --- a/configure.ac +++ b/configure.ac @@ -615,14 +615,27 @@ if test "$ALLOW_TCL_MFILES" = no ; then fi if test "$FAST_TCL_INTERP" = yes ; then + TCL_INCLUDE=/usr/include/tcl + TCL_LIBS="-ltcl" OS=$(uname -s) - DIR=/usr/include/tcl if test "$OS" = Darwin ; then - DIR=$(xcrun --show-sdk-path) - DIR=${DIR}/usr/include + TCL_INCLUDE=$(xcrun --show-sdk-path) + TCL_INCLUDE=${DIR}/usr/include fi - CPPFLAGS="-I $DIR" + AC_PATH_PROG(pkgConfig, pkg-config, "") + if ! test x$pkgConfig = "x"; then + for i in tcl tcl8.8 tcl8.7 tcl8.6 tcl8.5; do + $pkgConfig --exists $i + if test $? = 0; then + TCL_INCLUDE=`$pkgConfig --cflags $i | sed -e 's/^-I//' -e 's/ //g'` + TCL_LIBS=`$pkgConfig --libs $i` + break + fi + done + fi + + CPPFLAGS="-I $TCL_INCLUDE" AC_CHECK_HEADER(tcl.h, [AC_DEFINE([HAVE_TCL_H], 1, [Define to 1 if you have tcl.h])],[]) @@ -632,7 +645,10 @@ if test "$FAST_TCL_INTERP" = yes ; then AC_MSG_ERROR([Unable to build Lmod without tcl.h. Please install the tcl devel package or configure --with-fastTCLInterp=no to not require tcl.h]) fi AC_SEARCH_LIBS(Tcl_CreateInterp,[tcl] [tcl8.8] [tcl8.7] [tcl8.6] [tcl8.5],[], - [rm -f makefile; AC_MSG_ERROR([Unable to build Lmod with -ltcl Please install the tcl devel package or configure --with-fastTCLInterp=no to not require the tcl library])]) + [rm -f makefile; AC_MSG_ERROR([Unable to build Lmod with -ltcl Please install the tcl devel package or configure --with-fastTCLInterp=no to not require the tcl library])], [$TCL_LIBS]) + + AC_SUBST(TCL_INCLUDE, "$TCL_INCLUDE") + AC_SUBST(TCL_LIBS, "$TCL_LIBS") fi AC_SUBST(SYS_LD_LIB_PATH) diff --git a/embed/Makefile b/embed/Makefile index 6cd495246..cc12ebb7c 100644 --- a/embed/Makefile +++ b/embed/Makefile @@ -6,7 +6,7 @@ OBJ := $(patsubst %.c, %.o, $(SRC)) LUAINC := /opt/apps/lua/lua/include OS := $(shell uname -s) -override CFLAGS := $(CFLAGS) -DLUA_COMPAT_MODULE -fPIC -I $(LUAINC) -I /usr/include/tcl +override CFLAGS := $(CFLAGS) -DLUA_COMPAT_MODULE -fPIC -I $(LUAINC) -I $(TCL_INCLUDE) ifeq ($(OS),Darwin) LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X @@ -23,7 +23,7 @@ $(SONAME): ln -s $(SONAMEV) $@ $(LIBRARY): $(OBJ) - $(CC) $(CFLAGS) $(LIB_OPTION) -o $(LIBRARY) $(OBJ) -lc -ltcl + $(CC) $(CFLAGS) $(LIB_OPTION) -o $(LIBRARY) $(OBJ) -lc $(TCL_LIBS) install: all cp $(LIBRARY) $(LUA_LIB) diff --git a/pkgs/tcl2lua/Makefile b/pkgs/tcl2lua/Makefile index 91970a6a0..cb84b1d9c 100644 --- a/pkgs/tcl2lua/Makefile +++ b/pkgs/tcl2lua/Makefile @@ -11,7 +11,7 @@ ifeq ($(OS),Darwin) DIR := $(DIR)/usr/include LIB_OPTION := -bundle -undefined dynamic_lookup #for MacOS X else - DIR := /usr/include/tcl + DIR := $(TCL_INCLUDE) LIB_OPTION := -shared -Wl,-soname,$(SONAMEV) #for Linux endif override CFLAGS := $(CFLAGS) -DLUA_COMPAT_MODULE -fPIC $(LUA_INC) -I $(DIR) @@ -25,7 +25,7 @@ $(SONAME): ln -s $(SONAMEV) $@ $(LIBRARY): $(OBJ) - $(CC) $(CFLAGS) $(LIB_OPTION) -o $(LIBRARY) $(OBJ) $(LDFLAGS) -lc $(LIBS) + $(CC) $(CFLAGS) $(LIB_OPTION) -o $(LIBRARY) $(OBJ) $(LDFLAGS) -lc $(LIBS) $(TCL_LIBS) install: all cp -a *.so* $(LIB) From 85b73f0b785c8cf81e35826c2b6a1079499d699c Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Fri, 26 Feb 2021 15:35:54 -0600 Subject: [PATCH 2/4] updating configure to match --- configure | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 79 insertions(+), 7 deletions(-) diff --git a/configure b/configure index d3c56cacb..fe15c80de 100755 --- a/configure +++ b/configure @@ -624,7 +624,6 @@ ac_subst_vars='LTLIBOBJS LIBOBJS ZSH ZSH_SITE_FUNCTIONS_DIRS -pkgConfig HAVE_LUA_TERM HAVE_LUAFILESYSTEM SYS_LUA_CPATH @@ -643,9 +642,12 @@ BASENAME PATH_TO_SRC SYS_LD_PRELOAD SYS_LD_LIB_PATH +TCL_LIBS +TCL_INCLUDE EGREP GREP CPP +pkgConfig LUA_SUFFIX PATH_TO_LUAC PATH_TO_LUA @@ -714,6 +716,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -826,6 +829,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -1078,6 +1082,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1215,7 +1228,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1368,6 +1381,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -4014,14 +4028,67 @@ if test "$ALLOW_TCL_MFILES" = no ; then fi if test "$FAST_TCL_INTERP" = yes ; then + TCL_INCLUDE=/usr/include/tcl + TCL_LIBS="-ltcl" OS=$(uname -s) - DIR=/usr/include/tcl if test "$OS" = Darwin ; then - DIR=$(xcrun --show-sdk-path) - DIR=${DIR}/usr/include + TCL_INCLUDE=$(xcrun --show-sdk-path) + TCL_INCLUDE=${DIR}/usr/include + fi + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_pkgConfig+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $pkgConfig in + [\\/]* | ?:[\\/]*) + ac_cv_path_pkgConfig="$pkgConfig" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_pkgConfig="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_pkgConfig" && ac_cv_path_pkgConfig="""" + ;; +esac +fi +pkgConfig=$ac_cv_path_pkgConfig +if test -n "$pkgConfig"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pkgConfig" >&5 +$as_echo "$pkgConfig" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if ! test x$pkgConfig = "x"; then + for i in tcl tcl8.8 tcl8.7 tcl8.6 tcl8.5; do + $pkgConfig --exists $i + if test $? = 0; then + TCL_INCLUDE=`$pkgConfig --cflags $i | sed -e 's/^-I//' -e 's/ //g'` + TCL_LIBS=`$pkgConfig --libs $i` + break + fi + done fi - CPPFLAGS="-I $DIR" + CPPFLAGS="-I $TCL_INCLUDE" ac_ext=c @@ -4463,7 +4530,7 @@ for ac_lib in '' tcl tcl8.8 tcl8.7 tcl8.6 tcl8.5; do ac_res="none required" else ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + LIBS="-l$ac_lib $TCL_LIBS $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_Tcl_CreateInterp=$ac_res @@ -4492,6 +4559,11 @@ else rm -f makefile; as_fn_error $? "Unable to build Lmod with -ltcl Please install the tcl devel package or configure --with-fastTCLInterp=no to not require the tcl library" "$LINENO" 5 fi + + TCL_INCLUDE="$TCL_INCLUDE" + + TCL_LIBS="$TCL_LIBS" + fi From 632a0e4d625232f62f5fc6ad0b654266139e4978 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Fri, 26 Feb 2021 16:20:30 -0600 Subject: [PATCH 3/4] Change logic for finding tcl.h to look in /usr/include and tcl directories before trying pkg-config --- .github/workflows/test.yml | 2 +- configure.ac | 32 ++++++++++++++++++++------------ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d2bf5b027..8b3225f96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: run: brew install coreutils - name: install dependencies Linux if: matrix.os == 'ubuntu-latest' - run: sudo apt install tcsh tcl8.6 tcl8.6-dev uuid r-base r-base-dev cmake fish tclsh zsh + run: sudo apt install tcsh tcl8.6 tcl8.6-dev tcl-dev uuid r-base r-base-dev cmake fish tclsh zsh - name: set up lua uses: leafo/gh-actions-lua@v8.0.0 with: diff --git a/configure.ac b/configure.ac index 697b14286..32a770376 100644 --- a/configure.ac +++ b/configure.ac @@ -615,24 +615,32 @@ if test "$ALLOW_TCL_MFILES" = no ; then fi if test "$FAST_TCL_INTERP" = yes ; then - TCL_INCLUDE=/usr/include/tcl TCL_LIBS="-ltcl" OS=$(uname -s) if test "$OS" = Darwin ; then TCL_INCLUDE=$(xcrun --show-sdk-path) TCL_INCLUDE=${DIR}/usr/include + else + for i in "" tcl tcl8.8 tcl8.7 tcl8.6 tcl8.5; do + if test -f /usr/include/$i/tcl.h ; then + TCL_INCLUDE=/usr/include/$i + break; + fi + done fi - - AC_PATH_PROG(pkgConfig, pkg-config, "") - if ! test x$pkgConfig = "x"; then - for i in tcl tcl8.8 tcl8.7 tcl8.6 tcl8.5; do - $pkgConfig --exists $i - if test $? = 0; then - TCL_INCLUDE=`$pkgConfig --cflags $i | sed -e 's/^-I//' -e 's/ //g'` - TCL_LIBS=`$pkgConfig --libs $i` - break - fi - done + + if test -z "$TCL_INCLUDE" ; then + AC_PATH_PROG(pkgConfig, pkg-config, "") + if ! test x$pkgConfig = "x"; then + for i in tcl tcl8.8 tcl8.7 tcl8.6 tcl8.5; do + $pkgConfig --exists $i + if test $? = 0; then + TCL_INCLUDE=`$pkgConfig --cflags $i | sed -e 's/^-I//' -e 's/ //g'` + TCL_LIBS=`$pkgConfig --libs $i` + break + fi + done + fi fi CPPFLAGS="-I $TCL_INCLUDE" From 62ce5ad08c93905ca7825d3ee1e6dbea86a79b11 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Fri, 26 Feb 2021 16:21:49 -0600 Subject: [PATCH 4/4] Change logic for finding tcl.h to look in /usr/include and tcl directories before trying pkg-config --- configure | 31 +++++++++++++++++++------------ configure.ac | 1 - 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/configure b/configure index fe15c80de..527802d32 100755 --- a/configure +++ b/configure @@ -4028,15 +4028,22 @@ if test "$ALLOW_TCL_MFILES" = no ; then fi if test "$FAST_TCL_INTERP" = yes ; then - TCL_INCLUDE=/usr/include/tcl TCL_LIBS="-ltcl" OS=$(uname -s) if test "$OS" = Darwin ; then TCL_INCLUDE=$(xcrun --show-sdk-path) TCL_INCLUDE=${DIR}/usr/include + else + for i in "" tcl tcl8.8 tcl8.7 tcl8.6 tcl8.5; do + if test -f /usr/include/$i/tcl.h ; then + TCL_INCLUDE=/usr/include/$i + break; + fi + done fi - # Extract the first word of "pkg-config", so it can be a program name with args. + if test -z "$TCL_INCLUDE" ; then + # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } @@ -4077,15 +4084,16 @@ $as_echo "no" >&6; } fi - if ! test x$pkgConfig = "x"; then - for i in tcl tcl8.8 tcl8.7 tcl8.6 tcl8.5; do - $pkgConfig --exists $i - if test $? = 0; then - TCL_INCLUDE=`$pkgConfig --cflags $i | sed -e 's/^-I//' -e 's/ //g'` - TCL_LIBS=`$pkgConfig --libs $i` - break - fi - done + if ! test x$pkgConfig = "x"; then + for i in tcl tcl8.8 tcl8.7 tcl8.6 tcl8.5; do + $pkgConfig --exists $i + if test $? = 0; then + TCL_INCLUDE=`$pkgConfig --cflags $i | sed -e 's/^-I//' -e 's/ //g'` + TCL_LIBS=`$pkgConfig --libs $i` + break + fi + done + fi fi CPPFLAGS="-I $TCL_INCLUDE" @@ -5112,7 +5120,6 @@ fi PATH_TO_LUA=$(FOLLOW_READLINK $FIND_PATH_TO_LUA) fi -echo "2) PATH_TO_LUA: $PATH_TO_LUA" if ! command -v $PATH_TO_LUAC &>/dev/null ; then echo 'The program "'$PATH_TO_LUAC'" must be in your path' diff --git a/configure.ac b/configure.ac index 32a770376..3fa5fd8b6 100644 --- a/configure.ac +++ b/configure.ac @@ -776,7 +776,6 @@ if test ${PATH_TO_LUA:0:1} != '/' ; then AC_PATH_PROG(FIND_PATH_TO_LUA, $PATH_TO_LUA) PATH_TO_LUA=$(FOLLOW_READLINK $FIND_PATH_TO_LUA) fi -echo "2) PATH_TO_LUA: $PATH_TO_LUA" if ! command -v $PATH_TO_LUAC &>/dev/null ; then echo 'The program "'$PATH_TO_LUAC'" must be in your path'