<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39414 >
The included tolua is not compatible with improvements in lua 5.1, suffers
from some bugs, pointers are identical to unsigned integers, and the code
has not been updated in a long time.
The next incarnation, called tolua++, has transitional support for both lua
5.0 and 5.1. However, it has more intractable bugs, and compilation errors,
and has not been updated in over a year.
The current incarnation, called toluaxx, requires lua 5.1. Its code has
been extensively reformatted and altered, with files inexplicably renamed.
It seems to be maintained, yet it also suffers from compilation errors,
mostly from careless failure to add new functions to its own header files.
Unfortunately, it requires an external lua 5.1 compiler package, as its
bindings file is not included in the distribution.
Over the past week, toluaxx was integrated as a separate hierarchy
corresponding to its distribution, and some of the C header files fixed.
In tolua++ and toluaxx, there are a couple of files in MSDOS line format,
while all the rest are in unix line format. Since we don't actually touch
these files, I've left them alone:
Sadly, again confirmed that it expects that pointers are identical to
tolua_event.c: In function `class_tostring_event':
tolua_event.c:632: warning: unsigned int format, pointer arg (arg 3)
p=lua_touserdata(L,1); /* get address pointer */
sprintf(b,"userdata: 0x%x",p);/* print pointer */
This interpreted bytecode data might indicate the flaw is in lua 5.1
itself, and cannot be remedied?
Moreover, I have been unable to have the makefiles find the external 5.1
header files, despite the inclusion of the location directly in the CC to
avoid the previously reported problem that the makefile wipes CPPFLAGS.
export CC="gcc -no-cpp-precomp -I/opt/local/include -L/opt/local/lib"
./autogen.sh --disable-nls --enable-client=gtk2
g++ -DHAVE_CONFIG_H -I. -I../../../.. -I../../../../dependencies/lua/include
-I. -Wall -Wpointer-arith -Wcast-align -Wmissing-prototypes
-g -O2 -Wall -Wpointer-arith -Wcast-align -Wmissing-prototypes -fsigned-char
-MT main.o -MD -MP -MF
.deps/main.Tpo -c -o main.o main.cxx
cc1plus: warning: "-Wmissing-declarations" is valid for C/ObjC but not for C++
In file included from main.cxx:15:
main.hxx:17:18: lua.hpp: No such file or directory
Why is the makefile running g++ instead of gcc? Since it wipes CPPFLAGS,
I've not found a way to pass the correct header locations.
Worse, the dependencies/lua headers are exactly the wrong ones, that I'd
hoped to supercede with the correct headers (at least until upgraded).
Meanwhile, the existence of the external lua 5.1 prevents the included lua
from compiling, as the external header files are found first for gcc.
Therefore, I give up. Somebody that actually cares and has the time can
fix these makefiles and errors and warnings. I've committed my effort
(without the configure.ac, so that the old tolua compiles instead):
toluaxx Makefile.am and some header fixing.
Committed revision 13014.
Freeciv-dev mailing list