Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Breaking Bug: No indexed files when creating project from compilation database #366

Closed
jpenalbae opened this issue Apr 14, 2017 · 8 comments
Assignees
Labels

Comments

@jpenalbae
Copy link

Description

Sourcetrail is not able to create new projects using a compilation database, indexing 0 files.

It also happens when opening old projects, sourcetrail will try to re-index them, but 0 files will get indexed.

This is a breaking bug, as it renders sourcetrail unusable...

Also tried starting with a fresh installation by removing any previous config files from ~/.config/coati/ and ~/.config/sourcetrail/ without any luck.

Environment

Sourcetrail: Sourcetrail_0_11_86_Linux_64bit
Distro: Debian unstable

How to reproduce:

We can reproduce this by indexing the linux kernel

$ wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.10.10.tar.xz
$ tar Jxvf linux-4.10.10.tar.xz
$ cd linux-4.10.10/
$ make defconfig
$ bear make -j12 bzImage

This will generate a compile_commands.json file, which we will load into sourcetrail. The generated compilation database is attached: compile_commands.json.zip

  • Create a new project
  • C -> C/C++ from Compilation Database
  • Select the generated compile_commands.json as compilation database
    • Sourcetrail will display message: 2215 source files were found in the compilation database
  • Do not add any indexed header paths or add some, it doesn't really make any difference.
  • Finish project creation
    • Sourcetrail will display "Start indexing" "Index: 0 Files"
  • Press start button to start indexing.
  • Nothing gets indexed....

This used to work perfectly, but it does not work any more, rendering sourcetrail totally useless to me....

project

start-indexing

start-indexing2

@egraether
Copy link
Contributor

@jpenalbae Thank you for reporting and providing all this information! We think we could figure out the origin of the problem.

Our current release accidentally saves C++ specific source extensions and standard information to the project file for all created compilation database projects. To fix this please open the .srctrlprj file in a text editor and remove these tags:

...
            <source_extensions>
                <source_extension>.cpp</source_extension>
                <source_extension>.cxx</source_extension>
                <source_extension>.cc</source_extension>
            </source_extensions>
            <standard>c++1z</standard>
...

Then the project should work as it used to and index all files from the compilation database. Can you please try this and let us know if it works?

@egraether egraether added the bug label Apr 14, 2017
@jpenalbae
Copy link
Author

jpenalbae commented Apr 14, 2017

Replacing source_extensions with the following seems to start the indexing process:

            <source_extensions>
                <source_extension>.c</source_extension>
            </source_extensions>

Anyway, I'm getting thousands of errors per file while indexing, so I guess I should stick to an older version for now....

@egraether
Copy link
Contributor

@jpenalbae Did you try removing the whole source_extensions tag and the standard tag?

@egraether
Copy link
Contributor

@jpenalbae What kind of errors do you get? Missing Includes? Unknown Types?

@jpenalbae
Copy link
Author

Unknown types mostly iirc....

Just removing the hole <source_extensions> block does not index anything. Yes I also did remove the standard tag, and tried using c and gnu99 for it.

Anyway, do not worry about it, I just rolled back to 0.11.15. Having to edit the project file by hand and reloading it, is not an option for me. I will try again on the next version once this gets fixed.

@egraether
Copy link
Contributor

Fixed saving of C++ specific source extensions and standard information for new Compilation Database projects with 0.11.89

I have no idea yet why this issue would cause any new errors.

@jpenalbae
Copy link
Author

New errors might be my fault while editing the project file, dunno... I will check it once 0.11.89 is released.

Btw, thanks for the quick fix 👍

@egraether egraether self-assigned this May 5, 2017
@jpenalbae
Copy link
Author

Seems to be working fine again under 0.12 (beta)

Thanks!!!

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

No branches or pull requests

2 participants