TACC / Lmod

Lmod: An Environment Module System based on Lua, Reads TCL Modules, Supports a Software Hierarchy
http://lmod.readthedocs.org
Other
489 stars 126 forks source link

Cannot configure/make with local tcl installation (Lmod 8.7.49) #722

Closed cmfield closed 2 weeks ago

cmfield commented 3 weeks ago

I have a locally installed version of tcl, 8.6.14, with bin, include, lib directories that need linking to. I thought I could do this by setting CPPFLAGS and LDFLAGS, but it will not find tcl.h - I think because CPPFLAGS is being set in configure to TCL_INCLUDE ? This definitely used to work at some point because this is the third time I'm installing Lmod with local tcl and lua installations and those are still running.

rtmclay commented 3 weeks ago

I have created a branch called IS722-tcl which adds support for local TCL installations. You can now do:

TCL_PKG_CONFIG_DIR=/path/to/tcl-pkgconfig/ ./configure ....

Where you set TCL_PKG_CONFIG_DIR to point to the directory where tcl.pc resides. I found it in the installed tcl in lib/pkgconfig

Please test this branch out to see if it works for you.

cmfield commented 3 weeks ago

I am getting an error running:

TCL_PKG_CONFIG_DIR=/mnt/data/software_stack/tcl_8.6.14/lib/pkgconfig/ ./configure

checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
DUPLICATE_PATHS=no
LMOD_ALLOW_ROOT_USE=yes
SITE_MSG_FILE=<empty>
LMOD_OVERRIDE_LANG=<empty>
CASE_INDEPENDENT_SORTING=no
COLORIZE=yes
DYNAMIC_SPIDER_CACHE=yes
HIDDEN_ITALIC=no
EXACT_MATCH=no
MODE=user_default
LMOD_CONFIG_DIR=/etc/lmod
AUTO_SWAP=yes
EXPORT_MODULE=yes
REDIRECT=no
MODULEPATH_ROOT=NONE/modulefiles
ANCIENT=86400
SHORT_TIME=2
SPIDER_CACHE_DIRS=
SPIDER_CACHE_DESCRIPT_FN=
UPDATE_SYSTEM_FN=
PREPEND_BLOCK=normal
SITE_NAME=<empty>
SYSHOST=<empty>
ALLOW_TCL_MFILES=yes
DISABLE_NAME_AUTOSWAP=no
MPATH_AVAIL=no
SETTARG=no
IGNORE_DIRS=.svn,.git,.hg,.bzr
PIN_VERSIONS=no
LMOD_DOWNSTREAM_CONFLICTS=no
MODULES_AUTO_HANDLING=no
TMOD_PATH_RULE=no
TMOD_FIND_FIRST=no
LUA_INCLUDE=no
CACHED_LOADS=no
EXTENDED_DEFAULT=yes
SUPPORT_KSH=no
MODULEPATH_INIT=@PKG@/init/.modulespath
SITE_CONTROLLED_PREFIX=no
USE_BUILT_IN_PKGS=no
USE_DOT_CONFIG_DIR_ONLY=no
SILENCE_SHELL_DEBUGGING=yes
FAST_TCL_INTERP=yes
MODULE_AUTO_HANDLING=no
AVAIL_EXTENSIONS=yes
PATH_TO_LUA=lua
PATH_TO_LUAC=luac
LUA_SUFFIX=no
checking for pkg-config... no
./configure: line 4507: --libs: command not found
TCL_INCLUDE:
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for tcl.h... no
configure: Unable to build Lmod without tcl.h.  Please install the tcl devel package or configure --with-fastTCLInterp=no to not require tcl.h.  You can also provide your own tcl source.  Please set TCL_PKG_CONFIG_DIR to point to the directory containing tcl.pc
checking for library containing Tcl_CreateInterp... no
configure: error: Unable to build Lmod with -ltcl Please install the tcl devel package or configure --with-fastTCLInterp=no to not require the tcl library

My tcl.pc:

# tcl pkg-config source file

prefix=/mnt/data/software_stack/tcl_8.6.14
exec_prefix=/mnt/data/software_stack/tcl_8.6.14
libdir=/mnt/data/software_stack/tcl_8.6.14/lib
includedir=${prefix}/include
libfile=libtcl8.6.so

Name: Tool Command Language
Description: Tcl is a powerful, easy-to-learn dynamic programming language, suitable for a wide range of uses.
URL: https://www.tcl-lang.org/
Version: 8.6.14
Requires.private: zlib >= 1.2.3
Libs: -L${libdir} -ltcl8.6 -ltclstub8.6
Libs.private: -ldl -lz  -lpthread -lm
Cflags: -I${includedir}
rtmclay commented 3 weeks ago

As it showed in the output:

checking for pkg-config... no
./configure: line 4507: --libs: command not found
TCL_INCLUDE:

The configure script could not find the program pkg-config Lmod needs it to process the tcl.pc file.

rtmclay commented 3 weeks ago

I have updated the IS722-tcl branch to be more explicit about requiring the pkg-config program in your $PATH. I have also added another option namely you can also configure Lmod by setting TCL_INCLUDE and TCL_LIBS. For example I tested:

TCL_INCLUDE="-I/opt/apps/tcl/8.6.14/include" TCL_LIBS="-L/opt/apps/tcl/8.6.14/lib -ltcl8.6 -ltclstub8.6" ../configure --prefix ...

This worked for me.

cmfield commented 2 weeks ago

Well, I tried all of the variables and with pkg-config installed, but something's not quite clicking:

TCL_PKG_CONFIG_DIR=/mnt/data/software_stack/tcl_8.6.14/lib/pkgconfig TCL_INCLUDE=/mnt/data/software_stack/tcl_8.6.14/include TCL_LIBS=/mnt/data/software_stack/tcl_8.6.14/lib ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
DUPLICATE_PATHS=no
LMOD_ALLOW_ROOT_USE=yes
SITE_MSG_FILE=<empty>
LMOD_OVERRIDE_LANG=<empty>
CASE_INDEPENDENT_SORTING=no
COLORIZE=yes
DYNAMIC_SPIDER_CACHE=yes
HIDDEN_ITALIC=no
EXACT_MATCH=no
MODE=user_default
LMOD_CONFIG_DIR=/etc/lmod
AUTO_SWAP=yes
EXPORT_MODULE=yes
REDIRECT=no
MODULEPATH_ROOT=NONE/modulefiles
ANCIENT=86400
SHORT_TIME=2
SPIDER_CACHE_DIRS=
SPIDER_CACHE_DESCRIPT_FN=
UPDATE_SYSTEM_FN=
PREPEND_BLOCK=normal
SITE_NAME=<empty>
SYSHOST=<empty>
ALLOW_TCL_MFILES=yes
DISABLE_NAME_AUTOSWAP=no
MPATH_AVAIL=no
SETTARG=no
IGNORE_DIRS=.svn,.git,.hg,.bzr
PIN_VERSIONS=no
LMOD_DOWNSTREAM_CONFLICTS=no
MODULES_AUTO_HANDLING=no
TMOD_PATH_RULE=no
TMOD_FIND_FIRST=no
LUA_INCLUDE=no
CACHED_LOADS=no
EXTENDED_DEFAULT=yes
SUPPORT_KSH=no
MODULEPATH_INIT=@PKG@/init/.modulespath
SITE_CONTROLLED_PREFIX=no
USE_BUILT_IN_PKGS=no
USE_DOT_CONFIG_DIR_ONLY=no
SILENCE_SHELL_DEBUGGING=yes
FAST_TCL_INTERP=yes
MODULE_AUTO_HANDLING=no
AVAIL_EXTENSIONS=yes
PATH_TO_LUA=lua
PATH_TO_LUAC=luac
LUA_SUFFIX=no
checking for pkg-config... /usr/bin/pkg-config
using TCL_INCLUDE: /mnt/data/software_stack/tcl_8.6.14/include
using TCL_LIBS:    /mnt/data/software_stack/tcl_8.6.14/lib
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for tcl.h... no
configure: Unable to build Lmod without tcl.h.  Please install the tcl devel package or configure --with-fastTCLInterp=no to not require tcl.h.  You can also provide your own tcl source.  Please set TCL_PKG_CONFIG_DIR to point to the directory containing tcl.pc Or specify TCL_INCLUDE and TCL_LIBS
checking for library containing Tcl_CreateInterp... no
configure: error: Unable to build Lmod with -ltcl Please install the tcl devel package or configure --with-fastTCLInterp=no to not require the tcl library
cmfield commented 2 weeks ago

Ah but it works if I don't supply TCL_INCLUDE or TCL_LIBS or neither. TCL_PKG_CONFIG_DIR alone, or with one of those works, but with both and without TCL_PKG_CONFIG_DIR it does not.

rtmclay commented 2 weeks ago

I'm glad that using pkg-config and TCL_PKG_CONFIG_DIR works for you. I would like you to try specifying both TCL_INCLUDE and TCL_LIBS and not TCL_PKG_CONFIG_DIR. Then if this fails please look at the file config.log.

In there, there will be a section where it reports why this test:

   AC_CHECK_HEADER(tcl.h,
                   [AC_DEFINE([HAVE_TCL_H], 1, [Define to 1 if you have tcl.h])],[]) 

fails.

You should be able to do a reverse search on config.log for tcl.h to find why configure is reporting a failure. Please report that part to this issue. Thanks!

rtmclay commented 2 weeks ago

Nevermind. I see what your problem was. You have to have the -I flag in the TCL_INCLUDE and -L -l in the TCL_LIBS as I showed above and have repeated below

TCL_INCLUDE="-I/opt/apps/tcl/8.6.14/include" TCL_LIBS="-L/opt/apps/tcl/8.6.14/lib -ltcl8.6 -ltclstub8.6" ../configure --prefix ...

Thanks for working with me on providing a way to allow sites to provide their own TCL libraries

cmfield commented 2 weeks ago

Ah, I was putting them as paths rather than the correct type of flags, got it.

Many thanks for this, now I can install the entire software stack without having to add to the system libraries.