Compiling GNU Global with universal-ctags support

2k views Asked by At

I'm trying without success to build GNU Global with universal-ctags support. Is there something that I'm missing out on, or maybe I'm using incompatible versions of GNU Global and univeral-ctags? I'm doing this on Ubuntu 18.04.2 LTS (also tested on Ubuntu 16.04)

Official installation instructions

Other related information

In short I perform the following commands.

git clone https://github.com/universal-ctags/ctags.git
cd ctags
cat docs/autotools.rst  # installation instructions

./autogen
./configure
make
make install

which ctags
# /usr/local/bin/ctags

ctags --version
# Universal Ctags 0.0.0(6365358b), Copyright (C) 2015 Universal Ctags Team
# Universal Ctags is derived from Exuberant Ctags.
# Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
#   Compiled: Mar  8 2019, 12:48:27
#   URL: https://ctags.io/
#   Optional compiled features: +wildcards, +regex, +iconv, +option-directory, +packcc

This seems to work fine and the ctags executable builds tags files as expected. Next I try to install GNU Global using the instructions from Section 4.2 of the GNU Global manual (link above).

wget http://tamacom.com/global/global-6.6.3.tar.gz
tar -xzvf global-6.6.3.tar.gz
cd global-6.6.3

./configure --with-universal-ctags=/usr/local/bin/ctags
make
sudo make install

export GTAGSCONF=/usr/local/share/gtags/gtags.conf
export GTAGSLABEL=new-ctags
gtags
# ctags: Warning: Unknown language "Ada:.adb.ads.Ada,Ant:(build.xml)(*.build.xml).ant.xml,Asm:.A51(*.29[kK])(*.[68][68][kKsSxX])(*.[xX][68][68]).asm.ASM.s.S,Asp:.asp.asa,Autoconf:(configure.in).ac,Automake:(Makefile.am).am,Awk:.awk.gawk.mawk,Basic:.bas.bi.bb.pb,BETA:.bet,Clojure:.clj.cljs.cljc,C:.c,C++:.c++.cc.cp.cpp.cxx.h.h++.hh.hp.hpp.hxx.inl,CSS:.css,C#:.cs,ctags:.ctags,Cobol:.cbl.cob.CBL.COB,CUDA:.cu.cuh,D:.d.di,Diff:.diff.patch,DTD:.dtd.mod,DTS:.dts.dtsi,DosBatch:.bat.cmd,Eiffel:.e,elm:.elm,Erlang:.erl.ERL.hrl.HRL,Falcon:.fal.ftd,Flex:.as.mxml,Fortran:.f.for.ftn.f77.f90.f95.f03.f08.f15,gdbinit:(.gdbinit).gdb,Go:.go,HTML:.htm.html,Iniconf:.ini.conf,ITcl:.itcl,Java:.java,JavaProperties:.properties,JavaScript:.js.jsx,JSON:.json,LdScript:(*.lds.S)(ld.*).lds.scr.ld,Lisp:.cl.clisp.el.l.lisp.lsp,Lua:.lua,M4:.m4.spt,man:.1.2.3.4.5.6.7.8.9,Make:([Mm]akefile)(GNUmakefile).mak.mk,MatLab:.m,Myrddin:.myr,ObjectiveC:.mm,OCaml:.ml.mli.aug,passwd:(passwd),Pascal:.p.pas,Perl:.pl.pm.ph.plx.perl,Perl6:.p6.pm6.pl6,PHP:.php.php3.php4.php5.php7.phtml,pod:.pod,Protobuf:.proto,puppetManifest:.pp,Python:.py.pyx.pxd.pxi.scons,QemuHX:.hx,R:.r.R.q,REXX:.rexx.rx,Robot:.robot,RpmSpec:.spec,reStructuredText:.rest.reST.rst,Ruby:.rb.ruby,Rust:.rs,Scheme:.SCM.SM.sch.scheme.scm.sm,Sh:.sh.SH.bsh.bash.ksh.zsh.ash,SLang:.sl,SML:.sml.sig,SQL:.sql,SystemdUnit:.unit.service.socket.device.mount.automount.swap.target.path.timer.snapshot.scope.slice.time,Tcl:.tcl.tk.wish.exp,Tex:.tex,TTCN:.ttcn.ttcn3,Vera:.vr.vri.vrh,Verilog:.v,SystemVerilog:.sv.svh.svi,VHDL:.vhdl.vhd,Vim:(vimrc)([._]vimrc)(gvimrc)([._]gvimrc).vim.vba,WindRes:.rc,YACC:.y,YumRepo:.repo,Zephir:.zep,Glade:.glade,Maven2:(pom.xml).pom,PlistXML:.plist,RelaxNG:.rng,SVG:.svg,XSLT:.xsl.xslt" in "langmap" option
2

There are 2 answers

1
bgoodr On BEST ANSWER

I don't know why that is, but it happened to me as well. I found a workaround that I cannot explain (user error? bug?), by removing these lines from the gtags.conf file (in the one for universal-ctags|setting to use Universal Ctags plug-in parser part):

:langmap=Glade\:.glade:\
:langmap=Maven2\:(pom.xml).pom.xml:\
:langmap=PlistXML\:.plist:\
:langmap=RelaxNG\:.rng:\
:langmap=SVG\:.svg:\
:langmap=XSLT\:.xsl.xslt:\

My guess is that this particular version of GNU Global is using more, or different, languages than what this particular version of Universal Ctags currently supports.

Versions I am using are built from downloaded code yesterday and the versions I'm seeing are:

$ ctags --version
Universal Ctags 0.0.0(6ad4e95), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Aug 20 2019, 18:04:40
  URL: https://ctags.io/
  Optional compiled features: +wildcards, +regex, +iconv, +option-directory, +packcc
$ gtags --version
gtags (GNU GLOBAL) 6.6.3
Powered by Berkeley DB 1.85.
Copyright (c) 1996-2018 Tama Communications Corporation
License GPLv3+: GNU GPL version 3 or later <http://www.gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
0
Alex J. On

I had a similar issue. The problem turned out to be with my version of universal tags (ctags). When it was built, the build process was not able to find libxml2-0 (*.pc and or header files, such as libxml/xpath.h). As a result, some XML-related parsers were disabled out of the build. Those parsers are defined in source.mak :

XML_SRCS = \
    parsers/maven2.c        \
    parsers/dbusintrospect.c    \
    parsers/glade.c         \
    parsers/svg.c           \
    parsers/plist.c         \
    parsers/relaxng.c       \
    parsers/xml.c           \
    parsers/xslt.c          \

Now, when GNU global generated the command line for ctags, it did it as if all the parsers were available. Naturally, ctags did not understand some of them and complained.

If possible, try getting/building a new version of universal tags with XML parsers enabled, then use that with GNU global. If not possible, you need to remove the parsers that your version of ctags does not understand from the command line - essentially what bgoodr suggested in his answer.