Skip to content
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

Bear created empty compile_commands.json file #468

Open
fuzhen011 opened this issue Jul 1, 2022 · 33 comments
Open

Bear created empty compile_commands.json file #468

fuzhen011 opened this issue Jul 1, 2022 · 33 comments
Labels

Comments

@fuzhen011
Copy link

Describe the bug
I'm using MacOS and cross-compiling an ARM project using GNU GCC compiler.

To Reproduce
Not easy to reproduce on your side because you need to do a big amount of work to set up the environment, but I can 100% reproduce the issue.

Expected behavior
complete compile_commands.json file

Environment:

  • OS name: Darwin
  • OS version: Darwin Kernel Version 19.6.0
  • OS architecture: x86_64
  • Bear version: 3.0.19
  • Bear install method: from brew

Additional context
Older version of Bear works perfectly in my setup, I don't remember what the version is, but back to then, it issues "bear make xxx" instead of "bear -- make xxx". I updated it yesterday and found it didn't work after update.

Below is the output from the compiling when added "--verbose"
[16:46:43.665769, ic, 78289] Process wait request: done. [pid: 78290]
[16:46:43.665820, ic, 78289] Running command. [Exited with 0]
[16:46:43.665838, ic, 78289] Stopping gRPC server.
[16:46:43.666223, ic, 78289] succeeded with: 0
[16:46:43.667186, br, 78288] Process wait request: done. [pid: 78289]
[16:46:43.667215, br, 78288] Running intercept finished. [Exited with 0]
[16:46:43.667947, br, 78288] Process spawned. [pid: 91668, command: [/usr/local/Cellar/bear/3.0.19_2/bin/citnames, --input, compile_commands.events.json, --output, compile_commands.json, --run-checks, --verbose]]
[16:46:43.667977, br, 78288] Process wait requested. [pid: 91668]
[16:46:43.690705, cs, 91668] citnames: 3.0.19
[16:46:43.691149, cs, 91668] arguments: ["/usr/local/Cellar/bear/3.0.19_2/bin/citnames", "--input", "compile_commands.events.json", "--output", "compile_commands.json", "--run-checks", "--verbose"]
[16:46:43.691180, cs, 91668] environment: ["ANDROID_HOME=/Users/zhfu/Library/Android/sdk", "ANDROID_PLATFORM_TOOLS=/Users/zhfu/Library/Android/sdk/platform-tools", "ANDROID_TOOLS=/Users/zhfu/Library/Android/sdk/tools", "AUTOJUMP_ERROR_PATH=/Users/zhfu/Library/autojump/errors.log", "AUTOJUMP_SOURCED=1", "COLORFGBG=15;0", "COLORTERM=truecolor", "EDITOR=vim", "GNUARMEMB_TOOLCHAIN_PATH=", "HOME=/Users/zhfu", "ITERM_PROFILE=Kevin", "ITERM_SESSION_ID=w0t0p0:1B14DE1C-E553-49FB-A3BF-80E8B4270016", "LANG=zh_CN.UTF-8", "LC_TERMINAL=iTerm2", "LC_TERMINAL_VERSION=3.4.15", "LESS=-R", "LOGNAME=zhfu", "LSCOLORS=Gxfxcxdxbxegedabagacad", "MAKEFLAGS=", "MAKELEVEL=1", "META_UTIL_PATH=/Users/zhfu/work/super", "MFLAGS=", "OLDPWD=/Users/zhfu/SimplicityStudio/v5_workspace_new", "PAGER=less", "PATH=/Users/zhfu/Library/Android/sdk/tools:/Users/zhfu/Library/Android/sdk/platform-tools:/Users/zhfu/work/repos/bt_support/tools:/Applications/Doxygen.app/Contents/Resources:/Applications/Simplicity Studio.app/Contents/Eclipse//developer/toolchains/gnu_arm/7.2_2017q4/bin:/usr/local/Cellar/ctags/5.8_1/bin:/Users/zhfu/work/repos/py_bgapi/pybgapi:/usr/local/opt/openssl:/usr/local/opt/openssl/lib::/Applications/Simplicity Studio.app/Contents/Eclipse/:/usr/local/Cellar/gcc/10.1.0/bin/:/Applications/Simplicity Studio.app/Contents/Eclipse//developer/adapter_packs/commander/Commander.app/Contents/MacOS:/usr/local/Cellar/[email protected]/1.1.1d/bin:/Users/zhfu/Library/Python/2.7/bin:/Users/zhfu/Library/Python/3.9/bin:/Users/zhfu/work/gconfig/scripts:/usr/local/opt/binutils/bin:/Users/zhfu/work/repos/uc_cli:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS:/Users/zhfu/Library/Android/sdk/tools:/Users/zhfu/Library/Android/sdk/platform-tools:/Users/zhfu/work/repos/bt_support/tools:/Applications/Doxygen.app/Contents/Resources:/Applications/Simplicity Studio.app/Contents/Eclipse//developer/toolchains/gnu_arm/7.2_2017q4/bin:/usr/local/Cellar/ctags/5.8_1/bin:/Users/zhfu/work/repos/py_bgapi/pybgapi:/usr/local/opt/openssl:/usr/local/opt/openssl/lib:/Applications/Simplicity Studio.app/Contents/Eclipse/:/usr/local/Cellar/gcc/10.1.0/bin/:/Applications/Simplicity Studio.app/Contents/Eclipse//developer/adapter_packs/commander/Commander.app/Contents/MacOS:/usr/local/Cellar/[email protected]/1.1.1d/bin:/Users/zhfu/Library/Python/2.7/bin:/Users/zhfu/Library/Python/3.9/bin:/Users/zhfu/work/gconfig/scripts:/usr/local/opt/binutils/bin:/Users/zhfu/work/repos/uc_cli", "PATH_ARMGCC=/Applications/Simplicity Studio.app/Contents/Eclipse//developer/toolchains/gnu_arm/7.2_2017q4/bin", "PATH_BINUTILS=/usr/local/opt/binutils/bin", "PATH_BLE_SDK=/Applications/Simplicity\ Studio.app/Contents/Eclipse/developer/sdks/gecko_sdk_suite/v2.7/app/bluetooth", "PATH_BTMESH_SDK=/Applications/Simplicity\ Studio.app/Contents/Eclipse/developer/sdks/blemesh/v1.7/app/bluetooth", "PATH_COMMANDER=/Applications/Simplicity Studio.app/Contents/Eclipse//developer/adapter_packs/commander/Commander.app/Contents/MacOS", "PATH_CTAGS=/usr/local/Cellar/ctags/5.8_1/bin", "PATH_DOCXGEN=/Applications/Doxygen.app/Contents/Resources", "PATH_GCC_=/usr/local/Cellar/gcc/10.1.0/bin/", "PATH_MY_SCRIPT=/Users/zhfu/work/gconfig/scripts", "PATH_OPENSSL=/usr/local/opt/openssl:/usr/local/opt/openssl/lib", "PATH_PYBGAPI=/Users/zhfu/work/repos/py_bgapi/pybgapi", "PATH_PYBIN=/usr/local/Cellar/[email protected]/1.1.1d/bin:/Users/zhfu/Library/Python/2.7/bin:/Users/zhfu/Library/Python/3.9/bin", "PATH_STUDIO=/Applications/Simplicity Studio.app/Contents/Eclipse/", "PATH_SUP_TOOLS=/Users/zhfu/work/repos/bt_support/tools", "PATH_UC_CLI=/Users/zhfu/work/repos/uc_cli", "PWD=/Users/zhfu/SimplicityStudio/v5_workspace_new/bt_soc_empty", "PYBGAPI_DIR=/Users/zhfu/work/pybgapi", "PYTHONPATH=/Users/zhfu/work/repos/py_bgapi/pybgapi", "SCRIPT_DIR=/Users/zhfu/work/super/protocol/bluetooth/scripts", "SHELL=/bin/zsh", "SHLVL=2", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.zdeGghBHCL/Listeners", "STUDIO_WORKSPACE=/Users/zhfu/SimplicityStudio", "SUPER_DIR=/Users/zhfu/work/super", "TERM=screen-256color", "TERM_PROGRAM=iTerm.app", "TERM_PROGRAM_VERSION=3.4.15", "TERM_SESSION_ID=w0t0p0:1B14DE1C-E553-49FB-A3BF-80E8B4270016", "TMPDIR=/var/folders/w4/9d8q2nf52rl9tslbgmgz83hw0000gn/T/", "TMUX=/tmp//tmux-501/default,674,0", "TMUX_PANE=%0", "UNCRUSTIFY_CHECK_SCRIPT=/Users/zhfu/work/super/tool/script/uncrustify/uncrustifyCheck.py", "USER=zhfu", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "ZEPHYR_BASE=/Users/zhfu/work/repos/zephyrproject/zephyr", "ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb", "ZSH=/Users/zhfu/.oh-my-zsh", "_=/usr/bin/make", "__CF_USER_TEXT_ENCODING=0x1F5:0x19:0x34"]
[16:46:43.691514, cs, 91668] sysname: Darwin
[16:46:43.691517, cs, 91668] release: 19.6.0
[16:46:43.691519, cs, 91668] version: Darwin Kernel Version 19.6.0: Sun Nov 14 19:58:51 PST 2021; root:xnu-6153.141.50~1/RELEASE_X86_64
[16:46:43.691521, cs, 91668] machine: x86_64
[16:46:43.691532, cs, 91668] arguments parsed: {program: /usr/local/Cellar/bear/3.0.19_2/bin/citnames, arguments: [{--input: [compile_commands.events.json]}, {--output: [compile_commands.json]}, {--run-checks: []}, {--verbose: []}]}
[16:46:43.691764, cs, 91668] Configuration: {"compilation":null,"output":{"content":{"include_only_existing_source":true},"format":{"command_as_array":true,"drop_output_field":false}}}
[16:46:43.691958, cs, 91668] compilation entries created. [size: 0]
[16:46:43.691964, cs, 91668] compilation entries to output. [size: 0]
[16:46:43.692236, cs, 91668] compilation entries written. [size: 0]
[16:46:43.692252, cs, 91668] succeeded with: 0
[16:46:43.692941, br, 78288] Process wait request: done. [pid: 91668]
[16:46:43.692967, br, 78288] Running citnames finished. [Exited with 0]
[16:46:43.693039, br, 78288] succeeded with: 0

Before you send...

  • Have you read the README.md file or man bear?
  • yes
  • Have you looked what other open issues Bear has?
  • yes
  • Are you sure that the build works without Bear?
  • yes
@rizsotto
Copy link
Owner

rizsotto commented Jul 2, 2022

Does this wiki page help?

@fuzhen011
Copy link
Author

@rizsotto , I don't think so... I don't know what changes have been made to the project, but back to the time when calling "bear make xxx", it works perfectly with the same configuration.

@rizsotto
Copy link
Owner

rizsotto commented Jul 5, 2022

@fuzhen011 the "old" 2.x version of Bear works differently than the "new" 3.x version. The new version is using compiler wrappers, that your build system has to support. (CC or CXX environment variables needs to be respected by the build command.) So, please check if your build system works that way, and the compiler can be replaced via those environment variables. And if it has a "configure" like step, make sure that you run that with Bear too.

@fuzhen011
Copy link
Author

@rizsotto , is there a way to create a local configuration to recognize the compiler, where I used arm-none-eabi-gcc?

@rizsotto
Copy link
Owner

rizsotto commented Jul 5, 2022

yes, there is... read man citnames to see how to do that.

@rizsotto
Copy link
Owner

Any update on this @fuzhen011 ?

@mistrpokr
Copy link

mistrpokr commented Aug 12, 2022

Hi @rizsotto, I think I'm having a similar issue to @fuzhen011's. I'm working on an embedded project, so my case involves a cross-compiler (arm-none-eabi-*) and Mac OS on an Apple Silicon (ARM64) machine.

bear is installed via Homebrew and is on the PATH. arm-none-eabi-* toolchain binaries are built for x86_64 so I think Rosetta is used for instruction translation. Here's a snippet of the Makefile involving definition and execution of $CC:

#######################################
# binaries
#######################################
PREFIX = arm-none-eabi-
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
# either it can be added to the PATH environment variable.
ifdef GCC_PATH
CC = $(GCC_PATH)/$(PREFIX)gcc
AS = $(GCC_PATH)/$(PREFIX)gcc -x assembler-with-cpp
CP = $(GCC_PATH)/$(PREFIX)objcopy
SZ = $(GCC_PATH)/$(PREFIX)size
else
CC = $(PREFIX)gcc
AS = $(PREFIX)gcc -x assembler-with-cpp
CP = $(PREFIX)objcopy
SZ = $(PREFIX)size
endif
HEX = $(CP) -O ihex
BIN = $(CP) -O binary -S

# ...


#######################################
# build the application
#######################################
# list of objects
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
vpath %.c $(sort $(dir $(C_SOURCES)))
# list of ASM program objects
OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
vpath %.s $(sort $(dir $(ASM_SOURCES)))

$(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR) 
	$(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@

$(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
	$(AS) -c $(CFLAGS) $< -o $@

$(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
	$(CC) $(OBJECTS) $(LDFLAGS) -o $@
	$(SZ) $@

$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
	$(HEX) $< $@
	
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
	$(BIN) $< $@	
	
$(BUILD_DIR):
	mkdir $@		

bear log when executing CC=/Applications/ARM/bin/arm-none-eabi-gcc bear --verbose --config citnames-config.json -- make -j8 CC=/Applications/ARM/bin/arm-none-eabi-gcc:

[12:11:12.593621, br, 81142] bear: 3.0.20
[12:11:12.594018, br, 81142] arguments: ["bear", "--verbose", "--config", "citnames-config.json", "--", "make", "-j8", "CC=/Applications/ARM/bin/arm-none-eabi-gcc"]
[12:11:12.594046, br, 81142] environment: (REMOVED)
[12:11:12.594063, br, 81142] sysname: Darwin
[12:11:12.594065, br, 81142] release: 21.6.0
[12:11:12.594067, br, 81142] version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000
[12:11:12.594070, br, 81142] machine: arm64
[12:11:12.594078, br, 81142] arguments parsed: {program: bear, arguments: [{--: [make, -j8, CC=/Applications/ARM/bin/arm-none-eabi-gcc]}, {--citnames: [/opt/homebrew/Cellar/bear/3.0.20_1/bin/citnames]}, {--config: [citnames-config.json]}, {--interceptor: [/opt/homebrew/Cellar/bear/3.0.20_1/bin/intercept]}, {--library: [/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/libexec.dylib]}, {--output: [compile_commands.json]}, {--verbose: []}, {--wrapper: [/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/wrapper]}, {--wrapper-dir: [/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/wrapper.d]}]}
[12:11:12.594505, br, 81142] Process spawned. [pid: 81143, command: ["/opt/homebrew/Cellar/bear/3.0.20_1/bin/intercept", "--library", "/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/libexec.dylib", "--wrapper", "/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/wrapper", "--wrapper-dir", "/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/wrapper.d", "--output", "compile_commands.events.json", "--verbose", "--", "make", "-j8", "CC=/Applications/ARM/bin/arm-none-eabi-gcc"]]
[12:11:12.594530, br, 81142] Process wait requested. [pid: 81143]
[12:11:12.611580, ic, 81143] intercept: 3.0.20
[12:11:12.612000, ic, 81143] arguments: ["/opt/homebrew/Cellar/bear/3.0.20_1/bin/intercept", "--library", "/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/libexec.dylib", "--wrapper", "/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/wrapper", "--wrapper-dir", "/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/wrapper.d", "--output", "compile_commands.events.json", "--verbose", "--", "make", "-j8", "CC=/Applications/ARM/bin/arm-none-eabi-gcc"]
[12:11:12.612038, ic, 81143] environment: (REMOVED)
[12:11:12.612054, ic, 81143] sysname: Darwin
[12:11:12.612056, ic, 81143] release: 21.6.0
[12:11:12.612058, ic, 81143] version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000
[12:11:12.612060, ic, 81143] machine: arm64
[12:11:12.612067, ic, 81143] arguments parsed: {program: /opt/homebrew/Cellar/bear/3.0.20_1/bin/intercept, arguments: [{--: [make, -j8, CC=/Applications/ARM/bin/arm-none-eabi-gcc]}, {--library: [/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/libexec.dylib]}, {--output: [compile_commands.events.json]}, {--verbose: []}, {--wrapper: [/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/wrapper]}, {--wrapper-dir: [/opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/wrapper.d]}]}
[12:11:12.612686, ic, 81143] session initialized with: wrapper_dir: /opt/homebrew/Cellar/bear/3.0.20_1/lib/bear/wrapper.d
[12:11:12.612696, ic, 81143] session initialized with: mapping: {"ar": "/usr/bin/ar", "as": "/usr/bin/as", "bison": "/usr/bin/bison", "c++": "/usr/bin/c++", "cc": "/Applications/ARM/bin/arm-none-eabi-gcc", "clang": "/usr/bin/clang", "clang++": "/usr/bin/clang++", "cpp": "/usr/bin/cpp", "flex": "/usr/bin/flex", "g++": "/usr/bin/g++", "gcc": "/usr/bin/gcc", "ld": "/usr/bin/ld", "lex": "/usr/bin/lex", "makeinfo": "/usr/bin/makeinfo", "nm": "/usr/bin/nm", "objdump": "/usr/bin/objdump", "ranlib": "/usr/bin/ranlib", "strip": "/usr/bin/strip", "yacc": "/usr/bin/yacc"}
[12:11:12.612700, ic, 81143] session initialized with: override: {"CC": "cc"}
[12:11:12.617458, ic, 81143] Running gRPC server. dns:///localhost:63503
[12:11:12.617722, ic, 81143] Process spawned. [pid: 81144, command: ["make", "-j8", "CC=/Applications/ARM/bin/arm-none-eabi-gcc"]]
[12:11:12.617744, ic, 81143] Process wait requested. [pid: 81144]

(MAKEFILE BUILDING...)

[12:11:15.117010, ic, 81143] Process wait request: done. [pid: 81144]
[12:11:15.117053, ic, 81143] Running command. [Exited with 0]
[12:11:15.117062, ic, 81143] Stopping gRPC server.
[12:11:15.117278, ic, 81143] succeeded with: 0
[12:11:15.117701, br, 81142] Process wait request: done. [pid: 81143]
[12:11:15.117736, br, 81142] Running intercept finished. [Exited with 0]
[12:11:15.117937, br, 81142] Process spawned. [pid: 81605, command: ["/opt/homebrew/Cellar/bear/3.0.20_1/bin/citnames", "--input", "compile_commands.events.json", "--output", "compile_commands.json", "--run-checks", "--config", "citnames-config.json", "--verbose"]]
[12:11:15.117956, br, 81142] Process wait requested. [pid: 81605]
[12:11:15.132149, cs, 81605] citnames: 3.0.20
[12:11:15.132453, cs, 81605] arguments: ["/opt/homebrew/Cellar/bear/3.0.20_1/bin/citnames", "--input", "compile_commands.events.json", "--output", "compile_commands.json", "--run-checks", "--config", "citnames-config.json", "--verbose"]
[12:11:15.132477, cs, 81605] environment: (REMOVED)
[12:11:15.132490, cs, 81605] sysname: Darwin
[12:11:15.132493, cs, 81605] release: 21.6.0
[12:11:15.132494, cs, 81605] version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000
[12:11:15.132497, cs, 81605] machine: arm64
[12:11:15.132503, cs, 81605] arguments parsed: {program: /opt/homebrew/Cellar/bear/3.0.20_1/bin/citnames, arguments: [{--config: [citnames-config.json]}, {--input: [compile_commands.events.json]}, {--output: [compile_commands.json]}, {--run-checks: []}, {--verbose: []}]}
[12:11:15.132599, cs, 81605] Configuration: {"compilation":{"compilers_to_recognize":[{"executable":"/Applications/ARM/bin/arm-none-eabi-gcc"}]},"output":{"content":{"include_only_existing_source":true},"format":{"command_as_array":true,"drop_output_field":false}}}
[12:11:15.132712, cs, 81605] compilation entries created. [size: 0]
[12:11:15.132715, cs, 81605] compilation entries to output. [size: 0]
[12:11:15.132817, cs, 81605] compilation entries written. [size: 0]
[12:11:15.132823, cs, 81605] succeeded with: 0
[12:11:15.133086, br, 81142] Process wait request: done. [pid: 81605]
[12:11:15.133103, br, 81142] Running citnames finished. [Exited with 0]
[12:11:15.133148, br, 81142] succeeded with: 0

After making sure that the makefile works without bear, I read through relevant issues on GitHub, and have tried:

  • Removing CC defines in the makefile and executing with CC environment variables defined in shell:

    CC=/Applications/ARM/bin/arm-none-eabi-gcc bear --verbose --force-wrapper -- make -j8 CC=/Applications/ARM/bin/arm-none-eabi-gcc
  • Writing a configuration file for citnames:

    {
        "compilation": {
            "compilers_to_recognize": [
                {
                    "executable": "/Applications/ARM/bin/arm-none-eabi-gcc",
                    "flags_to_add": [],
                    "flags_to_remove": []
                }
            ],
            "compilers_to_exclude": []
        },
        "output": {
            "content": {
                "include_only_existing_source": true,
                "paths_to_include": [],
                "paths_to_exclude": []
            },
            "format": {
                "command_as_array": true,
                "drop_output_field": false
            }
        }
    }
  • Directly executing intercept. The events.json output file is empty, however.

That intercept is capturing nothing at all is rather confusing: it looks like other issues would at least have some output from intercept. I wonder what could be the problem here.

Edit: Prior to switching to MacBook I was working on a Linux laptop with zero issue with this project + bear, so I guess it's Mac OS standing in the way after all. By the way, thanks for creating this wonderful tool!

@rizsotto rizsotto added the bug label Aug 12, 2022
@rizsotto
Copy link
Owner

Thanks @mistrpokr , the log was really useful. I've found a bug in the intercept session initialization. Will make a fix on the weekend.

@mistrpokr
Copy link

Glad to help! ;)

@rizsotto
Copy link
Owner

rizsotto commented Aug 31, 2022

It turned out there is no problem with the session initialization... It's about that you've been passing the CC=/Applications/ARM/bin/arm-none-eabi-gcc to your build is the problem. So, make will use it as the C compiler, instead of picking it from the environment... Try this instead:

$ CC=/Applications/ARM/bin/arm-none-eabi-gcc bear --verbose --force-wrapper -- make -j8

@mistrpokr
Copy link

Thanks for the update. I've upgraded bear to 3.0.20_2 and tested with CC=/Applications/ARM/bin/arm-none-eabi-gcc bear --verbose --force-wrapper -- make -j8. Sadly the compile_commands.json output is still empty.

I guess keeping the env vars in the log might be helpful as well. Here are the outputs of CC=/Applications/ARM/bin/arm-none-eabi-gcc bear --verbose --force-wrapper -- make -j8:

[14:01:25.422436, br, 23499] bear: 3.0.20
[14:01:25.422951, br, 23499] arguments: ["bear", "--verbose", "--force-wrapper", "--", "make", "-j8"]
[14:01:25.422978, br, 23499] environment: ["TERM=alacritty", "SHELL=/bin/zsh", "TMPDIR=/var/folders/c9/hywznpld7ns6y79qb05hvwf00000gn/T/", "LC_ALL=en_US.UTF-8", "USER=pokr", "COMMAND_MODE=unix2003", "ALACRITTY_SOCKET=/var/folders/c9/hywznpld7ns6y79qb05hvwf00000gn/T/Alacritty-19906.sock", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.Ap8zSqHUtW/Listeners", "ALACRITTY_LOG=/var/folders/c9/hywznpld7ns6y79qb05hvwf00000gn/T/Alacritty-19906.log", "__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0", "PATH=/opt/local/bin:/opt/local/sbin:/Users/pokr/.nvm/versions/node/v16.16.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/pokr/.nvm/versions/node/v16.16.0/bin:/Users/pokr/Library/Application Support/JetBrains/Toolbox/scripts:/Users/pokr/.local/bin:/Users/pokr/go/bin:/Applications/Arm/bin:/opt/local/bin", "__CFBundleIdentifier=io.alacritty", "PWD=/Users/pokr/code/embedded/totp-token", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "SHLVL=1", "HOME=/Users/pokr", "LOGNAME=pokr", "COLORTERM=truecolor", "OLDPWD=/Users/pokr", "NVM_DIR=/Users/pokr/.nvm", "NVM_CD_FLAGS=-q", "NVM_BIN=/Users/pokr/.nvm/versions/node/v16.16.0/bin", "NVM_INC=/Users/pokr/.nvm/versions/node/v16.16.0/include/node", "HOMEBREW_PREFIX=/opt/homebrew", "HOMEBREW_CELLAR=/opt/homebrew/Cellar", "HOMEBREW_REPOSITORY=/opt/homebrew", "MANPATH=/opt/local/share/man:/Users/pokr/.nvm/versions/node/v16.16.0/share/man:/opt/homebrew/share/man::", "INFOPATH=/opt/homebrew/share/info:", "ZSH=/Users/pokr/.oh-my-zsh", "PAGER=less", "LESS=-R", "LSCOLORS=Gxfxcxdxbxegedabagacad", "http_proxy=http://localhost:1081", "https_proxy=http://localhost:1081", "CC=/Applications/ARM/bin/arm-none-eabi-gcc", "_=/opt/homebrew/bin/bear"]
[14:01:25.422993, br, 23499] sysname: Darwin
[14:01:25.422993, br, 23499] release: 21.6.0
[14:01:25.422994, br, 23499] version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000
[14:01:25.422995, br, 23499] machine: arm64
[14:01:25.422999, br, 23499] arguments parsed: {program: bear, arguments: [{--: [make, -j8]}, {--citnames: [/opt/homebrew/Cellar/bear/3.0.20_2/bin/citnames]}, {--force-wrapper: []}, {--interceptor: [/opt/homebrew/Cellar/bear/3.0.20_2/bin/intercept]}, {--library: [/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/libexec.dylib]}, {--output: [compile_commands.json]}, {--verbose: []}, {--wrapper: [/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/wrapper]}, {--wrapper-dir: [/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/wrapper.d]}]}
[14:01:25.423600, br, 23499] Process spawned. [pid: 23500, command: ["/opt/homebrew/Cellar/bear/3.0.20_2/bin/intercept", "--library", "/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/libexec.dylib", "--wrapper", "/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/wrapper", "--wrapper-dir", "/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/wrapper.d", "--output", "compile_commands.events.json", "--force-wrapper", "--verbose", "--", "make", "-j8"]]
[14:01:25.423621, br, 23499] Process wait requested. [pid: 23500]
[14:01:25.486683, ic, 23500] intercept: 3.0.20
[14:01:25.487257, ic, 23500] arguments: ["/opt/homebrew/Cellar/bear/3.0.20_2/bin/intercept", "--library", "/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/libexec.dylib", "--wrapper", "/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/wrapper", "--wrapper-dir", "/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/wrapper.d", "--output", "compile_commands.events.json", "--force-wrapper", "--verbose", "--", "make", "-j8"]
[14:01:25.487279, ic, 23500] environment: ["ALACRITTY_LOG=/var/folders/c9/hywznpld7ns6y79qb05hvwf00000gn/T/Alacritty-19906.log", "ALACRITTY_SOCKET=/var/folders/c9/hywznpld7ns6y79qb05hvwf00000gn/T/Alacritty-19906.sock", "CC=/Applications/ARM/bin/arm-none-eabi-gcc", "COLORTERM=truecolor", "COMMAND_MODE=unix2003", "HOME=/Users/pokr", "HOMEBREW_CELLAR=/opt/homebrew/Cellar", "HOMEBREW_PREFIX=/opt/homebrew", "HOMEBREW_REPOSITORY=/opt/homebrew", "INFOPATH=/opt/homebrew/share/info:", "LC_ALL=en_US.UTF-8", "LESS=-R", "LOGNAME=pokr", "LSCOLORS=Gxfxcxdxbxegedabagacad", "MANPATH=/opt/local/share/man:/Users/pokr/.nvm/versions/node/v16.16.0/share/man:/opt/homebrew/share/man::", "NVM_BIN=/Users/pokr/.nvm/versions/node/v16.16.0/bin", "NVM_CD_FLAGS=-q", "NVM_DIR=/Users/pokr/.nvm", "NVM_INC=/Users/pokr/.nvm/versions/node/v16.16.0/include/node", "OLDPWD=/Users/pokr", "PAGER=less", "PATH=/opt/local/bin:/opt/local/sbin:/Users/pokr/.nvm/versions/node/v16.16.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/pokr/.nvm/versions/node/v16.16.0/bin:/Users/pokr/Library/Application Support/JetBrains/Toolbox/scripts:/Users/pokr/.local/bin:/Users/pokr/go/bin:/Applications/Arm/bin:/opt/local/bin", "PWD=/Users/pokr/code/embedded/totp-token", "SHELL=/bin/zsh", "SHLVL=1", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.Ap8zSqHUtW/Listeners", "TERM=alacritty", "TMPDIR=/var/folders/c9/hywznpld7ns6y79qb05hvwf00000gn/T/", "USER=pokr", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "ZSH=/Users/pokr/.oh-my-zsh", "_=/opt/homebrew/bin/bear", "__CFBundleIdentifier=io.alacritty", "__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0", "http_proxy=http://localhost:1081", "https_proxy=http://localhost:1081"]
[14:01:25.487296, ic, 23500] sysname: Darwin
[14:01:25.487297, ic, 23500] release: 21.6.0
[14:01:25.487298, ic, 23500] version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000
[14:01:25.487299, ic, 23500] machine: arm64
[14:01:25.487355, ic, 23500] arguments parsed: {program: /opt/homebrew/Cellar/bear/3.0.20_2/bin/intercept, arguments: [{--: [make, -j8]}, {--force-wrapper: []}, {--library: [/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/libexec.dylib]}, {--output: [compile_commands.events.json]}, {--verbose: []}, {--wrapper: [/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/wrapper]}, {--wrapper-dir: [/opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/wrapper.d]}]}
[14:01:25.489179, ic, 23500] session initialized with: wrapper_dir: /opt/homebrew/Cellar/bear/3.0.20_2/lib/bear/wrapper.d
[14:01:25.489190, ic, 23500] session initialized with: mapping: {"ar": "/usr/bin/ar", "as": "/usr/bin/as", "bison": "/usr/bin/bison", "c++": "/usr/bin/c++", "cc": "/Applications/ARM/bin/arm-none-eabi-gcc", "clang": "/usr/bin/clang", "clang++": "/usr/bin/clang++", "cpp": "/usr/bin/cpp", "flex": "/usr/bin/flex", "g++": "/usr/bin/g++", "gcc": "/usr/bin/gcc", "ld": "/usr/bin/ld", "lex": "/usr/bin/lex", "makeinfo": "/usr/bin/makeinfo", "nm": "/usr/bin/nm", "objdump": "/usr/bin/objdump", "ranlib": "/usr/bin/ranlib", "strip": "/usr/bin/strip", "yacc": "/usr/bin/yacc"}
[14:01:25.489192, ic, 23500] session initialized with: override: {"CC": "cc"}
[14:01:25.496975, ic, 23500] Running gRPC server. dns:///localhost:59730
[14:01:25.497219, ic, 23500] Process spawned. [pid: 23501, command: ["make", "-j8"]]
[14:01:25.497239, ic, 23500] Process wait requested. [pid: 23501]

[14:01:28.418582, ic, 23500] Process wait request: done. [pid: 23501]
[14:01:28.418627, ic, 23500] Running command. [Exited with 0]
[14:01:28.418637, ic, 23500] Stopping gRPC server.
[14:01:28.420576, ic, 23500] succeeded with: 0
[14:01:28.421110, br, 23499] Process wait request: done. [pid: 23500]
[14:01:28.421155, br, 23499] Running intercept finished. [Exited with 0]
[14:01:28.421551, br, 23499] Process spawned. [pid: 24013, command: ["/opt/homebrew/Cellar/bear/3.0.20_2/bin/citnames", "--input", "compile_commands.events.json", "--output", "compile_commands.json", "--run-checks", "--verbose"]]
[14:01:28.421568, br, 23499] Process wait requested. [pid: 24013]
[14:01:28.438046, cs, 24013] citnames: 3.0.20
[14:01:28.438470, cs, 24013] arguments: ["/opt/homebrew/Cellar/bear/3.0.20_2/bin/citnames", "--input", "compile_commands.events.json", "--output", "compile_commands.json", "--run-checks", "--verbose"]
[14:01:28.438486, cs, 24013] environment: ["ALACRITTY_LOG=/var/folders/c9/hywznpld7ns6y79qb05hvwf00000gn/T/Alacritty-19906.log", "ALACRITTY_SOCKET=/var/folders/c9/hywznpld7ns6y79qb05hvwf00000gn/T/Alacritty-19906.sock", "CC=/Applications/ARM/bin/arm-none-eabi-gcc", "COLORTERM=truecolor", "COMMAND_MODE=unix2003", "HOME=/Users/pokr", "HOMEBREW_CELLAR=/opt/homebrew/Cellar", "HOMEBREW_PREFIX=/opt/homebrew", "HOMEBREW_REPOSITORY=/opt/homebrew", "INFOPATH=/opt/homebrew/share/info:", "LC_ALL=en_US.UTF-8", "LESS=-R", "LOGNAME=pokr", "LSCOLORS=Gxfxcxdxbxegedabagacad", "MANPATH=/opt/local/share/man:/Users/pokr/.nvm/versions/node/v16.16.0/share/man:/opt/homebrew/share/man::", "NVM_BIN=/Users/pokr/.nvm/versions/node/v16.16.0/bin", "NVM_CD_FLAGS=-q", "NVM_DIR=/Users/pokr/.nvm", "NVM_INC=/Users/pokr/.nvm/versions/node/v16.16.0/include/node", "OLDPWD=/Users/pokr", "PAGER=less", "PATH=/opt/local/bin:/opt/local/sbin:/Users/pokr/.nvm/versions/node/v16.16.0/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/pokr/.nvm/versions/node/v16.16.0/bin:/Users/pokr/Library/Application Support/JetBrains/Toolbox/scripts:/Users/pokr/.local/bin:/Users/pokr/go/bin:/Applications/Arm/bin:/opt/local/bin", "PWD=/Users/pokr/code/embedded/totp-token", "SHELL=/bin/zsh", "SHLVL=1", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.Ap8zSqHUtW/Listeners", "TERM=alacritty", "TMPDIR=/var/folders/c9/hywznpld7ns6y79qb05hvwf00000gn/T/", "USER=pokr", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "ZSH=/Users/pokr/.oh-my-zsh", "_=/opt/homebrew/bin/bear", "__CFBundleIdentifier=io.alacritty", "__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0", "http_proxy=http://localhost:1081", "https_proxy=http://localhost:1081"]
[14:01:28.438509, cs, 24013] sysname: Darwin
[14:01:28.438512, cs, 24013] release: 21.6.0
[14:01:28.438513, cs, 24013] version: Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000
[14:01:28.438513, cs, 24013] machine: arm64
[14:01:28.438687, cs, 24013] arguments parsed: {program: /opt/homebrew/Cellar/bear/3.0.20_2/bin/citnames, arguments: [{--input: [compile_commands.events.json]}, {--output: [compile_commands.json]}, {--run-checks: []}, {--verbose: []}]}
[14:01:28.439019, cs, 24013] Configuration: {"compilation":{"compilers_to_recognize":[{"executable":"/Applications/ARM/bin/arm-none-eabi-gcc"}]},"output":{"content":{"include_only_existing_source":true},"format":{"command_as_array":true,"drop_output_field":false}}}
[14:01:28.439102, cs, 24013] compilation entries created. [size: 0]
[14:01:28.439107, cs, 24013] compilation entries to output. [size: 0]
[14:01:28.439490, cs, 24013] compilation entries written. [size: 0]
[14:01:28.439497, cs, 24013] succeeded with: 0
[14:01:28.439903, br, 23499] Process wait request: done. [pid: 24013]
[14:01:28.439921, br, 23499] Running citnames finished. [Exited with 0]
[14:01:28.439974, br, 23499] succeeded with: 0

@matu3ba
Copy link

matu3ba commented Sep 3, 2022

The problem can be reproduced on bear 3.0.20 with a download of the latest zig https://ziglang.org/download/,
which uses clang as library.

git clone git://git.code.sf.net/p/zsh/code zsh
cd zsh
./Util/preconfig
CC='zig cc' ./configure
bear -- make -j8

@matu3ba
Copy link

matu3ba commented Sep 3, 2022

I did also notice that invalid config files are not checked before compilation is run, which is unfortunate.
The config file did not fix the problem either.

At least for me though, gcc worked fine.

@rizsotto
Copy link
Owner

rizsotto commented Sep 4, 2022

@matu3ba the problem with zig, that CC='zig cc' is not supported by Bear. (The fact that it's a program name and and argument.)

@rizsotto
Copy link
Owner

rizsotto commented Sep 4, 2022

@mistrpokr thanks for the follow up. Can you show some of those lines that you've cropped out from the build output. I am curious how the build is calling the compiler.

@huixie90
Copy link

huixie90 commented Nov 4, 2022

Getting empty output with a simple file compilation on a Mac.

% bear --verbose -- cc main.cpp
[15:04:09.735314, br, 14159] bear: 3.0.20
[15:04:09.736012, br, 14159] arguments: ["bear", "--verbose", "--", "cc", "main.cpp"]
[15:04:09.736033, br, 14159] environment: ["DISPLAY=/private/tmp/com.apple.launchd.aqXKvQ752x/org.macosforge.xquartz:0", "HOME=/Users/huixie", "LANG=en_GB.UTF-8", "LOGNAME=huixie", "PATH=/Users/huixie/repos/arcanist/bin:/Users/huixie/.cabal/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/Library/TeX/texbin:/Users/huixie/.ghcup/bin", "PWD=/tmp/test", "SHELL=/usr/local/bin/fish", "SHLVL=1", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.lEhmeXreL3/Listeners", "TERM=xterm-256color", "TERM_PROGRAM=Apple_Terminal", "TERM_PROGRAM_VERSION=440", "TERM_SESSION_ID=A05BE5A5-F6DD-4757-B328-0B40BECDEF7A", "TMPDIR=/var/folders/g5/2z2q4rs54r10_3z22dwjb8bc0000gn/T/", "USER=huixie", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "__CFBundleIdentifier=com.apple.Terminal"]
[15:04:09.736078, br, 14159] sysname: Darwin
[15:04:09.736082, br, 14159] release: 20.6.0
[15:04:09.736083, br, 14159] version: Darwin Kernel Version 20.6.0: Tue Jun 21 20:50:28 PDT 2022; root:xnu-7195.141.32~1/RELEASE_X86_64
[15:04:09.736085, br, 14159] machine: x86_64
[15:04:09.736115, br, 14159] arguments parsed: {program: bear, arguments: [{--: [cc, main.cpp]}, {--citnames: [/usr/local/Cellar/bear/3.0.20_4/bin/citnames]}, {--interceptor: [/usr/local/Cellar/bear/3.0.20_4/bin/intercept]}, {--library: [/usr/local/Cellar/bear/3.0.20_4/lib/bear/libexec.dylib]}, {--output: [compile_commands.json]}, {--verbose: []}, {--wrapper: [/usr/local/Cellar/bear/3.0.20_4/lib/bear/wrapper]}, {--wrapper-dir: [/usr/local/Cellar/bear/3.0.20_4/lib/bear/wrapper.d]}]}
[15:04:09.738310, br, 14159] Process spawned. [pid: 14160, command: ["/usr/local/Cellar/bear/3.0.20_4/bin/intercept", "--library", "/usr/local/Cellar/bear/3.0.20_4/lib/bear/libexec.dylib", "--wrapper", "/usr/local/Cellar/bear/3.0.20_4/lib/bear/wrapper", "--wrapper-dir", "/usr/local/Cellar/bear/3.0.20_4/lib/bear/wrapper.d", "--output", "compile_commands.events.json", "--verbose", "--", "cc", "main.cpp"]]
[15:04:09.738348, br, 14159] Process wait requested. [pid: 14160]
[15:04:09.763408, ic, 14160] intercept: 3.0.20
[15:04:09.763792, ic, 14160] arguments: ["/usr/local/Cellar/bear/3.0.20_4/bin/intercept", "--library", "/usr/local/Cellar/bear/3.0.20_4/lib/bear/libexec.dylib", "--wrapper", "/usr/local/Cellar/bear/3.0.20_4/lib/bear/wrapper", "--wrapper-dir", "/usr/local/Cellar/bear/3.0.20_4/lib/bear/wrapper.d", "--output", "compile_commands.events.json", "--verbose", "--", "cc", "main.cpp"]
[15:04:09.763813, ic, 14160] environment: ["DISPLAY=/private/tmp/com.apple.launchd.aqXKvQ752x/org.macosforge.xquartz:0", "HOME=/Users/huixie", "LANG=en_GB.UTF-8", "LOGNAME=huixie", "PATH=/Users/huixie/repos/arcanist/bin:/Users/huixie/.cabal/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/Library/TeX/texbin:/Users/huixie/.ghcup/bin", "PWD=/tmp/test", "SHELL=/usr/local/bin/fish", "SHLVL=1", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.lEhmeXreL3/Listeners", "TERM=xterm-256color", "TERM_PROGRAM=Apple_Terminal", "TERM_PROGRAM_VERSION=440", "TERM_SESSION_ID=A05BE5A5-F6DD-4757-B328-0B40BECDEF7A", "TMPDIR=/var/folders/g5/2z2q4rs54r10_3z22dwjb8bc0000gn/T/", "USER=huixie", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "__CFBundleIdentifier=com.apple.Terminal"]
[15:04:09.763859, ic, 14160] sysname: Darwin
[15:04:09.763861, ic, 14160] release: 20.6.0
[15:04:09.763862, ic, 14160] version: Darwin Kernel Version 20.6.0: Tue Jun 21 20:50:28 PDT 2022; root:xnu-7195.141.32~1/RELEASE_X86_64
[15:04:09.763864, ic, 14160] machine: x86_64
[15:04:09.763913, ic, 14160] arguments parsed: {program: /usr/local/Cellar/bear/3.0.20_4/bin/intercept, arguments: [{--: [cc, main.cpp]}, {--library: [/usr/local/Cellar/bear/3.0.20_4/lib/bear/libexec.dylib]}, {--output: [compile_commands.events.json]}, {--verbose: []}, {--wrapper: [/usr/local/Cellar/bear/3.0.20_4/lib/bear/wrapper]}, {--wrapper-dir: [/usr/local/Cellar/bear/3.0.20_4/lib/bear/wrapper.d]}]}
[15:04:09.765744, ic, 14160] session initialized with: wrapper_dir: /usr/local/Cellar/bear/3.0.20_4/lib/bear/wrapper.d
[15:04:09.765766, ic, 14160] session initialized with: mapping: {"ar": "/usr/bin/ar", "as": "/usr/bin/as", "bison": "/usr/bin/bison", "c++": "/usr/bin/c++", "cc": "/usr/bin/cc", "clang": "/usr/local/bin/clang", "clang++": "/usr/local/bin/clang++", "cpp": "/usr/bin/cpp", "ctangle": "/Library/TeX/texbin/ctangle", "cweave": "/Library/TeX/texbin/cweave", "flex": "/usr/bin/flex", "g++": "/usr/bin/g++", "gcc": "/usr/bin/gcc", "ld": "/usr/bin/ld", "lex": "/usr/bin/lex", "makeinfo": "/usr/bin/makeinfo", "nm": "/usr/bin/nm", "objdump": "/usr/bin/objdump", "ranlib": "/usr/bin/ranlib", "strip": "/usr/bin/strip", "tangle": "/Library/TeX/texbin/tangle", "tex": "/Library/TeX/texbin/tex", "weave": "/Library/TeX/texbin/weave", "yacc": "/usr/bin/yacc"}
[15:04:09.765772, ic, 14160] session initialized with: override: {}
[15:04:09.768139, ic, 14160] Running gRPC server. dns:///localhost:54767
[15:04:09.768596, ic, 14160] Process spawned. [pid: 14161, command: ["cc", "main.cpp"]]
[15:04:09.768631, ic, 14160] Process wait requested. [pid: 14161]
[15:04:09.863266, ic, 14160] Process wait request: done. [pid: 14161]
[15:04:09.863319, ic, 14160] Running command. [Exited with 0]
[15:04:09.863332, ic, 14160] Stopping gRPC server.
[15:04:09.864329, ic, 14160] succeeded with: 0
[15:04:09.865564, br, 14159] Process wait request: done. [pid: 14160]
[15:04:09.865620, br, 14159] Running intercept finished. [Exited with 0]
[15:04:09.867109, br, 14159] Process spawned. [pid: 14164, command: ["/usr/local/Cellar/bear/3.0.20_4/bin/citnames", "--input", "compile_commands.events.json", "--output", "compile_commands.json", "--run-checks", "--verbose"]]
[15:04:09.867139, br, 14159] Process wait requested. [pid: 14164]
[15:04:09.891078, cs, 14164] citnames: 3.0.20
[15:04:09.891405, cs, 14164] arguments: ["/usr/local/Cellar/bear/3.0.20_4/bin/citnames", "--input", "compile_commands.events.json", "--output", "compile_commands.json", "--run-checks", "--verbose"]
[15:04:09.891422, cs, 14164] environment: ["DISPLAY=/private/tmp/com.apple.launchd.aqXKvQ752x/org.macosforge.xquartz:0", "HOME=/Users/huixie", "LANG=en_GB.UTF-8", "LOGNAME=huixie", "PATH=/Users/huixie/repos/arcanist/bin:/Users/huixie/.cabal/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin:/Library/TeX/texbin:/Users/huixie/.ghcup/bin", "PWD=/tmp/test", "SHELL=/usr/local/bin/fish", "SHLVL=1", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.lEhmeXreL3/Listeners", "TERM=xterm-256color", "TERM_PROGRAM=Apple_Terminal", "TERM_PROGRAM_VERSION=440", "TERM_SESSION_ID=A05BE5A5-F6DD-4757-B328-0B40BECDEF7A", "TMPDIR=/var/folders/g5/2z2q4rs54r10_3z22dwjb8bc0000gn/T/", "USER=huixie", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "__CFBundleIdentifier=com.apple.Terminal"]
[15:04:09.891448, cs, 14164] sysname: Darwin
[15:04:09.891450, cs, 14164] release: 20.6.0
[15:04:09.891451, cs, 14164] version: Darwin Kernel Version 20.6.0: Tue Jun 21 20:50:28 PDT 2022; root:xnu-7195.141.32~1/RELEASE_X86_64
[15:04:09.891453, cs, 14164] machine: x86_64
[15:04:09.891478, cs, 14164] arguments parsed: {program: /usr/local/Cellar/bear/3.0.20_4/bin/citnames, arguments: [{--input: [compile_commands.events.json]}, {--output: [compile_commands.json]}, {--run-checks: []}, {--verbose: []}]}
[15:04:09.891693, cs, 14164] Configuration: {"compilation":null,"output":{"content":{"include_only_existing_source":true},"format":{"command_as_array":true,"drop_output_field":false}}}
[15:04:09.891866, cs, 14164] compilation entries created. [size: 0]
[15:04:09.891871, cs, 14164] compilation entries to output. [size: 0]
[15:04:09.892164, cs, 14164] compilation entries written. [size: 0]
[15:04:09.892183, cs, 14164] succeeded with: 0
[15:04:09.893029, br, 14159] Process wait request: done. [pid: 14164]
[15:04:09.893121, br, 14159] Running citnames finished. [Exited with 0]
[15:04:09.893238, br, 14159] succeeded with: 0

@rizsotto
Copy link
Owner

rizsotto commented Nov 5, 2022

Hey @huixie90 , that's a not supported use case. Sorry.

@huixie90
Copy link

huixie90 commented Nov 5, 2022

Hey @huixie90 , that's a not supported use case. Sorry.

Ah thanks for the reply. It used to work on Linux this way but not on my Mac. I was wondering why. But this is not my real use case. My real use case is for generating json for llvm lit test envinronment. I used to do

bear — ./bin/lit <more test Params here> <path to test>

this works on Linux machines but not on my Mac. I was wondering if it just used to work by luck.

@rizsotto
Copy link
Owner

rizsotto commented Nov 5, 2022

Bear has two interception strategies. One is using compiler wrappers, and the other is using the dynamic linker library preload functionality. The first one is for systems which has not dynamic linker, or disabled the preload for security reasons. (Mac is in this group.) The compiler wrapper solution has limitations and won't cover use cases that the other approach will.

@huixie90
Copy link

huixie90 commented Nov 5, 2022

Bear has two interception strategies. One is using compiler wrappers, and the other is using the dynamic linker library preload functionality. The first one is for systems which has not dynamic linker, or disabled the preload for security reasons. (Mac is in this group.) The compiler wrapper solution has limitations and won't cover use cases that the other approach will.

I see. Thanks for the explanation. In order to make it working for my case , I guess I need to set DCMAKE_CXX_COMPILER to the compiler wrapper instead of my compiler under test? (Note I don’t need the json generated from building llvm using CMAKE, I need to use bear to generate the one for the lit testing environment.) is there any doc that I can follow to create compiler wrapper around the real compiler-under-test

@rizsotto
Copy link
Owner

rizsotto commented Nov 5, 2022

Yes, forcing the compiler to be the wrapper seems to be a good idea. (Or better, just add the wrapper directory to PATH?) Not sure if it will work though.

@huixie90
Copy link

huixie90 commented Nov 6, 2022

Yes, forcing the compiler to be the wrapper seems to be a good idea. (Or better, just add the wrapper directory to PATH?) Not sure if it will work though.

Managed to get it working on mac to generate the json file for llvm tests

bear -- cmake -G "Unix Makefiles" -S runtimes -B build_json -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DLIBCXX_INCLUDE_TESTS:BOOL=TRUE -DLIBCXX_TEST_PARAMS="enable_modules=False" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER="/usr/local/Cellar/bear/3.0.20_4/lib/bear/wrapper.d/clang++" -DCMAKE_C_COMPILER="/usr/local/Cellar/bear/3.0.20_4/lib/bear/wrapper.d/clang"

bear -- make cxx cxxabi -j12
bear -- make check-cxx -j12
bear -- ./bin/llvm-lit -sv  --param std=c++2b  ../libcxx/test/std/

@spartacoos
Copy link

hi @rizsotto , I'm having a similar issue when attempting the following on an M1 Mac where I get an empty compile_commands.json:

bear -- make 
em++  -DIMGUI_DISABLE_FILE_FUNCTIONS -I./imgui -I./imgui/backends -Wall -Wformat  -Os  -s USE_SDL=2 -s DISABLE_EXCEPTION_CATCHING=1  -c -o main.o main.cpp
em++  -DIMGUI_DISABLE_FILE_FUNCTIONS -I./imgui -I./imgui/backends -Wall -Wformat  -Os  -s USE_SDL=2 -s DISABLE_EXCEPTION_CATCHING=1  -c -o imgui.o imgui/imgui.cpp
em++  -DIMGUI_DISABLE_FILE_FUNCTIONS -I./imgui -I./imgui/backends -Wall -Wformat  -Os  -s USE_SDL=2 -s DISABLE_EXCEPTION_CATCHING=1  -c -o imgui_draw.o imgui/imgui_draw.cpp
em++  -DIMGUI_DISABLE_FILE_FUNCTIONS -I./imgui -I./imgui/backends -Wall -Wformat  -Os  -s USE_SDL=2 -s DISABLE_EXCEPTION_CATCHING=1  -c -o imgui_tables.o imgui/imgui_tables.cpp
em++  -DIMGUI_DISABLE_FILE_FUNCTIONS -I./imgui -I./imgui/backends -Wall -Wformat  -Os  -s USE_SDL=2 -s DISABLE_EXCEPTION_CATCHING=1  -c -o imgui_widgets.o imgui/imgui_widgets.cpp
em++  -DIMGUI_DISABLE_FILE_FUNCTIONS -I./imgui -I./imgui/backends -Wall -Wformat  -Os  -s USE_SDL=2 -s DISABLE_EXCEPTION_CATCHING=1  -c -o imgui_demo.o imgui/imgui_demo.cpp
em++  -DIMGUI_DISABLE_FILE_FUNCTIONS -I./imgui -I./imgui/backends -Wall -Wformat  -Os  -s USE_SDL=2 -s DISABLE_EXCEPTION_CATCHING=1  -c -o imgui_impl_sdl.o imgui/backends/imgui_impl_sdl.cpp
em++  -DIMGUI_DISABLE_FILE_FUNCTIONS -I./imgui -I./imgui/backends -Wall -Wformat  -Os  -s USE_SDL=2 -s DISABLE_EXCEPTION_CATCHING=1  -c -o imgui_impl_opengl3.o imgui/backends/imgui_impl_opengl3.cpp
mkdir web
em++ -o web/index.html main.o imgui.o imgui_draw.o imgui_tables.o imgui_widgets.o imgui_demo.o imgui_impl_sdl.o imgui_impl_opengl3.o  -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_EXIT_RUNTIME=0 -s ASSERTIONS=1 -sLLD_REPORT_UNDEFINED -s NO_FILESYSTEM=1 --shell-file shell_minimal.html  -s USE_SDL=2 -s DISABLE_EXCEPTION_CATCHING=1
Build complete for web/index.html

this works fine (as in this project builds fine without bear) yet when I do:

cat compile_commands.json
> []

I'm using this for an Emscripten project. Could that be the issue? I also tried using the --force-wrapper option and it still doesn't work. Any ideas for a workaround? Also I've disabled SIP on my Mac.

@rizsotto
Copy link
Owner

Hey @spartacoos , your use case might worth a separate ticket. 😄

(Emscripten was not on my radar when I was writing Bear.)

I would try to create a wrapper. Check out the wrapper.d directory, it's full of soft links to the same file. (Just create a new link for the em++.) This will hijack the em++ calls, so the intercept process will have the list of executions. The next step then to create a config file to recognize em++ as compiler call. (Read the man citnames page how to do it.)

Try to run the command with a couple of -v to see some logs, that might hint you what's happening inside.

ps.: The --force-wrapper has no effect on MacOS, because that's the default one (and only mode which exists on this platform).

@frankplow
Copy link

frankplow commented Dec 3, 2022

Has the original issue been resolved/is there a workaround?

With the following MWE:

Makefile

CC=arm-none-eabi-gcc

main: main.c
	$(CC) $< -o $@

main.c

int main() {
  return 0;
}

void _close(void) {}

void _lseek(void) {}

void _read(void) {}

void _write(void) {}

void _sbrk(void) {}

void _exit(int code) {
  while (1) {
  }
}

citnames-config.json

{
    "compilation": {
        "compilers_to_recognize": [
            {
                "executable": "/opt/homebrew/bin/arm-none-eabi-gcc",
                "flags_to_add": [],
                "flags_to_remove": []
            }
        ],
        "compilers_to_exclude": []
    },
    "output": {
        "content": {
            "include_only_existing_source": true,
            "paths_to_include": [],
            "paths_to_exclude": []
        },
        "format": {
            "command_as_array": true,
            "drop_output_field": false
        }
    }
}

bear --verbose --config citnames-config.json -- make
produces no entries in compile_commands.json, with the following log

[17:41:57.971383, br, 20276] bear: 3.0.20
[17:41:57.972126, br, 20276] arguments: ["bear", "--verbose", "--config", "citnames-config.json", "--", "make"]
[17:41:57.972242, br, 20276] environment: ["CLICOLOR=1", "HOME=/Users/frank", "HOMEBREW_CELLAR=/opt/homebrew/Cellar", "HOMEBREW_GITHUB_API_TOKEN=*************************", "HOMEBREW_PREFIX=/opt/homebrew", "HOMEBREW_REPOSITORY=/opt/homebrew", "INFOPATH=/opt/homebrew/share/info:/opt/homebrew/share/info:", "KEYTIMEOUT=1", "LANG=en_GB.UTF-8", "LOGNAME=frank", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:", "MANPATH=/opt/homebrew/share/man:/usr/share/man:/usr/local/share/man:/Library/TeX/Distributions/.DefaultTeX/Contents/Man:/opt/homebrew/share/man:", "OLDPWD=/Users/frank/Uni/work/ELEC3662/project", "PATH=/Users/frank/.pyenv/shims:/Users/frank/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Users/frank/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/frank/.cargo/bin", "PWD=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA", "PYENV_ROOT=/Users/frank/.pyenv", "PYENV_SHELL=zsh", "SHELL=/bin/zsh", "SHLVL=2", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.DAkbRkvtdq/Listeners", "TERM=tmux-256color", "TERM_PROGRAM=tmux", "TERM_PROGRAM_VERSION=3.3a", "TERM_SESSION_ID=B44BEC82-5B0D-4DEE-8F20-1E193F5C915F", "TMPDIR=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/", "TMUX=/private/tmp/tmux-501/default,8499,0", "TMUX_PANE=%5", "TMUX_PLUGIN_ROOT=/Users/frank/.config/tmux/plugins", "UNI=/Users/frank/Uni", "USER=frank", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "__CFBundleIdentifier=com.apple.Terminal", "is_vim=ps -o state= -o comm= -t '#{pane_tty}'     | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'", "_=/opt/homebrew/bin/bear"]
[17:41:57.972287, br, 20276] sysname: Darwin
[17:41:57.972292, br, 20276] release: 21.6.0
[17:41:57.972297, br, 20276] version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:07 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8110
[17:41:57.972302, br, 20276] machine: arm64
[17:41:57.972315, br, 20276] arguments parsed: {program: bear, arguments: [{--: [make]}, {--citnames: [/opt/homebrew/Cellar/bear/3.0.20_6/bin/citnames]}, {--config: [citnames-config.json]}, {--interceptor: [/opt/homebrew/Cellar/bear/3.0.20_6/bin/intercept]}, {--library: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/libexec.dylib]}, {--output: [compile_commands.json]}, {--verbose: []}, {--wrapper: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper]}, {--wrapper-dir: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d]}]}
[17:41:57.973031, br, 20276] Process spawned. [pid: 20277, command: ["/opt/homebrew/Cellar/bear/3.0.20_6/bin/intercept", "--library", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/libexec.dylib", "--wrapper", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper", "--wrapper-dir", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d", "--output", "compile_commands.events.json", "--verbose", "--", "make"]]
[17:41:57.973074, br, 20276] Process wait requested. [pid: 20277]
[17:41:58.001307, ic, 20277] intercept: 3.0.20
[17:41:58.001483, ic, 20277] arguments: ["/opt/homebrew/Cellar/bear/3.0.20_6/bin/intercept", "--library", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/libexec.dylib", "--wrapper", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper", "--wrapper-dir", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d", "--output", "compile_commands.events.json", "--verbose", "--", "make"]
[17:41:58.001535, ic, 20277] environment: ["CLICOLOR=1", "HOME=/Users/frank", "HOMEBREW_CELLAR=/opt/homebrew/Cellar", "HOMEBREW_GITHUB_API_TOKEN=**************************", "HOMEBREW_PREFIX=/opt/homebrew", "HOMEBREW_REPOSITORY=/opt/homebrew", "INFOPATH=/opt/homebrew/share/info:/opt/homebrew/share/info:", "KEYTIMEOUT=1", "LANG=en_GB.UTF-8", "LOGNAME=frank", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:", "MANPATH=/opt/homebrew/share/man:/usr/share/man:/usr/local/share/man:/Library/TeX/Distributions/.DefaultTeX/Contents/Man:/opt/homebrew/share/man:", "OLDPWD=/Users/frank/Uni/work/ELEC3662/project", "PATH=/Users/frank/.pyenv/shims:/Users/frank/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Users/frank/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/frank/.cargo/bin", "PWD=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA", "PYENV_ROOT=/Users/frank/.pyenv", "PYENV_SHELL=zsh", "SHELL=/bin/zsh", "SHLVL=2", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.DAkbRkvtdq/Listeners", "TERM=tmux-256color", "TERM_PROGRAM=tmux", "TERM_PROGRAM_VERSION=3.3a", "TERM_SESSION_ID=B44BEC82-5B0D-4DEE-8F20-1E193F5C915F", "TMPDIR=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/", "TMUX=/private/tmp/tmux-501/default,8499,0", "TMUX_PANE=%5", "TMUX_PLUGIN_ROOT=/Users/frank/.config/tmux/plugins", "UNI=/Users/frank/Uni", "USER=frank", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "_=/opt/homebrew/bin/bear", "__CFBundleIdentifier=com.apple.Terminal", "is_vim=ps -o state= -o comm= -t '#{pane_tty}'     | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"]
[17:41:58.001565, ic, 20277] sysname: Darwin
[17:41:58.001568, ic, 20277] release: 21.6.0
[17:41:58.001570, ic, 20277] version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:07 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8110
[17:41:58.001573, ic, 20277] machine: arm64
[17:41:58.001579, ic, 20277] arguments parsed: {program: /opt/homebrew/Cellar/bear/3.0.20_6/bin/intercept, arguments: [{--: [make]}, {--library: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/libexec.dylib]}, {--output: [compile_commands.events.json]}, {--verbose: []}, {--wrapper: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper]}, {--wrapper-dir: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d]}]}
[17:41:58.002428, ic, 20277] session initialized with: wrapper_dir: /opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d
[17:41:58.002450, ic, 20277] session initialized with: mapping: {"ar": "/usr/bin/ar", "as": "/usr/bin/as", "bison": "/usr/bin/bison", "c++": "/usr/bin/c++", "cc": "/usr/bin/cc", "clang": "/usr/bin/clang", "clang++": "/usr/bin/clang++", "cpp": "/usr/bin/cpp", "ctangle": "/Library/TeX/texbin/ctangle", "cweave": "/Library/TeX/texbin/cweave", "flex": "/usr/bin/flex", "g++": "/usr/bin/g++", "gcc": "/usr/bin/gcc", "ld": "/usr/bin/ld", "lex": "/usr/bin/lex", "makeinfo": "/usr/bin/makeinfo", "nm": "/usr/bin/nm", "objdump": "/usr/bin/objdump", "ranlib": "/usr/bin/ranlib", "strip": "/usr/bin/strip", "tangle": "/Library/TeX/texbin/tangle", "tex": "/Library/TeX/texbin/tex", "weave": "/Library/TeX/texbin/weave", "yacc": "/usr/bin/yacc"}
[17:41:58.002454, ic, 20277] session initialized with: override: {}
[17:41:58.003925, ic, 20277] Running gRPC server. dns:///localhost:54872
[17:41:58.004155, ic, 20277] Process spawned. [pid: 20278, command: ["make"]]
[17:41:58.004177, ic, 20277] Process wait requested. [pid: 20278]
[17:41:58.059356, ic, 20277] Process wait request: done. [pid: 20278]
[17:41:58.059382, ic, 20277] Running command. [Exited with 0]
[17:41:58.059388, ic, 20277] Stopping gRPC server.
[17:41:58.059650, ic, 20277] succeeded with: 0
[17:41:58.059983, br, 20276] Process wait request: done. [pid: 20277]
[17:41:58.060008, br, 20276] Running intercept finished. [Exited with 0]
[17:41:58.060164, br, 20276] Process spawned. [pid: 20287, command: ["/opt/homebrew/Cellar/bear/3.0.20_6/bin/citnames", "--input", "compile_commands.events.json", "--output", "compile_commands.json", "--run-checks", "--config", "citnames-config.json", "--verbose"]]
[17:41:58.060181, br, 20276] Process wait requested. [pid: 20287]
[17:41:58.073643, cs, 20287] citnames: 3.0.20
[17:41:58.073750, cs, 20287] arguments: ["/opt/homebrew/Cellar/bear/3.0.20_6/bin/citnames", "--input", "compile_commands.events.json", "--output", "compile_commands.json", "--run-checks", "--config", "citnames-config.json", "--verbose"]
[17:41:58.073783, cs, 20287] environment: ["CLICOLOR=1", "HOME=/Users/frank", "HOMEBREW_CELLAR=/opt/homebrew/Cellar", "HOMEBREW_GITHUB_API_TOKEN=*****************************", "HOMEBREW_PREFIX=/opt/homebrew", "HOMEBREW_REPOSITORY=/opt/homebrew", "INFOPATH=/opt/homebrew/share/info:/opt/homebrew/share/info:", "KEYTIMEOUT=1", "LANG=en_GB.UTF-8", "LOGNAME=frank", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:", "MANPATH=/opt/homebrew/share/man:/usr/share/man:/usr/local/share/man:/Library/TeX/Distributions/.DefaultTeX/Contents/Man:/opt/homebrew/share/man:", "OLDPWD=/Users/frank/Uni/work/ELEC3662/project", "PATH=/Users/frank/.pyenv/shims:/Users/frank/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Users/frank/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/frank/.cargo/bin", "PWD=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA", "PYENV_ROOT=/Users/frank/.pyenv", "PYENV_SHELL=zsh", "SHELL=/bin/zsh", "SHLVL=2", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.DAkbRkvtdq/Listeners", "TERM=tmux-256color", "TERM_PROGRAM=tmux", "TERM_PROGRAM_VERSION=3.3a", "TERM_SESSION_ID=B44BEC82-5B0D-4DEE-8F20-1E193F5C915F", "TMPDIR=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/", "TMUX=/private/tmp/tmux-501/default,8499,0", "TMUX_PANE=%5", "TMUX_PLUGIN_ROOT=/Users/frank/.config/tmux/plugins", "UNI=/Users/frank/Uni", "USER=frank", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "_=/opt/homebrew/bin/bear", "__CFBundleIdentifier=com.apple.Terminal", "is_vim=ps -o state= -o comm= -t '#{pane_tty}'     | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"]
[17:41:58.073800, cs, 20287] sysname: Darwin
[17:41:58.073801, cs, 20287] release: 21.6.0
[17:41:58.073803, cs, 20287] version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:07 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8110
[17:41:58.073804, cs, 20287] machine: arm64
[17:41:58.073808, cs, 20287] arguments parsed: {program: /opt/homebrew/Cellar/bear/3.0.20_6/bin/citnames, arguments: [{--config: [citnames-config.json]}, {--input: [compile_commands.events.json]}, {--output: [compile_commands.json]}, {--run-checks: []}, {--verbose: []}]}
[17:41:58.073873, cs, 20287] Configuration: {"compilation":{"compilers_to_recognize":[{"executable":"/opt/homebrew/bin/arm-none-eabi-gcc"}]},"output":{"content":{"include_only_existing_source":true},"format":{"command_as_array":true,"drop_output_field":false}}}
[17:41:58.073949, cs, 20287] compilation entries created. [size: 0]
[17:41:58.073952, cs, 20287] compilation entries to output. [size: 0]
[17:41:58.074044, cs, 20287] compilation entries written. [size: 0]
[17:41:58.074049, cs, 20287] succeeded with: 0
[17:41:58.074316, br, 20276] Process wait request: done. [pid: 20287]
[17:41:58.074333, br, 20276] Running citnames finished. [Exited with 0]
[17:41:58.074361, br, 20276] succeeded with: 0

@rizsotto
Copy link
Owner

rizsotto commented Dec 3, 2022

@frankplow thanks for this report.

Could you try this change?

main: main.c
	$(CC) $< -o $@

And call CC=arm-none-eabi-gcc bear --verbose --config citnames-config.json -- make?

If this is not working, try to create a new link in /opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d which is points to the same wrapper file, but named as arm-none-eabi-gcc?

@frankplow
Copy link

@rizsotto Running the command with CC set as an environment variable works correctly, thanks.

compile_commands.json

[
  {
    "arguments": [
      "/opt/homebrew/bin/arm-none-eabi-gcc",
      "-c",
      "-o",
      "main",
      "main.c"
    ],
    "directory": "/private/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA",
    "file": "/private/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA/main.c",
    "output": "/private/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA/main"
  }
]

stderr

[11:49:00.338471, br, 38989] bear: 3.0.20
[11:49:00.339378, br, 38989] arguments: ["bear", "--verbose", "--config", "citnames-config.json", "--", "make"]
[11:49:00.339499, br, 38989] environment: ["__CFBundleIdentifier=com.apple.Terminal", "TMPDIR=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/", "XPC_FLAGS=0x0", "TERM=xterm-256color", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.DAkbRkvtdq/Listeners", "XPC_SERVICE_NAME=0", "TERM_PROGRAM=Apple_Terminal", "TERM_PROGRAM_VERSION=445", "TERM_SESSION_ID=05272F4F-66F6-471F-8FAD-D309534DDB08", "SHELL=/bin/zsh", "HOME=/Users/frank", "LOGNAME=frank", "USER=frank", "PATH=/Users/frank/.pyenv/shims:/Users/frank/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Users/frank/.cargo/bin", "SHLVL=1", "PWD=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA", "OLDPWD=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T", "HOMEBREW_PREFIX=/opt/homebrew", "HOMEBREW_CELLAR=/opt/homebrew/Cellar", "HOMEBREW_REPOSITORY=/opt/homebrew", "MANPATH=/opt/homebrew/share/man::", "INFOPATH=/opt/homebrew/share/info:", "UNI=/Users/frank/Uni", "PYENV_ROOT=/Users/frank/.pyenv", "CLICOLOR=1", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:", "KEYTIMEOUT=1", "PYENV_SHELL=zsh", "LANG=en_GB.UTF-8", "CC=arm-none-eabi-gcc", "_=/opt/homebrew/bin/bear"]
[11:49:00.339547, br, 38989] sysname: Darwin
[11:49:00.339555, br, 38989] release: 21.6.0
[11:49:00.339564, br, 38989] version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:07 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8110
[11:49:00.339572, br, 38989] machine: arm64
[11:49:00.339588, br, 38989] arguments parsed: {program: bear, arguments: [{--: [make]}, {--citnames: [/opt/homebrew/Cellar/bear/3.0.20_6/bin/citnames]}, {--config: [citnames-config.json]}, {--interceptor: [/opt/homebrew/Cellar/bear/3.0.20_6/bin/intercept]}, {--library: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/libexec.dylib]}, {--output: [compile_commands.json]}, {--verbose: []}, {--wrapper: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper]}, {--wrapper-dir: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d]}]}
[11:49:00.340301, br, 38989] Process spawned. [pid: 38990, command: ["/opt/homebrew/Cellar/bear/3.0.20_6/bin/intercept", "--library", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/libexec.dylib", "--wrapper", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper", "--wrapper-dir", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d", "--output", "compile_commands.events.json", "--verbose", "--", "make"]]
[11:49:00.340369, br, 38989] Process wait requested. [pid: 38990]
[11:49:00.368312, ic, 38990] intercept: 3.0.20
[11:49:00.368511, ic, 38990] arguments: ["/opt/homebrew/Cellar/bear/3.0.20_6/bin/intercept", "--library", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/libexec.dylib", "--wrapper", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper", "--wrapper-dir", "/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d", "--output", "compile_commands.events.json", "--verbose", "--", "make"]
[11:49:00.368562, ic, 38990] environment: ["CC=arm-none-eabi-gcc", "CLICOLOR=1", "HOME=/Users/frank", "HOMEBREW_CELLAR=/opt/homebrew/Cellar", "HOMEBREW_PREFIX=/opt/homebrew", "HOMEBREW_REPOSITORY=/opt/homebrew", "INFOPATH=/opt/homebrew/share/info:", "KEYTIMEOUT=1", "LANG=en_GB.UTF-8", "LOGNAME=frank", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:", "MANPATH=/opt/homebrew/share/man::", "OLDPWD=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T", "PATH=/Users/frank/.pyenv/shims:/Users/frank/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Users/frank/.cargo/bin", "PWD=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA", "PYENV_ROOT=/Users/frank/.pyenv", "PYENV_SHELL=zsh", "SHELL=/bin/zsh", "SHLVL=1", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.DAkbRkvtdq/Listeners", "TERM=xterm-256color", "TERM_PROGRAM=Apple_Terminal", "TERM_PROGRAM_VERSION=445", "TERM_SESSION_ID=05272F4F-66F6-471F-8FAD-D309534DDB08", "TMPDIR=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/", "UNI=/Users/frank/Uni", "USER=frank", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "_=/opt/homebrew/bin/bear", "__CFBundleIdentifier=com.apple.Terminal"]
[11:49:00.368579, ic, 38990] sysname: Darwin
[11:49:00.368581, ic, 38990] release: 21.6.0
[11:49:00.368584, ic, 38990] version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:07 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8110
[11:49:00.368586, ic, 38990] machine: arm64
[11:49:00.368593, ic, 38990] arguments parsed: {program: /opt/homebrew/Cellar/bear/3.0.20_6/bin/intercept, arguments: [{--: [make]}, {--library: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/libexec.dylib]}, {--output: [compile_commands.events.json]}, {--verbose: []}, {--wrapper: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper]}, {--wrapper-dir: [/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d]}]}
[11:49:00.369463, ic, 38990] session initialized with: wrapper_dir: /opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d
[11:49:00.369490, ic, 38990] session initialized with: mapping: {"ar": "/usr/bin/ar", "as": "/usr/bin/as", "bison": "/usr/bin/bison", "c++": "/usr/bin/c++", "cc": "/opt/homebrew/bin/arm-none-eabi-gcc", "clang": "/usr/bin/clang", "clang++": "/usr/bin/clang++", "cpp": "/usr/bin/cpp", "ctangle": "/Library/TeX/texbin/ctangle", "cweave": "/Library/TeX/texbin/cweave", "flex": "/usr/bin/flex", "g++": "/usr/bin/g++", "gcc": "/usr/bin/gcc", "ld": "/usr/bin/ld", "lex": "/usr/bin/lex", "makeinfo": "/usr/bin/makeinfo", "nm": "/usr/bin/nm", "objdump": "/usr/bin/objdump", "ranlib": "/usr/bin/ranlib", "strip": "/usr/bin/strip", "tangle": "/Library/TeX/texbin/tangle", "tex": "/Library/TeX/texbin/tex", "weave": "/Library/TeX/texbin/weave", "yacc": "/usr/bin/yacc"}
[11:49:00.369496, ic, 38990] session initialized with: override: {"CC": "cc"}
[11:49:00.371031, ic, 38990] Running gRPC server. dns:///localhost:57613
[11:49:00.371293, ic, 38990] Process spawned. [pid: 38991, command: ["make"]]
[11:49:00.371316, ic, 38990] Process wait requested. [pid: 38991]
[11:49:00.807176, wr, 38992, ppid: 38991] wrapper: 3.0.20
[11:49:00.807663, wr, 38992, ppid: 38991] arguments: ["cc", "main.c", "-o", "main"]
[11:49:00.807737, wr, 38992, ppid: 38991] environment: ["UNI=/Users/frank/Uni", "SHELL=/bin/zsh", "_=/opt/homebrew/bin/bear", "__CFBundleIdentifier=com.apple.Terminal", "INFOPATH=/opt/homebrew/share/info:", "PATH=/opt/homebrew/Cellar/bear/3.0.20_6/lib/bear/wrapper.d:/Users/frank/.pyenv/shims:/Users/frank/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Users/frank/.cargo/bin", "PYENV_ROOT=/Users/frank/.pyenv", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.DAkbRkvtdq/Listeners", "PWD=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA", "HOMEBREW_CELLAR=/opt/homebrew/Cellar", "INTERCEPT_REPORT_DESTINATION=dns:///localhost:57613", "MANPATH=/opt/homebrew/share/man::", "PYENV_SHELL=zsh", "HOME=/Users/frank", "LOGNAME=frank", "KEYTIMEOUT=1", "XPC_FLAGS=0x0", "SHLVL=1", "CC=cc", "USER=frank", "TERM_SESSION_ID=05272F4F-66F6-471F-8FAD-D309534DDB08", "INTERCEPT_VERBOSE=true", "OLDPWD=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T", "TERM_PROGRAM=Apple_Terminal", "TMPDIR=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/", "MAKEFLAGS=", "MFLAGS=", "TERM_PROGRAM_VERSION=445", "XPC_SERVICE_NAME=0", "HOMEBREW_PREFIX=/opt/homebrew", "HOMEBREW_REPOSITORY=/opt/homebrew", "__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x2", "CLICOLOR=1", "LANG=en_GB.UTF-8", "TERM=xterm-256color", "MAKELEVEL=1"]
[11:49:00.808321, wr, 38992, ppid: 38991] gRPC call requested: supervise::Supervisor::Resolve
[11:49:00.810583, ic, 38990] trying to resolve for wrapper: cc
[11:49:00.810818, wr, 38992, ppid: 38991] gRPC call [Resolve] finished: true
[11:49:00.812710, wr, 38992, ppid: 38991] Process spawned. [pid: 38993, command: ["/opt/homebrew/bin/arm-none-eabi-gcc", "main.c", "-o", "main"]]
[11:49:00.812733, wr, 38992, ppid: 38991] gRPC call requested: supervise::Interceptor::Register
[11:49:00.814702, wr, 38992, ppid: 38991] gRPC call [Register] finished: true
[11:49:00.814744, wr, 38992, ppid: 38991] Process wait requested. [pid: 38993]
[11:49:00.956880, wr, 38992, ppid: 38991] Process wait request: done. [pid: 38993]
[11:49:00.956894, wr, 38992, ppid: 38991] gRPC call requested: supervise::Interceptor::Register
[11:49:00.957223, wr, 38992, ppid: 38991] gRPC call [Register] finished: true
[11:49:00.957457, wr, 38992, ppid: 38991] succeeded with: 0
[11:49:00.957940, ic, 38990] Process wait request: done. [pid: 38991]
[11:49:00.957959, ic, 38990] Running command. [Exited with 0]
[11:49:00.957963, ic, 38990] Stopping gRPC server.
[11:49:00.958126, ic, 38990] succeeded with: 0
[11:49:00.958476, br, 38989] Process wait request: done. [pid: 38990]
[11:49:00.958494, br, 38989] Running intercept finished. [Exited with 0]
[11:49:00.958649, br, 38989] Process spawned. [pid: 38998, command: ["/opt/homebrew/Cellar/bear/3.0.20_6/bin/citnames", "--input", "compile_commands.events.json", "--output", "compile_commands.json", "--run-checks", "--config", "citnames-config.json", "--verbose"]]
[11:49:00.958663, br, 38989] Process wait requested. [pid: 38998]
[11:49:00.972028, cs, 38998] citnames: 3.0.20
[11:49:00.972153, cs, 38998] arguments: ["/opt/homebrew/Cellar/bear/3.0.20_6/bin/citnames", "--input", "compile_commands.events.json", "--output", "compile_commands.json", "--run-checks", "--config", "citnames-config.json", "--verbose"]
[11:49:00.972185, cs, 38998] environment: ["CC=arm-none-eabi-gcc", "CLICOLOR=1", "HOME=/Users/frank", "HOMEBREW_CELLAR=/opt/homebrew/Cellar", "HOMEBREW_PREFIX=/opt/homebrew", "HOMEBREW_REPOSITORY=/opt/homebrew", "INFOPATH=/opt/homebrew/share/info:", "KEYTIMEOUT=1", "LANG=en_GB.UTF-8", "LOGNAME=frank", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:", "MANPATH=/opt/homebrew/share/man::", "OLDPWD=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T", "PATH=/Users/frank/.pyenv/shims:/Users/frank/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Users/frank/.cargo/bin", "PWD=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA", "PYENV_ROOT=/Users/frank/.pyenv", "PYENV_SHELL=zsh", "SHELL=/bin/zsh", "SHLVL=1", "SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.DAkbRkvtdq/Listeners", "TERM=xterm-256color", "TERM_PROGRAM=Apple_Terminal", "TERM_PROGRAM_VERSION=445", "TERM_SESSION_ID=05272F4F-66F6-471F-8FAD-D309534DDB08", "TMPDIR=/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/", "UNI=/Users/frank/Uni", "USER=frank", "XPC_FLAGS=0x0", "XPC_SERVICE_NAME=0", "_=/opt/homebrew/bin/bear", "__CFBundleIdentifier=com.apple.Terminal"]
[11:49:00.972203, cs, 38998] sysname: Darwin
[11:49:00.972205, cs, 38998] release: 21.6.0
[11:49:00.972207, cs, 38998] version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:07 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8110
[11:49:00.972208, cs, 38998] machine: arm64
[11:49:00.972212, cs, 38998] arguments parsed: {program: /opt/homebrew/Cellar/bear/3.0.20_6/bin/citnames, arguments: [{--config: [citnames-config.json]}, {--input: [compile_commands.events.json]}, {--output: [compile_commands.json]}, {--run-checks: []}, {--verbose: []}]}
[11:49:00.972274, cs, 38998] Configuration: {"compilation":{"compilers_to_recognize":[{"executable":"arm-none-eabi-gcc"}]},"output":{"content":{"include_only_existing_source":true},"format":{"command_as_array":true,"drop_output_field":false}}}
[11:49:00.972656, cs, 38998] [pid: 38993] execution: {"executable":"/opt/homebrew/bin/arm-none-eabi-gcc","arguments":["/opt/homebrew/bin/arm-none-eabi-gcc","main.c","-o","main"],"workingDir":"/private/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA","environment":{"TERM_SESSION_ID":"05272F4F-66F6-471F-8FAD-D309534DDB08","HOMEBREW_REPOSITORY":"/opt/homebrew","PWD":"/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/tmp.dbtypHNA","MFLAGS":"","SHLVL":"1","TMPDIR":"/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T/","MANPATH":"/opt/homebrew/share/man::","MAKEFLAGS":"","MAKELEVEL":"1","SHELL":"/bin/zsh","__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x2","USER":"frank","LOGNAME":"frank","HOMEBREW_PREFIX":"/opt/homebrew","OLDPWD":"/var/folders/1v/j907_dgn2_33jx8ghf8s7h900000gn/T","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.DAkbRkvtdq/Listeners","TERM_PROGRAM":"Apple_Terminal","PYENV_ROOT":"/Users/frank/.pyenv","LANG":"en_GB.UTF-8","UNI":"/Users/frank/Uni","PYENV_SHELL":"zsh","CLICOLOR":"1","KEYTIMEOUT":"1","LS_COLORS":"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:","__CFBundleIdentifier":"com.apple.Terminal","XPC_SERVICE_NAME":"0","TERM":"xterm-256color","HOME":"/Users/frank","HOMEBREW_CELLAR":"/opt/homebrew/Cellar","PATH":"/Users/frank/.pyenv/shims:/Users/frank/.local/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Users/frank/.cargo/bin","TERM_PROGRAM_VERSION":"445","_":"/opt/homebrew/bin/bear","XPC_FLAGS":"0x0","INFOPATH":"/opt/homebrew/share/info:"}}
[11:49:00.972703, cs, 38998] [pid: 38993] recognized.
[11:49:00.972786, cs, 38998] compilation entries created. [size: 1]
[11:49:00.972788, cs, 38998] compilation entries to output. [size: 1]
[11:49:00.972866, cs, 38998] compilation entries written. [size: 1]
[11:49:00.972870, cs, 38998] succeeded with: 0
[11:49:00.973147, br, 38989] Process wait request: done. [pid: 38998]
[11:49:00.973163, br, 38989] Running citnames finished. [Exited with 0]
[11:49:00.973206, br, 38989] succeeded with: 0

Is there any way I can get it to work while still setting CC in the Makefile?

@rizsotto
Copy link
Owner

rizsotto commented Dec 4, 2022

That's good news @frankplow ! Thanks to come back with it.

I believe keeping the CC outside of your makefile is a good practice. That's how you can change the compiler easily on your project... And Bear is built around that principle, and using the CC environment to interpose the compiler.

This is not a limitation if you are using Linux, where the interception is based on the dynamic linker preload feature. That will work with CC set in the Makefile... Unfortunately this mode is not available on MacOS.

@kassane
Copy link

kassane commented Jul 22, 2023

@matu3ba the problem with zig, that CC='zig cc' is not supported by Bear. (The fact that it's a program name and and argument.)

This would be covered in upstream. ziglang/zig#9323

@RadekPudelko
Copy link

For m1 macs when compiling with arm-none-eabi, I found that adding a wrapper to the wrapper.d folder with the specific tool names fixes the empty compile commands file issue.

wrapper.d folder: /opt/homebrew/Cellar/bear/3.1.2_5/lib/bear
you will need to replace 3.1.2_5 with your version.

I had to add:
arm-none-eabi-g++
arm-none-eabi-gcc
arm-none-eabi-gcc-ar

You may need to add other wrappers in your case.

@AshUK
Copy link

AshUK commented Nov 1, 2023

Also experiencing this issue when trying to use the arm gnu compiler.

@rizsotto are you placing the arm-none-eabi-* binaries into the /opt/homebrew/Cellar/bear/3.1.3_7/lib/bear/wrapper.d here ?

@rizsotto
Copy link
Owner

rizsotto commented Nov 1, 2023

I have not planned to add them. I think it's more like a packaging task. (The package maker is more familiar what compilers are available or commonly used.)

@melbaldove
Copy link

For m1 macs when compiling with arm-none-eabi, I found that adding a wrapper to the wrapper.d folder with the specific tool names fixes the empty compile commands file issue.

wrapper.d folder: /opt/homebrew/Cellar/bear/3.1.2_5/lib/bear you will need to replace 3.1.2_5 with your version.

I had to add: arm-none-eabi-g++ arm-none-eabi-gcc arm-none-eabi-gcc-ar

You may need to add other wrappers in your case.

This works for me thanks. I added the mentioned files as symlinks to wrapper. I prefer this solution so I dont need to change my Makefile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests