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

Checking for compiler by specific name precludes valid tools #280

Open
matthewfeickert opened this issue Dec 3, 2024 · 0 comments
Open
Labels
🐛bug Something isn't working

Comments

@matthewfeickert
Copy link
Contributor

System Settings

Not specific to a single OS and occurs before installation.

Describe the bug

result = ShellCommand.Which('g++',all=False,mute=True)

explicitly checks for an executable named "g++". This means that if there is a valid version of g++ installed and set to the environment GXX variable but named something other than g++ this fails.

Build systems often will rename certain tools, such as how conda-forge will have {arch}-conda-{os}-g++ for g++

GXX=$BUILD_PREFIX/bin/x86_64-conda-linux-gnu-g++

This also precludes the use of clang++ on macOS machines, which should be viable unless libquadmath is used explicitly somewhere. (?) But

$ git grep "quadmath"

returns no results.

To Reproduce

$ docker run --rm -ti debian:bookworm
# apt update && apt install -y curl
root@dbb6a5b050a2:/# curl -fsSL https://pixi.sh/install.sh | bash && . /root/.bashrc
root@dbb6a5b050a2:/# mkdir example && cd $_
root@dbb6a5b050a2:/example# pixi init
Created /example/pixi.toml
root@dbb6a5b050a2:/example# pixi add cxx-compiler make python git sed six
Added cxx-compiler >=1.8.0,<2
Added make >=4.4.1,<5
Added python >=3.13.0,<3.14
Added git >=2.47.1,<3
Added sed >=4.8,<5
Added six >=1.16.0,<2
root@dbb6a5b050a2:/example# pixi shell
(example) root@dbb6a5b050a2:/example# command -v g++  
/example/.pixi/envs/default/bin/g++
(example) root@dbb6a5b050a2:/example# echo $GXX
/example/.pixi/envs/default/bin/x86_64-conda-linux-gnu-g++
(example) root@dbb6a5b050a2:/example# ls -l $(command -v g++)
lrwxrwxrwx 1 root root 26 Dec  3 22:46 /example/.pixi/envs/default/bin/g++ -> x86_64-conda-linux-gnu-g++
(example) root@dbb6a5b050a2:/example# rm $(command -v g++)  # emulate a situation in which a valid compiler exists, but is not named g++
(example) root@dbb6a5b050a2:/example# $GXX --version
x86_64-conda-linux-gnu-g++ (conda-forge gcc 13.3.0-1) 13.3.0
Copyright (C) 2023 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.

(example) root@dbb6a5b050a2:/example# git clone --recursive https://github.com/MadAnalysis/madanalysis5.git
(example) root@dbb6a5b050a2:/example# cd madanalysis5/
(example) root@dbb6a5b050a2:/example/madanalysis5# sed -i '37i import importlib.util' bin/ma5  # patch out bug
(example) root@dbb6a5b050a2:/example/madanalysis5# ./bin/ma5 
/example/madanalysis5/madanalysis/core/launcher.py:237: SyntaxWarning: invalid escape sequence '\_'
  logging.getLogger('MA5').info("*                 /'\_/`\/\  __ \/\  ___\                   *")
/example/madanalysis5/madanalysis/core/launcher.py:238: SyntaxWarning: invalid escape sequence '\ '
  logging.getLogger('MA5').info("*                /\      \ \ \_\ \ \ \__/                   *")
/example/madanalysis5/madanalysis/core/launcher.py:239: SyntaxWarning: invalid escape sequence '\ '
  logging.getLogger('MA5').info("*                \ \ \__\ \ \  __ \ \___``\                 *")
/example/madanalysis5/madanalysis/core/launcher.py:240: SyntaxWarning: invalid escape sequence '\ '
  logging.getLogger('MA5').info("*                 \ \ \_/\ \ \ \/\ \/\ \_\ \                *")
/example/madanalysis5/madanalysis/core/launcher.py:241: SyntaxWarning: invalid escape sequence '\ '
  logging.getLogger('MA5').info("*                  \ \_\\\ \_\ \_\ \_\ \____/                *")
/example/madanalysis5/madanalysis/core/launcher.py:242: SyntaxWarning: invalid escape sequence '\/'
  logging.getLogger('MA5').info("*                   \/_/ \/_/\/_/\/_/\/___/                 *")
