在 2011-一月-13 23:13:08 星期四 时,
https://www.google.com/accounts/o8
/id?id=AItOawmUIkXo-GQLxdvXtES8-x59mIITsOeE7kw 写到:
Show quoted text> I was very happy today to find an implementation of interval trees in
> Perl. It sped up my program considerably. I was able to get it to
> install fine with cpan on Ubuntu 10.10, but I have not been able to get
> it the installation to work on Red Hat 5.4 (perl 5.12.2) or Mac OS
> 10.6.6 (perl 5.10.0). It creates tons of error messages when it tries to
> compile (I have attached). I would like to use this package in some
> software I am going to distribute, but it's not good if it will only
> compile on less than half of the user's machines.
>
> Do you know what may be causing the compiler errors? Are there any
> workarounds that I might be able to share in my software package?
>
> Thanks!
I find those bugs!
1. There is a clash of perl symbols do_close(Perl_do_close) and do_open
(Perl_do_open) in perl source's doio.c with c++ library.
Add these two lines in IntervalTree.xs:
#define do_open Perl_do_open
#define do_close Perl_do_close
See also:
http://www.nntp.perl.org/group/perl.xs/2008/09/msg2494.html
2. It seems that old (not too old) version g++ can not handle this kind
of syntax in interval_tree.h:
line 95: std::vector<IntervalTree<T,N>::it_recursion_node>
line 135: root = new IntervalTree<T,N>::Node();
and many other place like line 135.
I don't know how to describe this syntax. I checked template usage on
the web and didn't find code written like that. So I guess it does not
need to use full namespace to reference a member in a class. After
getting rid of those strings 'IntervalTree<T,N>::' in lines reported in
the compile error output, I can make successfully.