CXX env var missing!
alirezaafzalaghaei opened this issue · 11 comments
As the project mentioned, I defined the environment variable CXX
referring to /usr/bin/g++
, but the project raises the following runtime error at the installation process:
RuntimeError: CXX env var missing, needs to point to your target C++ compiler
The error is raised both in the pip install pressio4py
and GitHub source code building commands.
export CXX=$(which g++) && sudo pip3 install pressio4py
export CXX=$(which g++) && sudo pip3 install ./pressio4py # build from souce
Finally, the problem has been solved by editing setup.py
file, adding os.environ['CXX'] = '/usr/bin/g++'
at line 110.
OS: Manjaro,
Python: 3.9,
pip: versions 20 and 21.
hi @alirezaafzalaghaei , thanks for opening this.
Glad to read you were able to solve it, if that solution works fine for you, great :)
This is strange, I just tried your exact commands and it works for me. We never had this issue before.
can you please do this:
export CXX=$(which g++)
env
$CXX --version
and post here the result?
Did you confirm that which g++
returns the correct path? I've seen an issue with that before (unrelated to pressio). If you're using a bash shell, type
seems to be more reliable than which
.
Edit: It looks like Francesco had the same thought :)
@fnrizzi @jtencer
I'm using Z-Shell plus OMZ plugin. I'd tested installing the package in both shells, but the error was the same. I'd printed the os.environ
variable at line 110 of setup.py
. As far as I can remember the result of this, differs from the python -u -c 'import os; print(os.environ)'
command.This may cause the problem... It's worth noting that I had added export CXX='/usr/bin/g++'
to the .zshrc
but the problem had not solved. I think the setup.py
does not see the current shell variables. The last line of the env
command contains CXX=/usr/bin/g++
definition, and the result of the $CXX --version
command:
$ export CXX=$(which g++)
$ $CXX --version
g++ (GCC) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@alirezaafzalaghaei can you please post here what you get from doing:
export CXX=$(which g++)
env
In your message above i don't see the output of env :)
$ export CXX=$(which g++)
$ env
BROWSER=/usr/bin/firefox
COLORFGBG=15;0
COLORTERM=truecolor
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DESKTOP_SESSION=plasma
DISPLAY=:0
EDITOR=/usr/bin/nano
GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/conficker/.gtkrc-2.0:/home/conficker/.config/gtkrc-2.0
GTK3_MODULES=xapp-gtk3-module
GTK_MODULES=canberra-gtk-module
GTK_RC_FILES=/etc/gtk/gtkrc:/home/conficker/.gtkrc:/home/conficker/.config/gtkrc
HOME=/home/conficker
KDE_APPLICATIONS_AS_SCOPE=1
KDE_FULL_SESSION=true
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=5
KONSOLE_DBUS_SERVICE=:1.50
KONSOLE_DBUS_SESSION=/Sessions/1
KONSOLE_DBUS_WINDOW=/Windows/1
KONSOLE_VERSION=210800
LANG=en_US.UTF-8
LANGUAGE=
LC_ADDRESS=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_TIME=en_US.UTF-8
LOGNAME=conficker
MAIL=/var/spool/mail/conficker
MKLROOT=/opt/intel/mkl
MOTD_SHOWN=pam
OLDPWD=/home/conficker
PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket
PATH=/home/conficker/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/home/conficker/.fzf/bin
PROFILEHOME=
PWD=/home/conficker
QT_AUTO_SCREEN_SCALE_FACTOR=0
QT_LINUX_ACCESSIBILITY_ALWAYS_ON=1
SESSION_MANAGER=local/conficker-pc:@/tmp/.ICE-unix/919,unix/conficker-pc:/tmp/.ICE-unix/919
SHELL=/usr/bin/zsh
SHELL_SESSION_ID=66ce82dadcbf4acf8d7768c244307c99
SHLVL=1
SYSTEMD_EXEC_PID=829
TERM=xterm-256color
USER=conficker
WINDOWID=67108871
XAUTHORITY=/tmp/xauth-1000-_0
XCURSOR_SIZE=24
XCURSOR_THEME=Sweet-cursors
XDG_CONFIG_DIRS=/home/conficker/.config/kdedefaults:/etc/xdg
XDG_CURRENT_DESKTOP=KDE
XDG_DATA_DIRS=/home/conficker/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=2
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_SESSION_TYPE=x11
XDG_VTNR=1
_=/usr/bin/env
ZSH=/home/conficker/.oh-my-zsh
PAGER=less
LESS=-R
LSCOLORS=Gxfxcxdxbxegedabagacad
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
CXX=/usr/bin/g++```
Looks like it's in the environment, but somehow not getting included in the python environment? You said there was a difference between what you see when you printed os.environ
in setup.py and when you ran the below? What happens if you try:
export CXX=$(which g++)
python -c "import os; print(os.environ['CXX']")
and what happens when you print os.environ
in setup.py?
Is it possible that you're executing setup.py with a different python installation?
I also wondering if this has something to do with the zshell since that is the only "different" thing here that I can think of
@jtencer
os. environ
in the setup.py
prints some other variables. I have no idea where they are defined :)
$ export CXX=$(which g++) [~][19:49:08][!2031]
$ python -c "import os; print(os.environ['CXX'])"
/usr/bin/g++
@fnrizzi
As I know most of the *nix operating systems have g++
package installed. I think it's better to check whether the '/usr/bin/g++' file exists or not. If not, raise a runtime error for CXX
environment variable.
it is not just checking that it exits, also that it supports C++14.
In any case, yes, we add the checking too at some point.
I will try with the zsh too when i have time to see if i can reproduce this. It is really hard to understand what is going since this is so user specific :)
In any case, if you are able to bypass this step and build and run tests, that is great. Am i right? No surprises there?
Fortunately, everything else is okay. The tests are running well. Thanks for your great project :)
thanks @alirezaafzalaghaei !
Btw, we are working on improving this a bit, so we should push an updated version sometime in the new few weeks.
We have made quite a bit of changes on the C++ side, and will likely reflect them in the pressio4py.
The API of pressio4py will pretty much not change, but we will expose more functionalities.