/example/madanalysis5/madanalysis/IOinterface/text_report.py:36: SyntaxWarning: invalid escape sequence '\#'
  dicolatex = {'#':'\#','%':'\%','_':'\_','/':'/\-', \
/example/madanalysis5/madanalysis/IOinterface/text_report.py:36: SyntaxWarning: invalid escape sequence '\%'
  dicolatex = {'#':'\#','%':'\%','_':'\_','/':'/\-', \
/example/madanalysis5/madanalysis/IOinterface/text_report.py:36: SyntaxWarning: invalid escape sequence '\_'
  dicolatex = {'#':'\#','%':'\%','_':'\_','/':'/\-', \
/example/madanalysis5/madanalysis/IOinterface/text_report.py:36: SyntaxWarning: invalid escape sequence '\-'
  dicolatex = {'#':'\#','%':'\%','_':'\_','/':'/\-', \
/example/madanalysis5/madanalysis/IOinterface/text_report.py:37: SyntaxWarning: invalid escape sequence '\{'
  '{':'\{', '}':'\}','^':'\^{}'}
/example/madanalysis5/madanalysis/IOinterface/text_report.py:37: SyntaxWarning: invalid escape sequence '\}'
  '{':'\{', '}':'\}','^':'\^{}'}
/example/madanalysis5/madanalysis/IOinterface/text_report.py:37: SyntaxWarning: invalid escape sequence '\^'
  '{':'\{', '}':'\}','^':'\^{}'}
/example/madanalysis5/madanalysis/IOinterface/latex_report_writer.py:190: SyntaxWarning: invalid escape sequence '\m'
  self.file.write('      \multicolumn{' + str(span) + '}{c}{\\cellcolor{'+ColorType.convert2string(color)+"}")
/example/madanalysis5/madanalysis/IOinterface/latex_report_writer.py:196: SyntaxWarning: invalid escape sequence '\m'
  self.file.write('}& \multicolumn{' + str(span) + '}{c}{\\cellcolor{'+ColorType.convert2string(color)+"}")
/example/madanalysis5/madanalysis/layout/plotflow.py:666: SyntaxWarning: invalid escape sequence '\_'
  mytitle  = mytitle.replace('_','\_')
/example/madanalysis5/madanalysis/layout/plotflow.py:848: SyntaxWarning: invalid escape sequence '\ '
  axis_titleY += " $(#mathrm{scaled}\ #mathrm{to}# #mathrm{one})$"
/example/madanalysis5/madanalysis/layout/plotflow.py:961: SyntaxWarning: invalid escape sequence '\_'
  outputPy.write('"'+str(histos[0].stringlabels[bin]).replace('_','\_')+'"')
/example/madanalysis5/madanalysis/fastsim/ast.py:194: SyntaxWarning: invalid escape sequence '\ '
  if re.match("""(?x) ^ [+-]?\ *  (  \d+ ( \.\d* )? |\.\d+ ) ([eE][+-]?\d+)? $""", elem):
/example/madanalysis5/madanalysis/observable/observable_list.py:50: SyntaxWarning: invalid escape sequence '\s'
  latex="$\sqrt{\hat{s}}$",
/example/madanalysis5/madanalysis/observable/observable_list.py:165: SyntaxWarning: invalid escape sequence '\s'
  latex="$\slash{E}_T$",
/example/madanalysis5/madanalysis/observable/observable_list.py:222: SyntaxWarning: invalid escape sequence '\s'
  latex="$\slash{H}_T$",
/example/madanalysis5/madanalysis/observable/observable_list.py:241: SyntaxWarning: invalid escape sequence '\o'
  latex="$\omega$",
/example/madanalysis5/madanalysis/observable/observable_list.py:662: SyntaxWarning: invalid escape sequence '\D'
  latex="$\Delta R$",
/example/madanalysis5/madanalysis/observable/observable_list.py:671: SyntaxWarning: invalid escape sequence '\D'
  latex="$d\Delta R$",
/example/madanalysis5/madanalysis/observable/observable_list.py:690: SyntaxWarning: invalid escape sequence '\D'
  latex="$\Delta\Phi_{0,\pi}$",
/example/madanalysis5/madanalysis/observable/observable_list.py:709: SyntaxWarning: invalid escape sequence '\D'
  latex="$\Delta\Phi_{0,2\pi}$",
/example/madanalysis5/madanalysis/observable/observable_list.py:728: SyntaxWarning: invalid escape sequence '\D'
  latex="$\Delta M$",
/example/madanalysis5/madanalysis/observable/observable_list.py:748: SyntaxWarning: invalid escape sequence '\e'
  latex="$\eta$",
/example/madanalysis5/madanalysis/observable/observable_list.py:753: SyntaxWarning: invalid escape sequence '\e'
  ETA, name="sETA", combination=CombinationType.SUMSCALAR, tlatex="s#eta", latex="$s\eta$"
/example/madanalysis5/madanalysis/observable/observable_list.py:756: SyntaxWarning: invalid escape sequence '\e'
  ETA, name="sdETA", combination=CombinationType.DIFFSCALAR, tlatex="sd#eta", latex="$sd\eta$"
/example/madanalysis5/madanalysis/observable/observable_list.py:759: SyntaxWarning: invalid escape sequence '\e'
  ETA, name="dETA", combination=CombinationType.DIFFVECTOR, tlatex="d#eta", latex="$d\eta$"
/example/madanalysis5/madanalysis/observable/observable_list.py:762: SyntaxWarning: invalid escape sequence '\e'
  ETA, name="rETA", combination=CombinationType.RATIO, tlatex="r#eta", latex="$r\eta$"
/example/madanalysis5/madanalysis/observable/observable_list.py:781: SyntaxWarning: invalid escape sequence '\e'
  latex="$|\eta|$",
/example/madanalysis5/madanalysis/observable/observable_list.py:790: SyntaxWarning: invalid escape sequence '\e'
  latex="$s|\eta|$",
/example/madanalysis5/madanalysis/observable/observable_list.py:797: SyntaxWarning: invalid escape sequence '\e'
  latex="$sd|\eta|$",
/example/madanalysis5/madanalysis/observable/observable_list.py:804: SyntaxWarning: invalid escape sequence '\e'
  latex="$d|\eta|$",
/example/madanalysis5/madanalysis/observable/observable_list.py:807: SyntaxWarning: invalid escape sequence '\e'
  ABSETA, name="rABSETA", combination=CombinationType.RATIO, tlatex="r|#eta|", latex="$r|\eta|$"
/example/madanalysis5/madanalysis/observable/observable_list.py:868: SyntaxWarning: invalid escape sequence '\p'
  latex="$\phi$",
/example/madanalysis5/madanalysis/observable/observable_list.py:877: SyntaxWarning: invalid escape sequence '\p'
  latex="$s\phi$",
/example/madanalysis5/madanalysis/observable/observable_list.py:886: SyntaxWarning: invalid escape sequence '\p'
  latex="$sd\phi$",
/example/madanalysis5/madanalysis/observable/observable_list.py:891: SyntaxWarning: invalid escape sequence '\p'
  PHI, name="dPHI", combination=CombinationType.DIFFVECTOR, tlatex="d#phi", latex="$d\phi$"
/example/madanalysis5/madanalysis/observable/observable_list.py:894: SyntaxWarning: invalid escape sequence '\p'
  PHI, name="rPHI", combination=CombinationType.RATIO, tlatex="r#phi", latex="$r\phi$"
/example/madanalysis5/madanalysis/observable/observable_list.py:979: SyntaxWarning: invalid escape sequence '\g'
  latex="$\gamma$",
/example/madanalysis5/madanalysis/observable/observable_list.py:984: SyntaxWarning: invalid escape sequence '\g'
  GAMMA, name="sGAMMA", combination=CombinationType.SUMSCALAR, tlatex="s#gamma", latex="$s\gamma$"
/example/madanalysis5/madanalysis/observable/observable_list.py:991: SyntaxWarning: invalid escape sequence '\g'
  latex="$sd\gamma$",
/example/madanalysis5/madanalysis/observable/observable_list.py:998: SyntaxWarning: invalid escape sequence '\g'
  latex="$d\gamma$",
/example/madanalysis5/madanalysis/observable/observable_list.py:1001: SyntaxWarning: invalid escape sequence '\g'
  GAMMA, name="rGAMMA", combination=CombinationType.RATIO, tlatex="r#gamma", latex="$r\gamma$"
MA5: 
MA5: *************************************************************
MA5: *                                                           *
MA5: *        W E L C O M E  to  M A D A N A L Y S I S  5        *
MA5: *                         ______  ______                    *
MA5: *                 /'\_/`\/\  __ \/\  ___\                   *
MA5: *                /\      \ \ \_\ \ \ \__/                   *
MA5: *                \ \ \__\ \ \  __ \ \___``\                 *
MA5: *                 \ \ \_/\ \ \ \/\ \/\ \_\ \                *
MA5: *                  \ \_\\ \_\ \_\ \_\ \____/                *
MA5: *                   \/_/ \/_/\/_/\/_/\/___/                 *
MA5: *                                                           *
MA5: *   MA5 release : 1.10.16                      2024/08/26   *
MA5: *                                                           *
MA5: *         Comput. Phys. Commun. 184 (2013) 222-256          *
MA5: *             Eur. Phys. J. C74 (2014) 3103                 *
MA5: *                                                           *
MA5: *   The MadAnalysis Development Team - Please visit us at   *
MA5: *              https://github.com/MadAnalysis               *
MA5: *                                                           *
MA5: *              Type 'help' for in-line help.                *
MA5: *                                                           *
MA5: *************************************************************
MA5: Platform: Linux 6.8.0-47-generic [Linux mode]
MA5: Reading user settings ...
MA5: Checking mandatory packages:
MA5:      - Python                   [OK]
MA5:      - GNU GCC g++              [FAILURE]
MA5-ERROR: This package is a mandatory package: MadAnalysis 5 can not run without it.
(example) root@dbb6a5b050a2:/example/madanalysis5#

Expected behaviour

For a valid compiler to be found via environment variables and checking the tools on PATH, not by checking an explicit executable name.

Log files

No response

Additional information

This can of course be worked around by symlinking the path of the valid compiler to something on path named g++, but this ideally shouldn't be required.

@matthewfeickert matthewfeickert added the 🐛bug Something isn't working label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant