-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compile_commands compiled with empty array [] #18
Comments
Sweet! I'm afraid I'm going to have to get back to you tomorrow--super late my time. See you soon! Thanks for posting your setup! |
All good I switched to CMake and when I bothered to learn it and set it up properly (in a modern & modular way) it's actually not bad and can do the same git pulling of projects but didn't even need any extra set up for the non-bazel one (fmt), and works out the box with (clangd) intellisense 👌 cmake_minimum_required(VERSION 3.22)
set (CMAKE_CXX_STANDARD 20)
# Allow absolute includes.
SET(BASEPATH "${CMAKE_SOURCE_DIR}")
INCLUDE_DIRECTORIES("${BASEPATH}")
project(
all_projects
VERSION 1.0
LANGUAGES CXX)
# Allows fetching of third party projects.
include(FetchContent)
# GoogleTest for unit testing.
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG f45d5865ed0b2b8912244627cdf508a24cc6ccb4 # Jan 25, 2022
)
FetchContent_MakeAvailable(googletest)
# fmt for string formatting (note std::format in C++20 might have this).
FetchContent_Declare(fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 8.1.1
)
FetchContent_MakeAvailable(fmt)
# Main project.
add_subdirectory(src)
# Tests.
enable_testing()
add_subdirectory(tests) |
Oh gosh. Sorry if I turned you off to Bazel with the sleep delay. Wish I'd been able to help you right then. One other thing: If you return to Bazel, I'd highly recommend Bazelisk! I'm still going to look into this in a little bit. You've got me curious, and I want to understand what's going on. |
Hey, @sekoyo, I got back to this and ran some tests: Cloned your repo and ran ...so, we've got a mystery, but one I'd really like to track down if we think it might continue to catch people. Any ideas what might be different? Would you be down to run the aquery command (above) to narrow things down? My system should be pretty similar to yours, except that I'm on an older, Intel-based mac. But latest macOS, Bazel 5, using the code you sent me. |
@cpsauer haha well I'm in an experimental mood maybe I'll come back to Bazel but at least it was good to make some sense out of CMake. Thanks a lot for checking, that's interesting, I wasn't aware of the mneumonic command (though that produces some errors for me), but still have the same issue with no output after a |
You're very welcome! Glad you're enjoying some experiments :) That really does narrow things down. If it helps, the fact that aquery is erroring probably means Bazel itself is having trouble getting to constructing actions for your repo--before it even gets into this tool. Im curious: Do those same errors not surface when running the tool itself? |
Oh that's interesting, I skimmed over the error and then as a sanity check tried to run the build and it errored on the That fixed |
Ah yes I missed something in the hedron output, it does seem like a toolchain thing. And I've removed
"AssertionError: Compiler doesn't look like normal clang/gcc. Time to add windows support?" |
hah well, I'm honored you were so eager to use this tool that actually building took second fiddle :) That particular error message alerts me that you're using an older version of this tool, since we removed it a little bit ago to add support for custom toolchains. Could I ask you to update the commit in WORKSPACE to the latest (both places it appears)? Should make it go away. (If you'd like, the Bazel debug message can subsequently be solved by adding the Also, you mention toolchains. Is there anything special/custom you're doing there? [I'm a little surprised it isn't auto-invoking my compiler unwrapping code for Apple platforms, as it is on my machine. If, by chance, you end up seeing errors in clangd about finding the standard library or anything like that, I'd really like to hear about it. I wonder if it's because you've got command line tools but not the macOS SDK or Xcode installed?] Thanks for your patience and exploratory spirit! |
Whoops I normally remember to update. I don't mind at all debugging, I'm impressed you have the energy to look into it 😄 That did indeed fix the error though still an empty
"FileNotFoundError: [Errno 2] No such file or directory: 'external/local_config_cc/cc_wrapper.sh'" |
Well, I'd like everyone who tries to use it to have a great time with it. And when it falls short, I'd like to roll up my sleeves to make sure it's smoother next time. [Reflecting: So far it's been mostly Bazel setup--and I've pushed a change to this repos README to make using the latest hash more clear.] Re the above error:
|
Hey, no special toolchain apart from ARM. I had XCode command line tools but not XCode so installed that. I also removed external folder. Not sure which one fixed it but I did notice after installing XCode it seemed to be using a different clang (/usr/bin/clang -> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang) This caused the build to initially break (but it was working before), a bazel clean fixed the build. Running Here is the full output, you can see the errors seem to be around pulling the googletest code.
I am getting some squigglies in the test file but the intellisense seems to be working at the same time: Also it has a bunch of googletest references in |
P.S I think I tried removing external folder yesterday and issue persisted (I think! 😅) so it seems having XCode did the trick. |
Hmm, @sekoyo, I'm still pretty suspicious that you've got an issue with the external symlink--and that that's driving all these issues. Could you check it? (Switching to Xcode just changes the compiler path to not use the symlink.) For example, running And you should be able to see those files it's complaining about missing via that symlink. If you can't, blow away the symlink and regenerate with Really, you shouldn't have to settle for any of these problems, they'd all be caused by a symlink problem, and the "symlink" looks suspect in the repo you shared. |
Ah I didn't realise that I should have
Thanks a lot! |
Yay! So delighted that it's finally working as expected for you. Great feedback for me to have. I've strengthened the wording to reduce the risk of others getting trapped, too! (92ae5f5) Please keep me in the loop on how things go! I'd also love to hear any feedback you have about how we can make the tool--or this process better. |
[As an aside, we may soon have it as optional and auto-creating. A wonderful contributor is working on that among other things. But it's not here just yet.] |
Hi @cpsauer , this is RE bazel-contrib/vscode-bazel#179 (comment)
Thanks a lot for offering to take a look, I realize this is not an issue with this project but my setup.
Here's my setup: https://github.com/sekoyo/cpp-orderbook
Just barebones lib + binary + test at the moment and trying to get (VSCode) intellisense to work.
Any pointer much appreciated!
Running on: MacOS armv8
Bazel: 5.0.0-homebrew
The text was updated successfully, but these errors were encountered: