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

toolchain: env var filtering fails with line continued environment variables #1567

Closed
Sur3 opened this issue Jun 30, 2021 · 9 comments · Fixed by #1580
Closed

toolchain: env var filtering fails with line continued environment variables #1567

Sur3 opened this issue Jun 30, 2021 · 9 comments · Fixed by #1580

Comments

@Sur3
Copy link

Sur3 commented Jun 30, 2021

When trying to setup cp2k I get the following error:

% ./install_cp2k_toolchain.sh -j 44 --with-gcc=install --with-openmpi=install --with-fftw=install --with-cmake=install --with-openblas=install --with-libint=install --with-libxc=no --with-scalapack=no --with-cosma=no --with-gsl=install --with-spglib=install --with-hdf5=no --with-sirius=no --with-libxsmm=install
MPI is detected and it appears to be OpenMPI
nvcc not found, disabling CUDA by default
You have chosen to install GCC, therefore MPI libraries will have to be installed too
Compiling with 44 processes.
/home/user/cp2k-8.2.0/tools/toolchain/install/toolchain.env: line 31: warning: setlocale: LC_COLLATE: cannot change locale (C.UTF-8)
/home/user/cp2k-8.2.0/tools/toolchain/install/toolchain.env: line 75: :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\: command not found
ERROR: (./scripts/stage0/install_gcc.sh, line 75) Non-zero exit code detected.
@dev-zero
Copy link
Contributor

can you please post the output of the following commands?

cat /etc/os-release
locale

@dev-zero
Copy link
Contributor

and is this a fresh run of install_cp2k_toolchain.sh (so, no build/ or install/ directory in tools/toolchain/) or did you run it before already?

@Sur3
Copy link
Author

Sur3 commented Jul 1, 2021

Yes it is a fresh run.

% cat /etc/os-release                                                                                                                                                                            
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
% locale                                                                                                                                                                                         
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=de_DE.utf8
LC_CTYPE="de_DE.utf8"
LC_NUMERIC="de_DE.utf8"
LC_TIME="de_DE.utf8"
LC_COLLATE=C.UTF-8
LC_MONETARY="de_DE.utf8"
LC_MESSAGES="de_DE.utf8"
LC_PAPER="de_DE.utf8"
LC_NAME="de_DE.utf8"
LC_ADDRESS="de_DE.utf8"
LC_TELEPHONE="de_DE.utf8"
LC_MEASUREMENT="de_DE.utf8"
LC_IDENTIFICATION="de_DE.utf8"
LC_ALL=

I suppose the locale warning is probably unrelated to the actual error.

@dev-zero
Copy link
Contributor

dev-zero commented Jul 1, 2021

can you post the toolchain.env? But you might want to check it first for sensitive content.

@Sur3
Copy link
Author

Sur3 commented Jul 1, 2021

Ok thanks, looking deeper into the toolchain.env I found that an old cp2k-5.2 was still in the PATH variable as it was loaded as module, after removing that it seems to work now. Therefore closing this bug. ^.^

@Sur3 Sur3 closed this as completed Jul 1, 2021
@pmitev
Copy link

pmitev commented Jul 6, 2021

I had this problem when compiling within screen session.
$TERMCAP value spans over several lines which fails upon cleaning.

export -p

...
declare -x SSH_TTY="/dev/pts/6"
declare -x STY="22092.slurm20868348"
declare -x TERM="screen"
declare -x TERMCAP="SC|screen|VT 100/ANSI X3.64 virtual terminal:\\
        :DO=\\E[%dB:LE=\\E[%dD:RI=\\E[%dC:UP=\\E[%dA:bs:bt=\\E[Z:\\
        :cd=\\E[J:ce=\\E[K:cl=\\E[H\\E[J:cm=\\E[%i%d;%dH:ct=\\E[3g:\\
        :do=^J:nd=\\E[C:pt:rc=\\E8:rs=\\Ec:sc=\\E7:st=\\EH:up=\\EM:\\
        :le=^H:bl=^G:cr=^M:it#8:ho=\\E[H:nw=\\EE:ta=^I:is=\\E)0:\\
        :li#24:co#80:am:xn:xv:LP:sr=\\EM:al=\\E[L:AL=\\E[%dL:\\
        :cs=\\E[%i%d;%dr:dl=\\E[M:DL=\\E[%dM:dc=\\E[P:DC=\\E[%dP:\\
        :im=\\E[4h:ei=\\E[4l:mi:IC=\\E[%d@:ks=\\E[?1h\\E=:\\
        :ke=\\E[?1l\\E>:vi=\\E[?25l:ve=\\E[34h\\E[?25h:vs=\\E[34l:\\
        :ti=\\E[?1049h:te=\\E[?1049l:Km=\\E[M:k0=\\E[10~:k1=\\EOP:\\
        :k2=\\EOQ:k3=\\EOR:k4=\\EOS:k5=\\E[15~:k6=\\E[17~:k7=\\E[18~:\\
        :k8=\\E[19~:k9=\\E[20~:k;=\\E[21~:F1=\\E[23~:F2=\\E[24~:\\
        :kh=\\E[1~:@1=\\E[1~:kH=\\E[4~:@7=\\E[4~:kN=\\E[6~:kP=\\E[5~:\\
        :kI=\\E[2~:kD=\\E[3~:ku=\\EOA:kd=\\EOB:kr=\\EOC:kl=\\EOD:"
declare -x TMPDIR="/scratch/20868348"
...

So, simply unset TERMCAP solves the issue in this situation for me.

@dev-zero
Copy link
Contributor

dev-zero commented Jul 6, 2021

ok, that explains it: we're filtering env variables (like the TERMCAP) but in our testing those vars did not contain line breaks.

@dev-zero dev-zero reopened this Jul 6, 2021
@dev-zero dev-zero changed the title cryptic toolchain gcc env error toolchain: env var filtering fails with line continued environment variables Jul 6, 2021
@dev-zero
Copy link
Contributor

dev-zero commented Jul 6, 2021

Maybe the easiest would be to replace our environment variable filtering by python -c 'import os; print(*(f"export {key}={value}" for key, value in os.environ.items() if key not in ["TERMCAP", ]), sep="\n")'.

Or if we want to stay in the shell, doing in a subshell the following:

unset TERMCAP
unset ...

export -p

@Sur3
Copy link
Author

Sur3 commented Jul 6, 2021

I think I was also using screen before, so this could really be the explanation. :)

dev-zero added a commit to dev-zero/cp2k that referenced this issue Jul 9, 2021
fixes cp2k#1567, obviously some shells started to use line continuations in export -p, and we broke those when using sed to filter env vars
dev-zero added a commit that referenced this issue Jul 11, 2021
fixes #1567, obviously some shells started to use line continuations in export -p, and we broke those when using sed to filter env vars
mtaillefumier pushed a commit to mtaillefumier/cp2k that referenced this issue Jul 12, 2021
fixes cp2k#1567, obviously some shells started to use line continuations in export -p, and we broke those when using sed to filter env vars
abussy pushed a commit to abussy/cp2k that referenced this issue Jul 28, 2021
fixes cp2k#1567, obviously some shells started to use line continuations in export -p, and we broke those when using sed to filter env vars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants