PSA: Sublime Text AutoComplete/Navigation on Linux configuration change

100 views
Skip to first unread message

Josh Karlin

unread,
Jul 20, 2016, 7:16:35 AM7/20/16
to Chromium-dev
If you don't use Sublime Text you can stop reading.

For those of you using the SublimeClang plugin as recommended by our docs, note that there has been a small change in order to make it work with more files.

What changed? The script that determines the flags to pass to libclang now shares code with our ycm flag generator for vim.

What should you do? Edit your project config and change your sublimeclang_options_script to the following:

 "sublimeclang_options_script": "python ${project_path}/src/tools/sublime/ninja_options_script.py -d '/path/to/depot_tools'",

And don't forget to change /path/to/depot_tools to your depot_tools path!

Josh

Bartosz Fabianowski

unread,
Jul 25, 2016, 8:26:37 AM7/25/16
to jka...@chromium.org, Chromium-dev
SublimeClang has never worked for me. I updated my project per the newest instructions but I am still getting the same error:

[...]cloud_policy_client.cc:5,10 - Fatal - 'components/policy/core/common/cloud/cloud_policy_client.h' file not found
Did you configure the include path used by clang properly?

Is there a way to print out the include paths that SublimeClang is using and/or has anyone encountered this before?

Thanks,
- Bartosz
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.

Jan Krčál

unread,
Jul 25, 2016, 8:49:22 AM7/25/16
to bar...@google.com, jka...@chromium.org, Chromium-dev
Hi Bastosz,

yes, you can print it out to the python console by adding 
  "sublimeclang_debug_options": true
to the "settings" list in your project config file (Project > Edit project).

If you get any insights in how to fix it, please let me know!

Cheers,
Jan

Bartosz Fabianowski

unread,
Jul 25, 2016, 9:03:37 AM7/25/16
to Jan Krčál, jka...@chromium.org, Chromium-dev
Thanks. The debug output revealed that ${project_path} was my home directory, because this is where the project file resided. I moved it into my Chrome source directory and got one step further. It now dies with:

"[...]ninja_output.py", line 61, in GetNinjaOutputDirectory:
'Unable to find a valid ninja output directory.'

Looking at ninja_output.py, it does not seem to handle gn correctly (for gyp, the output directory is out/Release or out/Debug, for gn it is simply out).

- Bartosz

Jan Krčál

unread,
Jul 25, 2016, 9:27:52 AM7/25/16
to Bartosz Fabianowski, jka...@chromium.org, Chromium-dev
I thought the standard way for gn is "out/whatever" where whatever can be for instance "Default" or anything you like.
From a glimpse on ninja_output.py, this should work.

Jan

Bartosz Fabianowski

unread,
Jul 25, 2016, 9:46:07 AM7/25/16
to Torne (Richard Coles), jkr...@chromium.org, jka...@chromium.org, Chromium-dev
On 07/25/2016 03:43 PM, Torne (Richard Coles) wrote:
> Last I heard, you *must* use a directory that is exactly two directories
> below the src directory. I don't think it actually matters whether the
> top directory is "out" or not; I think "foo/bar" works, but "out" doesn't.
>
> ...unless someone has gone through already and fixed all the places
> where our build assumes that "../.." is the relative path between the
> build dir and source dir?

I must have missed the memo and have been using "out" ever since the
switch to gn. Nothing ever broke, except for SublimeClang. I switched to
"out/out" now and am rebuilding all my generated files to find out
whether this makes SublimeClang happy.

- Bartosz
>>> <https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sublime_dev.md#Code-Completion-with-SublimeClang-Linux-Only>,
>>> note that there has been a small change in order to make
>>> it work with more files.
>>>
>>> What changed? The script that determines the flags to
>>> pass to libclang now shares code with our ycm flag
>>> generator for vim.
>>>
>>> What should you do? Edit your project config and change
>>> your sublimeclang_options_script to the following:
>>>
>>> "sublimeclang_options_script": "python
>>> ${project_path}/src/tools/sublime/ninja_options_script.py
>>> -d '/path/to/depot_tools'",
>>>
>>> And don't forget to change /path/to/depot_tools to your
>>> depot_tools path!
>>>
>>> Josh
>>> --
>>> --
>>> Chromium Developers mailing list:
>>> <mailto:chromi...@chromium.org>chromi...@chromium.org
>>> <mailto:chromi...@chromium.org>
>>> View archives, change email options, or unsubscribe:
>>> http://groups.google.com/a/chromium.org/group/chromium-dev
>>> ---
>>> You received this message because you are subscribed to
>>> the Google Groups "Chromium-dev" group.
>>> To unsubscribe from this group and stop receiving emails
>>> from it, send an email to
>>> chromium-dev...@chromium.org
>>> <mailto:chromium-dev...@chromium.org>.
>>
>> --
>> --
>> Chromium Developers mailing list:
>> chromi...@chromium.org <mailto:chromi...@chromium.org>
>> View archives, change email options, or unsubscribe:
>> http://groups.google.com/a/chromium.org/group/chromium-dev
>>
>
> --
> --
> Chromium Developers mailing list: chromi...@chromium.org
> <mailto:chromi...@chromium.org>

Torne (Richard Coles)

unread,
Jul 25, 2016, 9:50:16 AM7/25/16
to jkr...@chromium.org, Bartosz Fabianowski, jka...@chromium.org, Chromium-dev
Last I heard, you *must* use a directory that is exactly two directories below the src directory. I don't think it actually matters whether the top directory is "out" or not; I think "foo/bar" works, but "out" doesn't.

