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

Problem on JSON compilation database parsing #520

Open
av0r opened this issue Jan 25, 2019 · 1 comment
Open

Problem on JSON compilation database parsing #520

av0r opened this issue Jan 25, 2019 · 1 comment

Comments

@av0r
Copy link

av0r commented Jan 25, 2019

Hello!
I created simple project to illustrate the problem:

.
├── meson.build
└── src
    ├── hello.c
    ├── include
    │   └── hello.h
    └── main.c

after that I run 'meson build' and 'ninja-build -C build' and get

.
├── build
│   ├── build.ninja
│   ├── compile_commands.json
│   ├── hello_world
│   ├── hello_world@exe
│   │   ├── src_hello.c.o
│   │   └── src_main.c.o
│   ├── meson-logs
│   │   └── meson-log.txt
│   └── meson-private
│       ├── build.dat
│       ├── coredata.dat
│       ├── install.dat
│       ├── meson_benchmark_setup.dat
│       ├── meson.lock
│       ├── meson_test_setup.dat
│       ├── sanitycheckc.c
│       └── sanitycheckc.exe
├── meson.build
└── src
    ├── hello.c
    ├── include
    │   └── hello.h
    └── main.c

but when I start emacs with irony for some file in project I get:

In ".":
error opening 'hello_world@exe/src_hello.c.o.d': No such file or directory

and such file appears:

.
├── build
│   ├── build.ninja
│   ├── compile_commands.json
│   ├── hello_world
│   ├── hello_world@exe
│   │   ├── src_hello.c.o
│   │   ├── src_hello.c.o.d
│   │   └── src_main.c.o
│   ├── meson-logs
│   │   └── meson-log.txt
│   └── meson-private
│       ├── build.dat
│       ├── coredata.dat
│       ├── install.dat
│       ├── meson_benchmark_setup.dat
│       ├── meson.lock
│       ├── meson_test_setup.dat
│       ├── sanitycheckc.c
│       └── sanitycheckc.exe
├── meson.build
└── src
    ├── hello.c
    ├── include
    │   └── hello.h
    └── main.c

but it contains only:
hello_world@exe/src_hello.c.o:
And completion doesn't work.
compilation_database.json:

[
  {
    "directory": "/home/andrei/programming/hello_world/build",
    "command": "cc -Ihello_world@exe -I. -I.. -I../src/include -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O0 -g  -MD -MQ 'hello_world@exe/src_main.c.o' -MF 'hello_world@exe/src_main.c.o.d' -o 'hello_world@exe/src_main.c.o' -c ../src/main.c",
    "file": "../src/main.c"
  },
  {
    "directory": "/home/andrei/programming/hello_world/build",
    "command": "cc -Ihello_world@exe -I. -I.. -I../src/include -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O0 -g  -MD -MQ 'hello_world@exe/src_hello.c.o' -MF 'hello_world@exe/src_hello.c.o.d' -o 'hello_world@exe/src_hello.c.o' -c ../src/hello.c",
    "file": "../src/hello.c"
  }
]

@Sarcasm
Copy link
Owner

Sarcasm commented Jan 25, 2019

I think the issue comes from the -M options that should be stripped.
CMake does not put them in the generated compilation database for example.

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

No branches or pull requests

2 participants