help-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can Global reference files by absolute path?


From: Raffaele Ricciardi
Subject: Can Global reference files by absolute path?
Date: Fri, 10 Jul 2015 15:49:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1

Hello,

I am trying to use Global to lookup tags for each C library that a
project may use, by using GTAGSLIBPATH.  The caveat is that I would like
to generate Global files out of source, while discriminating libraries
that may share their directory (this is what happens in */usr/include/*).

So far, I have generated Global files successfully, but `global' doesn't
reference the original files correctly.  For instance, for the standard
C library, this is what happens when I run `global' from the directory
of a project:

    $ global -xs printf
    Warning: source file './stdio.h' is not available.
    printf            362 stdio.h
    ...

That is: `global' expects to find library files in the directory of the
project, instead of their own directory.  In this case, I would have
expected *stdio.h* to be referenced as */usr/include/stdio.h* instead.

I am going to describe what I have done.  I am using Global 6.5
(compiled with Exuberant Ctags 5.8) and the last version of Pygments.

First, I have created a directory to cache the Global files for the
standard C library:

    $ mkdir --parents ~/.cache/gtags/standard-c
    $ cd ~/.cache/gtags/standard-c

In this directory, I have generated a file with the list of headers that
`gtags' will parse:

    $ find /usr/include/*.h -type f > gtags.file
    $ cat gtags.file
    /usr/include/aio.h
    ...

Now, I would have expected `gtags' to be able to process `gtags.file'
from here, because it contains absolute paths, but `gtags' warns that it
is ignoring all those files because they are "out of source tree".
Apparently, I must move to the directory that contains those files
beforehand (indeed, this is the approach followed by the Tutorial).
Therefore:

    $ pushd /usr/include/
    /usr/include ~/.cache/gtags/standard-c
$ gtags -c -f ~/.cache/gtags/standard-c/gtags.file ~/.cache/gtags/standard-c
    $ popd

Let's check that `gtags' has worked:

    $ ls
    GPATH  GRTAGS  GTAGS  gtags.file

OK.  Let's lookup a symbol:

    $ global -xs printf
    Warning: source file './stdio.h' is not available.
    printf            362 stdio.h
    ...

Why *./stdio.h* instead of */usr/include/stdio.h*?  Thank you.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]