chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.78k stars 418 forks source link

[Bug]: printchplenv and printchplbuilds give misleading output with prefix-based installs #25874

Closed jabraham17 closed 1 week ago

jabraham17 commented 1 week ago

When Chapel is installed with make install we do not directly expose printchplenv or printchplbuilds.py (they are not in PATH). However, a user can still run them by specifying a full path, for example /usr/share/chapel/2.2/util/printchplenv.

However, printchplenv will print different (and wrong!) information from chpl --print-chpl-settings. This is because before calling printchplenv, chpl sets some additional variables based on whether or not chpl is prefix-installed. These variables are CHPL_RUNTIME_LIB, CHPL_RUNTIME_INCL, and CHPL_THIRD_PARTY. If they are not set (which users aren't doing anyways), then printchplenv will infer these based off of CHPL_HOME, which in a prefix-install is incorrect

printchplbuilds.py suffers from the same issues as printchplenv, except it also lacks the ability to infer CHPL_HOME and hardcodes CHPL_RUNTIME_LIB

This all results in chpl --print-chpl-settings and printchplenv printing different results. For example, because CHPL_THIRD_PARTY is incorrect for printchplenv, chpl --print-chpl-settings may report CHPL_GMP=bundled while printchplenv will always report CHPL_GMP=none.

This doesn't affect the correctness of programs compiled with chpl. Because it takes a heroic effort to run printchplenv in a prefix-install most users probably won't notice, but the different output can be confusing.

bradcray commented 1 week ago

I believe I've been confused by this before, but failed to determine what was going on in the time I spent on it. Thanks for capturing this!