`CC="clang++ -std=c++11" cargo build` fails to build on MacOS 13.5.2 (M1)
chipsenkbeil opened this issue · 2 comments
When trying to use tree-sitter-norg
version 0.1.1
on MacOS 13.5.2, I'm getting errors trying to build. I looked through and saw nvim-neorg/neorg#891 where you use clang++ -std=c++11
. I tried both c++11
and c++14
but am still getting compilation errors.
warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:
warning: clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
warning: src/parser.c:299:18: warning: null character(s) preserved in string literal [-Wnull-character]
warning: [anon_sym_] = "<U+0000>",
warning: ^
warning: 1 warning generated.
warning: src/scanner.cc:43:75: warning: default member initializer for non-static data member is a C++11 extension [-Wc++11-extensions]
warning: const std::unordered_map<int32_t, TokenType> attached_modifier_lookup = {
warning: ^
warning: src/scanner.cc:43:77: error: non-aggregate type 'const std::unordered_map<int32_t, TokenType>' (aka 'const unordered_map<int, TokenType>') cannot be initialized with an initializer list
warning: const std::unordered_map<int32_t, TokenType> attached_modifier_lookup = {
warning: ^
warning: src/scanner.cc:85:15: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
warning: const auto attached_mod = attached_modifier_lookup.find(lexer->lookahead);
warning: ^
warning: 2 warnings and 1 error generated.
error: failed to run custom build command for `tree-sitter-norg v0.1.1`
Some flags from cargo
CC = Some("clang++ -std=c++11")
cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-darwin
CFLAGS_aarch64-apple-darwin = None
cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_darwin
CFLAGS_aarch64_apple_darwin = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
running: "clang++" "-std=c++11" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=arm64-apple-darwin" "-I" "src" "-Wall" "-Wextra" "-o" "/Users/chipsenkbeil/projects/norg/target/debug/build/tree-sitter-norg-6e24809a945a07a6/out/src/parser.o" "-c" "src/parser.c"
cargo:warning=clang: warning: treating 'c' input as
Cargo.toml
[package]
name = "norg"
version = "0.1.0"
edition = "2021"
rust-version = "1.72"
[dependencies]
clap = { version = "4.4.3", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
tantivy = "0.21.0"
toml = "0.8.0"
tree-sitter = "0.20.10"
tree-sitter-norg = "0.1.1"
vimvar = "0.3.0"
For context, I'm planning to build a small tool to help facilitate searching through .norg
files using tantivy. The idea is to use treesitter to extract links and build up bi-directional logic that also gets put into the tantivy document model.
I've built similar tools with vimwiki-rs (custom parser, graphql to search, etc) and vimdoc2html (builds up Rust model from treesitter), and was interested in switching my notetaking to neorg
, but I need a little more power to facilitate GTD.
Realized that this is a cpp compiler issue and not a c compiler issue. Providing CXX
instead of CC
worked to pick up the right setting: CXX="clang++ -std=c++11" cargo build
.