enigma-devel
[Top][All Lists]
Advanced

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

Re: [Enigma-devel] BUG: tolua verirrt


From: Tacvek
Subject: Re: [Enigma-devel] BUG: tolua verirrt
Date: Fri, 8 Dec 2006 11:15:46 -0500


----- Original Message ----- From: "Ronald Lamprecht" <address@hidden>
To: "Tacvek" <address@hidden>
Cc: <address@hidden>; "Sidney Markowitz" <address@hidden>
Sent: Friday, December 08, 2006 10:47 AM
Subject: Re: [Enigma-devel] BUG: tolua verirrt


Hi Tacvek,

Tacvek wrote:
make[1]: Leaving directory
`/rep/svn/public/enigma-game-trunk/lib-src'
Making all in tools
make[1]: Entering directory `/rep/svn/public/enigma-game-trunk/tools'
gcc -I../lib-src/lua -x c++  -DENABLE_ASSERT -g -DCXXLUA -g -O2
-o tolua tolua-tolua.o tolua-toluabind.o -L../lib-src/lua -
llua -lstdc++ -lxerces-c -lpng -ldl


Autoconf 2.61 with automake 1.10 does show the problem.
I've found the change between automake 1.9 and 1.10 that is responsible.

The change is definately intentional. Indeed, it was only due to a bug
in older automakes that
my code worked at all. Automake deliberately passes CFLAGS to the linker.

I think I have found a new workaround that is not likely to break.
I've attached the patch. The patch also does a little bit a unrelated
cleanup to make automake happier.

Sidney reported some problems on MacOS. His fix proposal may generate
trouble with the "dist" target. Could you try to analyse his problems:

3) On MacOS there is some difference between gcc and g++ that requires
you to link using g++ if any of the source files are in C++. This causes
the link step of the build of the tools directory to break now that LUA
is C++ because tolua.c and toluabind.c both have '.c' extensions and gcc
was being used. I have attached a patch to configure.ac and
tools/Makefile.am that when the C++ version of LUA is being used creates
an empty file tools/dummy.cc and adds that to the list tolua.c and
toluabind.c to compile and link. The result builds and runs fine on my
Intel MacBook running MacOS 10.4.8.

Hmm... Interesting. I know that on linux it is generally better to use g++ to link c++ .o files than to use gcc. For example it automatically links in the standard c++
library.

I'd be interested in knowing what other differences there are on OS X.
I am concerned about that patch causing problems.
If I recall correctly, _SOURCES is a bit special compaired to the others,
and if possible should not be conditionalized.

Is there a problem with making the dummy.cc non-conditional?
After all, a c++ linker should hapily link a bunch of c .o files.
In fact it would brobably have no net effect, as the linker would
notice that no symbols from the c++ library are actually used, and
thus omit it. Ironically, that solution would have fixed the recent problem,
without requiring the use of CPPFLAGS. It would also let us drop
the LDADD line.

I'm also curious about why this problem has not already come up.
When we made CXXLUA default on all platforms, the mac problem should
have appeared.



--------------------------------------------------------------------------------


Index: tools/Makefile.am
===================================================================
--- tools/Makefile.am (revision 510)
+++ tools/Makefile.am (working copy)
@@ -22,6 +22,7 @@
tolua_CPPFLAGS= $(CPP_FLAGS)

if CXXLUA
+tolua_SOURCES += dummy.cc
tolua_CPPFLAGS += -x c++ $(AM_CXXFLAGS) $(CXXFLAGS)
tolua_LDADD += -lstdc++
endif
Index: configure.ac
===================================================================
--- configure.ac (revision 510)
+++ configure.ac (working copy)
@@ -290,8 +290,10 @@
AS_HELP_STRING(--enable-cxxlua, Build Lua with C++ [default=yes]),,enable_cxxlua=yes)
if test "x$enable_cxxlua" = xyes; then
  CXXFLAGS="$CXXFLAGS -DCXXLUA"
+  echo > tools/dummy.cc
  AC_MSG_RESULT(yes)
else
+  rm -f tools/dummy.cc
  AC_MSG_RESULT(no)
fi








reply via email to

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