-
Notifications
You must be signed in to change notification settings - Fork 296
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
dynamically resolve environment variables #1088
Conversation
Hi, thanks for the contribution. I am not sure this is robust. If I understand correctly:
This is fragile for a number of reasons:
Regarding your comments, let me add that:
I am still a bit confused about what you are trying to provide. Something like this?
I think that the solution for relocatability is to use:
This will still have the open issues that I mentioned here. But it would allow you to relocate plumed and use it (without setting and env var), though on Linux only. |
Thanks for your comments. Now I know where your confusion is, before that let me explain the things you have talked about.
This is not about on the installation stage, installation can be anywhere as long as configurations, What I am trying to provide is to make the environmental setting more concise and standard, I mean usually the program will be compiled and installed in a standard way, like installing to So after installation, even for different versions of program, the compiled files under like I know by additionally setting More important, the update only take effects on patch scripts, and make it more robust to find include headers, it will not influence how |
Ok let me try again to understand what you are trying to do.
With the current implementation, if you skip step 2 everything works as expected, correct? At point 4 you are only interested in If so, I guess your solution should not work. Even if you fix the paths seen in the patch.sh script so that the links work correctly, the make and cmake include files will still contain absolute paths. Please have a look at files The only solution, to my understanding, is to:
Alternatively, if possible, modify the Related to the problem of having |
Hi @GiovanniBussi, your understanding of what I am trying to do is correct. I should have explained it at the very beginning. I know where is your worry about, it is not about the compilation stage, or any The PR of new codes just adds an additional layer when running Let us assume the compilation has been done, the Now, I move this folder to another place, and correctly setting Thus, I provided a way to solve it, by firstly checking the validation of the folder path before doing really patch. It will not influence all other settings, it simply adds a second layer to help locate header files. If no folder path changes, those codes will be never run. To conclude, there are two very important things that I should mention, to relieve any of your concerns.
|
One more thing, the "standard" way to solve the relative path Also, I see all those scripts are generated and assumed to be run |
I see that your patch is not affecting the rest of the code. It is just making I am closing this but feel free to reopen if there's something I misunderstood. |
Description
This PR is to use solve the problem mentioned in #1086 section 2 about the dynamical link of "Plumed.h" header file.
Type of contribution
Copyright
Idea for update
I thoroughly go over the
plumed=patch
codes, after compilation, I found the call sequence ofplumed=patch
is:Be aware of that call
a
andb
are different,a
is runplumed
first, and then use its internal solver to find patch codes, whileb
is directly run patch script.The difference is environment variable
PLUMED_INCLUDEDIR
is hard-coded insideplumed
binary object, where insideplumed-patch
script, it can be customized.Thus, to make it work, I made edition of two files, 1)
src/lib/Makefile
: add some lines to check environment variables before scripts executes, relating tob
. 2)patches/patch.sh
: to exclusively checkPLUMED_INCLUDEDIR
validation, relating toa
.I think the explanations should be clear, if there are any opaques, please let me know, thanks!