Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFLAGS build issues #287

Closed
xdch47 opened this issue Aug 2, 2019 · 4 comments
Closed

CFLAGS build issues #287

xdch47 opened this issue Aug 2, 2019 · 4 comments
Labels
Milestone

Comments

@xdch47
Copy link
Contributor

xdch47 commented Aug 2, 2019

Following a typical linux layout, e.g.

./configure \
		--prefix=/
		--etcdir=/etc \
		--initdir=/etc/modules/init \
		--modulefilesdir=/etc/modules/modulefiles
		--bindir=/usr/bin \
		--libdir=/usr/lib \
		--libexecdir=/usr/libexec \
		--datarootdir=/usr/share \
		--mandir=/usr/share/man \
		--docdir=/usr/share/doc \
		--vimdatadir=/usr/share/vim/vimfiles \

will lead to a wrong and empty MODULESHOMES (which seems not to be used by the tool itself, but is mainly used as $MODULESHOMES/init/<init-skript> by external scripts).

Furthermore compiling with custom CFLAGS does not work due to space typo.

Suggested patches:

diff --git  a/lib/Makefile.in b/lib/Makefile.in
index 843e178..8e77ec7 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -4,7 +4,7 @@
 CFLAGS_WARNING=@CFLAGS_WARNING@
 
 CC=@TCL_CC@
-CFLAGS=@CFLAGS@@TCL_INCLUDE_SPEC@
+CFLAGS=@CFLAGS@ @TCL_INCLUDE_SPEC@
 # apply specific flags if code coverage asked
 ifeq ($(COVERAGE),y)
 CFLAGS += -coverage -O0
diff --git a/modulecmd.tcl.in b/modulecmd.tcl.in
index 843e178..8e77ec7 100644
--- a/modulecmd.tcl.in
+++ b/modulecmd.tcl.in
@@ -9066,7 +9066,7 @@ proc cmdModuleAutoinit {} {
    pushMode load
 
    # default MODULESHOME
-   setenv MODULESHOME @prefix@
+   setenv MODULESHOME [file dirname @initdir@]
 
    # register command location
    setenv MODULES_CMD [getAbsolutePath $::argv0]
@xdelaruelle xdelaruelle added this to the 4.3.1 milestone Aug 5, 2019
@xdelaruelle xdelaruelle added the bug label Aug 5, 2019
@xdelaruelle
Copy link
Member

Thanks for the lib/Makefile.in patch, it has just been applied.

MODULESHOME is bound to the prefix configure option as it the common parent directory containing module command initialization scripts, the executable program modulecmd.tcl, and a directory containing a collection of master modulefiles.. In a spread installation setup like you describe there is no common HOME and it may not satisfy everybody relying on this variable if it is set to the parent of the initdir.

So I think the change you propose here cannot be applied. But the good thing it that the prefix configure option could be set to a value that matches your needs. From my understanding if you set a specific directory for all elements, the prefix value will only affect the MODULESHOME definition.

@xdelaruelle xdelaruelle reopened this Aug 5, 2019
@xdch47
Copy link
Contributor Author

xdch47 commented Aug 6, 2019

it may not satisfy everybody relying on this variable if it is set to the parent of the initdir

well, for the compat-version this is required, so if this does not satisfy, the setup is already kind of broken.

however, without this fix, the prefix option is (from my point of view) is broken.

it feels pretty odd/wrong to have

./configure \
		--prefix=/usr/local/etc
		--etcdir=/etc \
		--initdir=/etc/modules/init \
		--modulefilesdir=/etc/modules/modulefiles
                ....

furthermore libdir, libexecdir,datarootdir,mandir,docdir,vimdatadir have to be manually prefix (with /usr/local) since they will be install to the wrong place (usr/local/etc) otherwise

an alternative to facilitate compability to all (but in my eyes stranges/broken setups) would be to add a --moduleshome option with the parentdir of the initdir as default.

@xdch47
Copy link
Contributor Author

xdch47 commented Aug 6, 2019

To clarify a bit more: the main compability I would like to keep is for users that had a local installation (default options -> /usr/local/Modules) and switch to a packaged installation.
However for a general packaging guideline is to have configuration files in /etc and binaries, libs, etc. in /usr

@xdelaruelle xdelaruelle changed the title patch: build issues + MODULESHOME should not be prefix CFLAGS build issues Sep 18, 2019
@xdelaruelle
Copy link
Member

I am splitting this issue in two: this one regarding the CFLAGS issue reported and fixed and #292 on the MODULESHOME configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants