Closed BrushXue closed 3 years ago
Hi,
clang++ can be located in different places:
$ xcrun -f c++
/Library/Developer/CommandLineTools/usr/bin/c++
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/
$ xcrun -f c++
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
I think initially xcrun c++
appeared because at some point people were happy with CLT and did not want to install Xcode.
Guess, you can configure bear to use whatever compile you like: https://github.com/rizsotto/Bear/wiki/Config-file.
I tried but didn't resolve the issue: https://github.com/rizsotto/Bear/issues/360. Changed to clang++
and immediately passed.
Are these two commands 100% equivalent if the code is CLI only?
I can propose the following solution using conditional parts of Makefiles (should be added to wmake/rules/darwin64Clang/c++
):
ifeq ($(WM_CXX),)
CC = xcrun c++ -std=c++14
else
CC = $(WM_CXX) -std=c++14
endif
and the same for WM_CC
.
So the command for compilation is
WM_CXX=clang++ wmake -with-bear
Concerning xcrun
:
$ xcrun -l c++
env SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk /Library/Developer/CommandLineTools/usr/bin/c++
So, final command is a little bit more complicated. I did not check Apple sources to figure out clang++
symlink behaviour.
WM_CC
and WM_CXX
are no longer used in .com version
https://www.openfoam.com/news/main-news/openfoam-v1906/portability
OK, these variables are not used, so we are free to use them, this will not create conflicts. I propose to use them to cope with bear
inability to parse compiler output.
Alternatively you can checkout Apple's LLVM sources and check what clang does if executable name in clang++
.
Should be hesitant to use/reuse WM_CXX
etc. since they will be picked up on by the ThirdParty compilations (as a fallback).
So the command for compilation is
WM_CXX=clang++ wmake -with-bear
This runs counter to how we've added bear support into OpenFOAM (.com). We have wmake -with-bear
or even Allwmake -with-bear
as the top-level wrapping and not on the compiler level. Seemed less intrusive.
I will choose bear
author approach and mark the issue as wontfix
and close it.
Hello. I have a question regarding
wmake/rules/darwin64Clang/c++
https://github.com/mrklein/openfoam-os-x/blob/f220ac0353eae847662dbbbdbf2f6eed7ce728a8/OpenFOAM-v2012.patch#L881 I'm trying to use the newwmake-with-bear
feature butbear
doesn't recongnizexcrun c++
. By changing it toclang++
,bear
can generate the compilation database. And seems like everything's fine in my build.So is there any specific reason to use
xcrun
?