Open wireless-road opened 4 years ago
I have the same error, but in my case, the file is completely empty.
EDIT: I fixed it by running a fake build, ie with the -n
command. This could solve your problem.
Unfortunately, -n
didn't help.
I run compiledb from source with enabled debug info and it shows me following:
## Processing build commands from <fdopen>
Line 1: Failed to parse build command [Details: (<class 'bashlex.tokenizer.MatchedPairError'>) unexpected EOF while looking for matching '`' (position 78)]. Ignoring: 'make: Entering directory `/c/sw_package/sources/iot/hello/src''
New command: C:\tools\MinGW\bin\gcc.exe -IC:\tools\MinGW\i686-w64-mingw32\include hello.c -v --debug -o hello.exe
Line 3: Failed to parse build command [Details: (<class 'bashlex.tokenizer.MatchedPairError'>) unexpected EOF while looking for matching '`' (position 77)]. Ignoring: 'make: Leaving directory `/c/sw_package/sources/iot/hello/src''
## Loaded compilation database with 0 entries from compile_commands.json
## Writing compilation database with 0 entries to compile_commands.json
## Done.
Seems that quote symbol before /c/sw_package
breaks everything but when I run compiledb make mingw
from command line I didn't see any Entering directory
and Leaving directory
messages at all.
Can't understand how to fix that.
Can't clang generate compile_commands.json files natively?
I have the same issue, my compile_commands.json just show: []
Same with me. I am getting compile_commands.json with only [] in Windows
I encountered the same error on MacOS 10.15. I fix this through using make | compiledb
instead of compiledb make
. See this Issue
Same issue with me too.
I am working on a huge project that generally uses a couple of different compilers to compile for different embedded platforms, all on a remote ubuntu machine.
All I wanted to do is have a compilation db to get proper autocompletion, code jumping/navigation etc.
I exported the make -Bnwk output to a build.log, copied it to my local machine and used compiledb.exe --parse build.log and it didn't work. Also tried cat build.log | compiledb.exe for each of the following cases.
I tried removing all binary characters, removing the entire path of compilers and replacing them with just gcc/clang/CC & g++/clang++/CXX, no avail.
I keep getting just [] in my compiled_commands.json
I hope there is some workaround.
I ran into this Issue working under msys on a Windows host. As a python package compiledb relies on the standard python pathname processing built-ins. These, of course, do not handle the special pathname conventions Posix shell environments like MSYS or Cygwin use to represent Windows drive-letters.
As a result joining the current working dir and the filename path captured from make does not produce a correct legal windows pathname. This causes the check that the file corresponding to the joined pathname exists to fail(unless you've specifiied -S) no entry is generated. Even if you specify -S the pathnames are mostly mangled/useless.
I've created a PR (#110) with a small patch that fixes this. Feedback from folks using cygwin etc welcome!
Same issue here. compiledb only produces a compile_commands.json
that only contains [ ]
when run in a build
folder. Interestingly when I ran it at the project's root folder it produces a compile_commands.json
file that contains an entry for the main.cpp file in there but not for .cpp files inside other folders.
Also I tried running compiledb on the same project inside WSL2 and it works perfectly.
I also have this issue. Is there any way compiledb can support MSVC? I would love to see some sort of output after trying at least 5 diffirent ways to try to generate this illusive file.
I noticed that compiledb puts in compilation database only the files which are at the root of the project, but not the files which are in subdirectories. I guess this could be because it does not handle properly windows' path separator \
?
I had the same issue. Removing the .exe after my compiler path worked for me.
You'll have to add it back in manually to the generated compile_commands.json after though.
Your makefile would become:
clang:
@echo 'clangg'
clang -IC:\tools\MinGW\i686-w64-mingw32\include hello.c -v -o hello.exe
mingw:
C:\tools\MinGW\bin\gcc -IC:\tools\MinGW\i686-w64-mingw32\include hello.c -v -o hello.exe
I have this issue building a package with a custom Makefile for EDK2.
Here it is in case it helps.
all: build
.PHONY: build
build: Application/BootLib \
FFPkg.dec \
FFPkg.dsc
cd .. && \
. ./edksetup.sh && \
build && \
cp ./Build/FFPkg/DEBUG_GCC/X64/FFPkg.efi ./Build/EmulatorX64/DEBUG_GCC5/X64/FFFinger.efi && \
echo "run" > gdb_commands && \
echo "y" >> gdb_commands && \
EmulatorPkg/build.sh run < gdb_commands && \
rm gdb_commands
I did remove the gdb run, and it still did not work. The pipe method did not work because of some custom logging not working.
Turns out the build command does not work with compiledb either
I found a great solution on StackOverflow
make clean;make VERBOSE=y all &> make_output.txt
compiledb --parse make_output.txt
https://stackoverflow.com/questions/21134120/how-to-turn-makefile-into-json-compilation-database
Hi! Have pretty simple C project containing just one source file
hello.c
:here is
Makefile
for this project:I've
compiledb
installed by:pip install compiledb
So, when I'm trying to run
compiledb make clang
: It shows me following output:But generated
compile_commands.json
contains just square brackets:[]
Same if I try to compile by
compiledb make mingw
.So is compiledb can work at Windows OS?