...unless someone has gone through already and fixed all the places where our build assumes that "../.." is the relative path between the build dir and source dir?

Bartosz Fabianowski

unread,
Jul 25, 2016, 9:51:07 AM7/25/16
to Torne (Richard Coles), jkr...@chromium.org, jka...@chromium.org, Chromium-dev
Just to confirm, out/out fixed it. I can now actually enjoy
SublimeClang. Thanks everyone!

- Bartosz

Sylvain Defresne

unread,
Jul 25, 2016, 10:00:37 AM7/25/16
to Torne (Richard Coles), jkr...@chromium.org, Bartosz Fabianowski, jka...@chromium.org, Chromium-dev
I think most of the "../.." assumption have been fixed (at least on iOS we add to fix some of them due to using multiple toolchains).
-- Sylvain

James Cook

unread,
Jul 25, 2016, 5:59:56 PM7/25/16
to Sylvain Defresne, Torne (Richard Coles), jkr...@chromium.org, Bartosz Fabianowski, jka...@chromium.org, Chromium-dev
I'm having trouble with Skia paths, for example when opening ash/common/wm_window.h I get:

/w/chrome/src/third_party/skia/include/core/../private/SkFloatingPoint.h:13,10 - Fatal - 'SkTypes.h' file not found

Did you configure the include path used by clang properly?

Any ideas?

James

PS - My clang options from the debug logs, which don't seem to include skia paths:

Will compile file /w/chrome/src/ash/common/wm_window.h with the following options:
['-I/usr/local/google/home/jamescook/.config/sublime-text-3/Packages/SublimeClang/internals/clang/include', '-Wno-attributes', '-Wno-unknown-warning-option', '-x', 'c++', '-std=c++11', '-DUSE_CLANG_COMPLETER', '-std=c++11', '-x', 'c++', '-I/w/chrome/src', '-Wno-unknown-warning-option', '-DSYSTEM_NATIVE_UTF8', '-DUSE_SYMBOLIZE', '-DV8_DEPRECATION_WARNINGS', '-DENABLE_MDNS=1', '-DENABLE_NOTIFICATIONS', '-DENABLE_PEPPER_CDMS', '-DENABLE_PLUGINS=1', '-DENABLE_PDF=1', '-DENABLE_PRINTING=1', '-DENABLE_BASIC_PRINTING=1', '-DENABLE_PRINT_PREVIEW=1', '-DENABLE_SPELLCHECK=1', '-DUSE_UDEV', '-DUI_COMPOSITOR_IMAGE_TRANSPORT', '-DUSE_ASH=1', '-DUSE_AURA=1', '-DUSE_PANGO=1', '-DUSE_CAIRO=1', '-DUSE_DEFAULT_RENDER_THEME=1', '-DUSE_GLIB=1', '-DUSE_NSS_CERTS=1', '-DUSE_X11=1', '-DENABLE_WEBRTC=1', '-DDISABLE_NACL', '-DENABLE_EXTENSIONS=1', '-DENABLE_TASK_MANAGER=1', '-DENABLE_THEMES=1', '-DENABLE_CAPTIVE_PORTAL_DETECTION=1', '-DENABLE_SESSION_SERVICE=1', '-DENABLE_APP_LIST=1', '-DENABLE_SUPERVISED_USERS=1', '-DENABLE_SERVICE_DISCOVERY=1', '-DIMAGE_LOADER_EXTENSION=1', '-DENABLE_WAYLAND_SERVER=1', '-DFULL_SAFE_BROWSING', '-DSAFE_BROWSING_CSD', '-DSAFE_BROWSING_DB_LOCAL', '-DCHROMIUM_BUILD', '-DENABLE_MEDIA_ROUTER=1', '-DFIELDTRIAL_TESTING_ENABLED', '-DCR_CLANG_REVISION=274369-1', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE', '-D_LARGEFILE64_SOURCE', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', '-DCOMPONENT_BUILD', '-DOS_CHROMEOS', '-D_DEBUG', '-DDYNAMIC_ANNOTATIONS_ENABLED=1', '-DWTF_USE_DYNAMIC_ANNOTATIONS=1', '-D_GLIBCXX_DEBUG=1', '-DBASE_IMPLEMENTATION', '-I/w/chrome/src', '-I/w/chrome/src/out/Default/gen', '-I/usr/include/glib-2.0', '-I/usr/lib/x86_64-linux-gnu/glib-2.0/include', '-fno-strict-aliasing', '-funwind-tables', '-fPIC', '-fcolor-diagnostics', '-fdebug-prefix-map=/w/chrome/src=.', '-m64', '-march=x86-64', '-Wall', '-Werror', '-Wextra', '-Wno-missing-field-initializers', '-Wno-unused-parameter', '-Wno-c++11-narrowing', '-Wno-covered-switch-default', '-Wno-unneeded-internal-declaration', '-Wno-inconsistent-missing-override', '-Wno-shift-negative-value', '-Wno-undefined-var-template', '-Wno-nonportable-include-path', '-O0', '-fvisibility=hidden', '-Wheader-hygiene', '-Wstring-conversion', '-Wno-char-subscripts', '-Wexit-time-destructors', '-Wexit-time-destructors', '-fno-threadsafe-statics', '-fvisibility-inlines-hidden', '-Wno-undefined-bool-conversion', '-Wno-tautological-undefined-compare', '-std=gnu++11', '-Wno-reserved-user-defined-literal', '-fno-rtti', '-fno-exceptions']

Reply all
Reply to author
Forward
0 new messages