Closed Tachi107 closed 5 months ago
Here's an example of what Bear was logging to the events JSON file while building:
{"rid":"17527298732620882772","timestamp":"2024-05-04T15:56:43.280418Z","started":{"execution":{"executable":"/bin/sh","arguments":["/bin/sh","-ec","cc -g -Werror -Wall -Wimplicit-function-declaration -Wno-pointer-sign -Wframe-larger-than=2047 -Wno-address-of-packed-member -Wno-constant-conversion -Wno-unused-but-set-variable -Wno-gnu-folding-constant -mcmodel=kernel -mno-red-zone -mno-sse2 -mno-sse -mno-3dnow -mno-mmx -msoft-float -fno-omit-frame-pointer -ffreestanding -fno-pie -msave-args -mretpoline-external-thunk -fcf-protection=branch -O2 -pipe -nostdinc -I/usr/src/sys -I/usr/src/sys/arch/amd64/compile/GENERIC.MP/obj -I/usr/src/sys/arch -I/usr/src/sys/dev/pci/drm/include -I/usr/src/sys/dev/pci/drm/include/uapi -I/usr/src/sys/dev/pci/drm/amd/include/asic_reg -I/usr/src/sys/dev/pci/drm/amd/include -I/usr/src/sys/dev/pci/drm/amd/amdgpu -I/usr/src/sys/dev/pci/drm/amd/display -I/usr/src/sys/dev/pci/drm/amd/display/include -I/usr/src/sys/dev/pci/drm/amd/display/dc -I/usr/src/sys/dev/pci/drm/amd/display/amdgpu_dm -I/usr/src/sys/dev/pci/drm/amd/pm/inc -I/usr/src/sys/dev/pci/drm/amd/pm/legacy-dpm -I/usr/src/sys/dev/pci/drm/amd/pm/swsmu -I/usr/src/sys/dev/pci/drm/amd/pm/swsmu/inc -I/usr/src/sys/dev/pci/drm/amd/pm/swsmu/smu11 -I/usr/src/sys/dev/pci/drm/amd/pm/swsmu/smu12 -I/usr/src/sys/dev/pci/drm/amd/pm/swsmu/smu13 -I/usr/src/sys/dev/pci/drm/amd/pm/powerplay/inc -I/usr/src/sys/dev/pci/drm/amd/pm/powerplay/hwmgr -I/usr/src/sys/dev/pci/drm/amd/pm/powerplay/smumgr -I/usr/src/sys/dev/pci/drm/amd/pm/swsmu/inc -I/usr/src/sys/dev/pci/drm/amd/pm/swsmu/inc/pmfw_if -I/usr/src/sys/dev/pci/drm/amd/display/dc/inc -I/usr/src/sys/dev/pci/drm/amd/display/dc/inc/hw -I/usr/src/sys/dev/pci/drm/amd/display/dc/clk_mgr -I/usr/src/sys/dev/pci/drm/amd/display/modules/inc -I/usr/src/sys/dev/pci/drm/amd/display/modules/hdcp -I/usr/src/sys/dev/pci/drm/amd/display/dmub/inc -I/usr/src/sys/dev/pci/drm/i915 -DDDB -DDIAGNOSTIC -DKTRACE -DACCOUNTING -DKMEMSTATS -DPTRACE -DCRYPTO -DSYSVMSG -DSYSVSEM -DSYSVSHM -DUVM_SWAP_ENCRYPT -DFFS -DFFS2 -DFFS_SOFTUPDATES -DUFS_DIRHASH -DQUOTA -DEXT2FS -DMFS -DNFSCLIENT -DNFSSERVER -DCD9660 -DUDF -DMSDOSFS -DFIFO -DFUSE -DSOCKET_SPLICE -DTCP_ECN -DTCP_SIGNATURE -DINET6 -DIPSEC -DPPP_BSDCOMP -DPPP_DEFLATE -DPIPEX -DMROUTING -DMPLS -DBOOT_CONFIG -DUSER_PCICONF -DAPERTURE -DMTRR -DNTFS -DSUSPEND -DHIBERNATE -DPCIVERBOSE -DUSBVERBOSE -DWSDISPLAY_COMPAT_USL -DWSDISPLAY_COMPAT_RAWKBD -DWSDISPLAY_DEFAULTSCREENS=\"6\" -DX86EMU -DONEWIREVERBOSE -DMULTIPROCESSOR -DMAXUSERS=80 -D_KERNEL -MD -MP -c /usr/src/sys/dev/acpi/aplgpio.c"],"working_dir":"/usr/obj/sys/arch/amd64/compile/GENERIC.MP","environment":{"LD_PRELOAD":"/usr/local/lib/bear/libexec.so","INTERCEPT_REPORT_COMMAND":"/usr/local/lib/bear/wrapper","MAKEBASEDIRECTORY":"/usr/src/sys/arch/amd64/compile/GENERIC.MP","USER":"root","PATH":"/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin","INTERCEPT_REPORT_DESTINATION":"dns:///localhost:20044","HOME":"/root","MAKEFLAGS":" ","PWD":"/usr/src/sys/arch/amd64/compile/GENERIC.MP/obj","LOGNAME":"root","SHELL":"/bin/ksh","DOAS_USER":"tachi","TERM":"xterm"}},"pid":2014,"ppid":57855}}
{"rid":"17527298732620882772","timestamp":"2024-05-04T15:56:43.487492Z","terminated":{"status":"0"}}
Solved the issue by running bear in compiler wrapper mode with --force-wrapper
. Thanks for adding this option!
Describe the bug
Bear is unable to generate a compilation database when compiling the OpenBSD kernel. The build is successful, but the resulting
compile_commands.json
file only includes an empty JSON array ([]
).To Reproduce
Install OpenBSD 7.5
Build gRPC from source
pkg_add abseil-cpp cmake git libcares protobuf re2
$ git clone --branch=v1.63.0 https://github.com/grpc/grpc.git $ cd grpc $ cmake -B cmake/build -DgRPC_DOWNLOAD_ARCHIVES:BOOL=OFF -DgRPC_INSTALL:BOOL=ON -DgRPC_BUILD_TESTS:BOOL=OFF -DgRPC_BUILD_GRPCPP_OTEL_PLUGIN:BOOL=OFF -DgRPC_BUILD_GRPC_CSHARP_PLUGIN:BOOL=OFF -DgRPC_BUILD_GRPC_NODE_PLUGIN:BOOL=OFF -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN:BOOL=OFF -DgRPC_BUILD_GRPC_PHP_PLUGIN:BOOL=OFF -DgRPC_BUILD_GRPC_PYTHON_PLUGIN:BOOL=OFF -DgRPC_BUILD_GRPC_RUBY_PLUGIN:BOOL=OFF -DgRPC_USE_SYSTEMD:STRING=OFF -DgRPC_ZLIB_PROVIDER:STRING=package -DgRPC_CARES_PROVIDER:STRING=package -DgRPC_RE2_PROVIDER:STRING=package -DgRPC_SSL_PROVIDER:STRING=package -DgRPC_PROTOBUF_PROVIDER:STRING=package -DgRPC_BENCHMARK_PROVIDER:STRING=none -DgRPC_ABSL_PROVIDER:STRING=package -DgRPC_OPENTELEMETRY_PROVIDER:STRING=package $ cmake --build cmake/build
cmake --install cmake/build
Build pkgconf 2.x from source (the default pkg-config can't handle grpc++'s big .pc file)
$ ftp https://distfiles.ariadne.space/pkgconf/pkgconf-2.2.0.tar.gz $ tar -xvzf pkgconf-2.2.0.tar.gz $ cd pkgconf-2.2.0 $ ./configure --with-pkg-config-dir=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig $ make
make install
Build Bear from source. Note that simply following the steps below will probably lead to some linking errors. You can solve them by using
grpc++_unsecure
instead ofgrpc++
, removing thespdlog
dependency and promotingRequires.private
andLibs.private
to their non-.private
equivalent in/usr/local/lib/pkgconfig/grpc++_unsecure.pc
(I haven't fully understood why these linking errors occur to be honest, but overlinking and removing spdlog code shouldn't cause any issues). You'll also need to explicitly tellprotoc
where to find the base protobuf headers with-I /usr/local/include
.pkg_add fmt nlohmann-json spdlog
$ git clone https://github.com/rizsotto/Bear.git $ cd Bear $ PKG_CONFIG="pkgconf" cmake -B build $ PKG_CONFIG="pkgconf" cmake --build build
cmake --install build
Here's my current diff with master:
Download the kernel source and place it in
/usr/src
$ usermod -G wsrc $LOGNAME $ ftp https://cdn.openbsd.org/pub/OpenBSD/7.5/sys.tar.gz $ cd /usr/src $ tar -xvzf $OLDPWD/sys.tar.gz
Compile the kernel following the instructions in
release(8)
$ cd /sys/arch/$(machine)/compile/GENERIC.MP
make obj
make config
bear -- make
Print the resuling
compile_commands.json
$ cat compile_commands.json []
Environment: