[libvoikko] Namespace collisions in HFST and Lttoolbox

Francis Tyers ftyers at prompsit.com
Fri Mar 12 18:31:28 EET 2010


I'm CC'ing this to apertium-stuff.

Changing class names is quite a big change, so there is a chance it
won't get into Debian for a while. 

I'm not sure if the more sensible thing is to change the names e.g. to
LtNode/LtAlphabet etc. or introduce a namespace.

Fran

El dv 12 de 03 de 2010 a les 19:28 +0200, en/na Harri Pitkänen va
escriure:
> I was trying to build libvoikko with --enable-hfst --enable-lttoolbox and ran 
> into multiple problems related to namespace collisions from these packages.
> 
> First there is a problem specific to HFST only: When configured using pkg-
> config, -I/include/hfst2 is added to CFLAGS. This breaks things because this 
> directory contains file "string.h" which now gets included in place of the 
> standard C header with the same name. I suppose that the HFST file should be 
> included as <hfst2/string.h> and adding the directory to include path is 
> unnecessary. The small patch at the end of this message fixes the problem.
> 
> Another problem is that both HFST and Lttoolbox introduce some classes in the 
> default namespace. Since the libraries serve similar purposes it is not a 
> surprise that some of the classes have exactly same names. Here are some 
> examples, there might be others too:
> 
> /usr/include/lttoolbox-3.1/lttoolbox/alphabet.h:35: error: redefinition of 
> ‘class Alphabet’
> /home/harri/apps/include/hfst2/sfst/alphabet.h:220: error: previous definition 
> of ‘class Alphabet’
> 
> /usr/include/lttoolbox-3.1/lttoolbox/node.h:107: error: redefinition of ‘class 
> Node’
> /home/harri/apps/include/hfst2/sfst/fst.h:375: error: previous definition of 
> ‘class Node’
> 
> /usr/include/lttoolbox-3.1/lttoolbox/state.h:36: error: redefinition of ‘union 
> State’
> /home/harri/apps/include/hfst2/hfst.h:12: error: previous definition of ‘union 
> State’
> 
> For now it is not possible to enable both HFST and Lttoolbox backends 
> simultaneously in libvoikko due to these collisions.
> 
> I have CCd hfst-bugs but have not yet reported this to Apertium bug tracker. 
> I'll do that later unless someone here wants to take care of this issue for 
> me.
> 
> Harri
> 
> 
> Index: hfst/hfst.pc.in
> ===================================================================
> --- hfst/hfst.pc.in     (revision 275)
> +++ hfst/hfst.pc.in     (working copy)
> @@ -7,4 +7,4 @@
>  Description: Finite-state transducer library bridge for multiple FLOSS 
> packages
>  Version: @LIBHFST_VERSION@
>  Libs: -L${libdir} -l at LIBHFST_NAME@ @LIBS@
> -Cflags: -I${includedir}/@LIBHFST_NAME@@LIBHFST_MAJOR@
> +Cflags: -I${includedir}
> _______________________________________________
> Libvoikko mailing list
> Libvoikko at lists.puimula.org
> http://lists.puimula.org/listinfo/libvoikko





More information about the Libvoikko mailing list