atilaneves/cmake-ide

Converting JSON CDB ... to IDB; split-string: Wrong type argument: stringp, nil

Closed this issue · 9 comments

Hi!

I encountered a problem using cmake-ide and bear. Here I have my example project where it reproduces: https://github.com/piojanu/example-cmake-ide.
I got variables in .dir-locals.el pointing to my home directory. You will have to change this.
Then run bear make in project root dir, to produce compile_commands.json.

When I open emacs with configured rtags and cmake-ide I get this:

cmake-ide [Fri Jun 16 10:56:21 2017]: Converting JSON CDB /home/pjanusze/Documents/cmake-ide-sample/compile_commands.json to IDB
split-string: Wrong type argument: stringp, nil

Could you help me?
Thanks,
Piotr

I did such an experiment:
I written CMakeLists.txt and generated compile commands from it (and makefile). It worked.
Then I deleted it and tried bear make to generate compile commands. I got error from above.

CMake generated:

[
{
  "directory": "/home/pjanusze/Documents/example-cmake-ide/build",
  "command": "/usr/bin/c++    -I/home/pjanusze/Documents/example-cmake-ide/inc    -o CMakeFiles/example.dir/src/hellofunc.cpp.o -c /home/pjanusze/Documents/example-cmake-ide/src/hellofunc.cpp",
  "file": "/home/pjanusze/Documents/example-cmake-ide/src/hellofunc.cpp"
},
{
  "directory": "/home/pjanusze/Documents/example-cmake-ide/build",
  "command": "/usr/bin/c++    -I/home/pjanusze/Documents/example-cmake-ide/inc    -o CMakeFiles/example.dir/src/hellomain.cpp.o -c /home/pjanusze/Documents/example-cmake-ide/src/hellomain.cpp",
  "file": "/home/pjanusze/Documents/example-cmake-ide/src/hellomain.cpp"
}
]

Bear generated:

[
    {
        "arguments": [
            "c++",
            "-c",
            "-I/home/pjanusze/Documents/example-cmake-ide/inc",
            "-o",
            "CMakeFiles/example.dir/src/hellomain.cpp.o",
            "../src/hellomain.cpp"
        ],
        "directory": "/home/pjanusze/Documents/example-cmake-ide/build",
        "file": "../src/hellomain.cpp"
    },
    {
        "arguments": [
            "c++",
            "-c",
            "-I/home/pjanusze/Documents/example-cmake-ide/inc",
            "-o",
            "CMakeFiles/example.dir/src/hellofunc.cpp.o",
            "../src/hellofunc.cpp"
        ],
        "directory": "/home/pjanusze/Documents/example-cmake-ide/build",
        "file": "../src/hellofunc.cpp"
    }
]

If it isn't problem with cmake-ide, could you redirect me? Which plugin can't parse this different json?

Worth noting that irony works fine with this compile_commands.json.

I haven't had time to look at this but I guess it's because bear doesn't seem to generate a command entry.

After your hint I found this: Andersbakken/rtags#955
Strange, because I use fresh clang 3.9.1, so it should work. I guess it's not cmake-ide related (as long as it doesn't use own old clang ;)). If you agree, you can close this issue.

Sorry to say, but it must be cmake-ide related :( When I run rtags manually it works fine.

Thanks,
Piotr

According to this either of command or arguments must be present. This is news to me - and yes, it's a cmake-ide issue since it should work with either.

Now my emacs doesn't start. It just freezes and in minibuffer there is "cmake-ide: Running rc for rtags", or something like this. --debug-init doesn't catch anything. It can be, that my project is that big, that it's processing it so long? Manually everything works fine (when I run rc -J manually). Some help, how can I debug it?

You could look at the rdm buffer to see if it says anything there. I can't reproduce this, and can't see how the last change would break cmake-ide

Yea, I also can't reproduce it on smaller project. In big one it just freezes and I can't do anything. For now I use rtags mechanism for running rdm:

(add-hook 'c-mode-hook 'rtags-start-process-unless-running)
(add-hook 'c++-mode-hook 'rtags-start-process-unless-running)

and I rely on irony-mode automagically finding my compile_commands.json.

Could you explain what are cmake-ide-project-dir and cmake-ide-build-dir variables responsible for (which packages use them) and how should I set them? It isn't well explained in README.md. I just set them to where my compile_command.json is (which is also root of my project).

cmake-ide-project-dir is where the project is, i.e. the root dir of the source code. cmake-ide-build-dir is where the build happens, i.e. where compile_commands.json is.

If this is only a problem in a big project it's probably a performance issue, in which case it makes sense that it started after the fix for this issue given how I fixed it. I'll see what I can do.