Closed lah64 closed 3 years ago
A common default project such as Hello World C++ by XCode got the same problem...
Hey @SKyzZz , thanks for this report. I can't reproduce this (have no access to macOS), so I need some more logs in order to help. The output is empty, because the intercept process failed to capture the compiler calls. It is done by compiler wrappers. Let's find out why that failed. I need more log lines from the start of the build, including the command you've typed to run the build.
@rizsotto
-> % bear --verbose -- xcodebuild -workspace IPlugEffect.xcworkspace -scheme "macOS-VST3"
Thanks @SKyzZz , from the logs I see the followings:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
is the compiler your project is using.intercept
found the /usr/bin/clang
compiler.Currently there is no way to tell to intercept
(the program bear
internally calls) which compiler to wrap around. It uses the first one it founds in the PATH
. As a workaround try to put the /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
directory into the front of the directory list.
ask@ASKs-Mac-mini [15:12:19] [~/Downloads/test/Examples/IPlugEffect]
-> % which clang
/usr/bin/clang
ask@ASKs-Mac-mini [15:42:26] [~/Downloads/test/Examples/IPlugEffect]
-> % echo $PATH
/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
ask@ASKs-Mac-mini [15:44:58] [~/Downloads/test/Examples/IPlugEffect]
-> % echo $PATH
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
ask@ASKs-Mac-mini [15:45:18] [~/Downloads/test/Examples/IPlugEffect]
-> % which clang
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-> % bear --verbose -- xcodebuild -workspace IPlugEffect.xcworkspace -scheme "macOS-VST2"
Output: []
This looks much better to me, but can understand your frustration that it's still not working. :)
It looks like the build system uses the absolute path of the compilers. This case intercept
can't interpose the compiler wrappers. I don't know xcode
how to configure which compiler to use or is there a configure step before you run the build.
In a make project the build file would contains the build rules as $CC -c source.c -Wall ...
where the value of the CC
is either can be set manually. Or it is captured by a ./configure
script that you run before the build. The first case Bear would handle automatically, and in the second case you would need to run bear -- ./configure
to capture the compiler wrappers for the build, throw away the created compile_commands.json
file, and run bear -- make ...
which will now use the wrappers... If the make file would have been written like /usr/local/somewhere/not/common/bin/cc -c source.c -Wall ...
the compiler wrapper can't be replaced.
Sorry about it, but this is a limitation of the compiler wrapper technique. Will document it better in the wiki.
xcodebuild -workspace IPlugEffect.xcworkspace -scheme "macOS-VST3" | xcpretty -r json-compilation-database -o compile_commands.json
So xcodebuild
can generate the compilation database without Bear?
It seems that it is, but the only requirement is that it should always be a clean project and for each scheme separately.
Great! I'll close this ticket. There is not much I do here.
fwiw, doing CC=clang bear -- xcodebuild <...> CC=$CC
works
Verbose:
Somebody, please give me a gun...
How to repeat it:
bear --verbose -- xcodebuild -workspace IPlugEffect.xcworkspace -scheme "macOS-VST3"