Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] GCCPathToolChainProvider problem

ok, never mind. I found this same problem already reported as issue #503153. I have appended my findings and a proposed fix.


Zitat von c.sell@xxxxxxxxxxxxxxx:


I just started testing the CDT master branch and in particular, the CMake tooling. However, when trying to create a CMake project, the first thing I see is a NullpointerException.

After investigating a while, I came to the GCCPathToolChainProvider class as the root of this evil. In function

public void init(IToolChainManager manager)

(, 43) it iterates over the contents of the /usr/bin directory and matches every file against a pattern which is supposed to identify the compiler driver program. That pattern contains the "gcc" string. It then creates a GCCToolChain for that, using the prefix pulled from the pattern. GCCToolChain, in turn, makes the assumption that both a "gcc" and a "g++" variant exist (, 395, 400).

Now, on my Ubuntu 14.0.4 / GCC 4.9.4 machine, /usr/bin has these gcc drivers:



the algorithm described above therefore yields GCCToolChain instances that hold invalid commands for the GPP language (g++), namely c89-g++. Now, when creating a new CMake project, GCCToolChain#getDefaultScannerInfo is called and runs onto said NullPointerException on line 254, because the return value from getCommandPath(command) is null, which is due to the fact that the compile command for the given language (GPP) is invalid. Quite frustrating for a first-time experience.

I think that creating a GCCToolChain without checking for the presence of ALL required files is the root error, and should be avoided. Not checking for a null return in getDefaultScannerInfo is a minor issue.

Can somebody comment on this? Should I go ahead and create a bug report?


cdt-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top