New Issue: 'CHPL_GMP=system' problems on Mac OS X with LLVM back-end (gmp)

18844, "bradcray", "'CHPL_GMP=system' problems on Mac OS X with LLVM back-end (gmp)", "2021-12-10T18:35:37Z"

While investigating using CHPL_GMP=system today on my Mac this week, targeting
homebrew gmp, my initial reaction was "this seems to work fine" and I moved on. But
looking more closely, there are problems beneath the surface:

  • the reason it seemed to work fine is that chpl pidigits.chpl --print-commands shows
    that it's still using the bundled / third-party gmp version that I happened to still have
    sitting around. Blowing that directory away breaks the compile ("can't find gmp.h").
    Switching to the C back-end does the right thing (doesn't use the third-party paths,
    does find the homebrew files)

  • the "can't find gmp.h" can be resolved by adding -I /usr/local/include and -L /usr/local/lib
    to the chpl command line (or the respective environment variables), but it doesn't seem as
    though this should be required. In the same way that these directories seem to be automatic
    for the C back-end, I would expect them to be for the LLVM back-end as well. If for some
    reason we didn't want them to be "always-on", we could add them only when GMP is enabled.
    That said, "always-on" seems like it would be useful for homebrew users trying to call to other
    libraries they'd installed (through their own library or externs, say).