taucmdr icon indicating copy to clipboard operation
taucmdr copied to clipboard

-pdt_c++ set incorrectly on Apple when Homebrew GCC installed

Open nchaimov opened this issue 6 years ago • 5 comments

On an Apple system, cc/c++/gcc/g++ are symlinks to clang or clang++. PDT's parsers don't work with Clang headers, so the PDT configure script will prefer an actual g++ if one is installed. When installing an actual GCC with the Homebrew package manager, these are installed as, e.g., gcc-7 and g++-7, but the system gcc and g++ executables are still symlinks to clang.

When TAU Commander builds PDT under these conditions, the PDT configure script selects the real g++ (/usr/bin/local/g++-7), but when TAU Commander builds TAU itself, it passes -pdt_c++=c++ if system compilers are used or -pdt_c++=g++ if GNU compilers are used. These are actually clang++, a different compiler family than was actually used, and linking fails. In this example, note that PDT used /usr/local/bin/g++-7 but -pdt_c++ was set to c++.

[TAU] Configuring PDT...
[DEBUG] Creating subprocess: cmd=['./configure', '-prefix=/Users/nchaimov/taucmdr-1.3.0/system/pdt/a55a38b6', ''], cwd='/var/folders/97/3cmf09f52tv5bq9f0163qnfw0000gn/T/tmpi6Dnr5/./pdtoolkit-3.25'
[...]
[DEBUG] ==> PLATFORM is apple
[DEBUG] ==> Using /usr/local/bin/g++-7

[...]

[DEBUG] Creating subprocess: cmd=['./configure', '-tag=caeed9bc', '-arch=apple', '-cc=cc', '-c++=c++', '-fortran=gfortran', '-pdt=/Users/slw/taucmdr-1.3.0/system/pdt/a55a38b6', '-pdt_c++=c++', '-useropt=-O2#-g#-DTAU_MAX_THREADS=8#-DTAU_MAX_METRICS=32#-DTAU_MAX_COUNTERS=32'], cwd='/Users/nchaimov/taucmdr-1.3.0/system/tau/./tau-2.27'

[...]

[DEBUG] Undefined symbols for architecture x86_64:
[DEBUG]   "std::ctype<char>::_M_widen_init() const", referenced from:
[DEBUG]       pdb_ERROR(char const*, char const*) in libpdb.a(pdbRead.o)
[DEBUG]       pdb_ERROR(char const*, char const*, int) in libpdb.a(pdbRead.o)
[DEBUG]       PDB::merge(char*) in libpdb.a(pdbRead.o)
[DEBUG]       PDB::read(char*) in libpdb.a(pdbRead.o)
[DEBUG]       pdbItem::findDuplicate(pdbSimpleItem*) in libpdb.a(pdbItem.o)
[DEBUG]       pdbFile::print(std::ostream&) const in libpdb.a(pdbFile.o)
[DEBUG]       pdbClass::print(std::ostream&) const in libpdb.a(pdbClass.o)
[DEBUG]       ...

nchaimov avatar Mar 21 '18 19:03 nchaimov

@nchaimov Is the solution here to always require GNU compilers on apple? We could make sure that brewed or macports installed compilers are always utilized and never clang. Are there any circumstances where we would want to support clang?

zbeekman avatar Apr 02 '19 13:04 zbeekman

Since none of our parsers support clang headers, I don’t think we’d ever want to use clang with PDT.

nchaimov avatar Apr 02 '19 15:04 nchaimov

Sure, but what about with tau_exec -ebs and friends? It would simplify logic to just forbid clang on Apple. Obviously, with PDT we can never use it, but I'm just thinking about implementation details. I guess we could use compat.

zbeekman avatar Apr 02 '19 15:04 zbeekman

PDT isn’t used for sampling, so we don’t need it in that case. I believe that TAU Commander will automatically use a non-PDT build of TAU when sampling is used.

nchaimov avatar Apr 02 '19 16:04 nchaimov

Right. So we just need logic to ensure that when PDT is used on Apple, all tooling is built with GCC. Hopefully a compat stanza can be crafted to achieve this. On Tue, Apr 2, 2019 at 12:03 PM Nicholas Chaimov [email protected] wrote:

PDT isn’t used for sampling, so we don’t need it in that case. I believe that TAU Commander will automatically use a non-PDT build of TAU when sampling is used.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ParaToolsInc/taucmdr/issues/261#issuecomment-479068847, or mute the thread https://github.com/notifications/unsubscribe-auth/AAREPIKB_vHeHnF1hVlo5-NxtEVPY8Guks5vc39PgaJpZM4S1V-R .

zbeekman avatar Apr 02 '19 16:04 zbeekman