Hi, I'm trying to understand how to build the wx.so lib as a standalone, to use it with a standard Lua interpreter, but i can't quite grasp what's needed to succeed. I've been trying for a few hours, to no avail. I'm using Ubuntu 9.04 x64, and have all the compilers and libs needed to compile stuff. Here's what i did: 1. I downloaded Lua 5.1 source code, libs and headers (well actually it comes from Lua Binaries). In case i wouldn't, there's a built in version with wxLua anyway. It works, and i've successfully build some C modules against it (luaglut and its examples work perfectly) 2. Since i wanted to control the wxWidgets version used, i downloaded the source (2.8.10), configured and compiled it, without installing it. It worked, but i must admit i'm not sure about the configure options i should use that could have a (positive or negative) influence on step 3., i.e. the compilation of wxLua (i'm only interested in wx.so). I've tried to compile wxWidgets with shared enabled, disabled, and with/without the monolithic option. I guess what i want is shared, and monolithic (unlesse there's a way to compile wxWidgets statically, then create a shared wx.so using it?) 3. I downloaded the wxLua source code, configured it so it would find my "system" Lua (the one i downloaded, not the Ubuntu packaged one). This works. I also configured it to find the custom compiled wxWidgets directories. This works too. The part i'm not sure about is the same as for wxWidgets, i.e. the shared option, the luamodule and monolithic-luamodule options, etc. The only way i manage to get wx.so built is by enabling the shared option. That's ok, but when i try to put the resulting lib/wx.so in my lua bin directory from step 1., then require "wx", it complains about missing "sub libs" that wx.so depends upon. I thought that "shared" was to create a wx.so, but that monolithic would make it independent from anything else. True, when i run ldd on wx.so, the missing libs are mentioned. On the other hand, a pre-compiled wx.so like the one in Lua All in One shows no such dependencies, so there must be a way... What am i doing (or getting) wrong here ? Any help would be appreciated. Thanks in advance.
On Wed, Jul 22, 2009 at 4:31 PM, "Cédric Floquet (GMail)"<ced...@gm...> wrote: > Hi, > > I'm trying to understand how to build the wx.so lib as a standalone, to > use it with a standard Lua interpreter, but i can't quite grasp what's > needed to succeed. I've been trying for a few hours, to no avail. > > I'm using Ubuntu 9.04 x64, and have all the compilers and libs needed to > compile stuff. Here's what i did: > > 1. I downloaded Lua 5.1 source code, libs and headers (well actually it > comes from Lua Binaries). In case i wouldn't, there's a built in version > with wxLua anyway. It works, and i've successfully build some C modules > against it (luaglut and its examples work perfectly) The Lua src in wxLua/modules/lua/src is the source from the Lua 5.1.4 tar.gz. > 2. Since i wanted to control the wxWidgets version used, i downloaded > the source (2.8.10), configured and compiled it, without installing it. > It worked, but i must admit i'm not sure about the configure options i > should use that could have a (positive or negative) influence on step This is what I use for wxWidgets, for better or for worse. ../configure \ --prefix=/home/john/wx/wxWidgets/wxWidgets-2.8.10/config_gtk2ud \ --enable-optimise=no \ --enable-debug=yes \ --enable-debug_gdb=yes \ --enable-mem_tracing=no \ --enable-profile=no \ --with-dmalloc=no \ --enable-prologio=no \ --enable-gtk2=yes \ --enable-unicode=yes \ --with-gnomeprint \ --enable-mediactrl=yes \ --with-opengl \ --enable-graphics_ctx \ --with-sdl > 3., i.e. the compilation of wxLua (i'm only interested in wx.so). I've > tried to compile wxWidgets with shared enabled, disabled, and > with/without the monolithic option. I guess what i want is shared, and > monolithic (unlesse there's a way to compile wxWidgets statically, then > create a shared wx.so using it?) This should handle creating the monolithic wx.so module regardless of the other settings, I think. configure --enable-monolithic-luamodule > 3. I downloaded the wxLua source code, configured it so it would find my > "system" Lua (the one i downloaded, not the Ubuntu packaged one). This > works. I also configured it to find the custom compiled wxWidgets > directories. This works too. The part i'm not sure about is the same as > for wxWidgets, i.e. the shared option, the luamodule and > monolithic-luamodule options, etc. The only way i manage to get wx.so > built is by enabling the shared option. That's ok, but when i try to put > the resulting lib/wx.so in my lua bin directory from step 1., then > require "wx", it complains about missing "sub libs" that wx.so depends > upon. I thought that "shared" was to create a wx.so, but that monolithic > would make it independent from anything else. I'll have to look into how "monolithic" we can actually make it. You absolutely have to link to the Lua shared lib, but it might be possible to compile wxWidgets statically to allow the wxLua module to incorporate the wxWidgets libraries. If you compile wxWidgets as a shared lib, then no, it cannot be incorporated into wx.so and will be a dependence. I did find a bug in the configure generated modules/Makefile. Look for these statements and notice that I removed the $(WXLUA_LIBS) from it. The real fix goes into the Bakefiles, but I have to verify that it's Ok to do that for the MSW builds. ../lib/$(DLLPREFIX_MODULE)wx.$(SO_SUFFIX_MODULE): $(MOD_LUAMODULE_MONO_OBJECTS) $(SHARED_LD_MODULE_CXX) $@ $(MOD_LUAMODULE_MONO_OBJECTS) $(LDFLAGS) -L$(top_builddir)/lib -L$(LUA_LIB_DIR) $(LIBS) $(WX_LIBS) #$(WXLUA_LIBS) <-- remove this from the line above > True, when i run ldd on wx.so, the missing libs are mentioned. On the > other hand, a pre-compiled wx.so like the one in Lua All in One shows no > such dependencies, so there must be a way... What libs are missing for you (see below) and I wonder what the All in One folks are doing? > What am i doing (or getting) wrong here ? If you have unresolved lib dependencies, as seen using ldd, you can add search paths like this. $export LD_LIBRARY_PATH=/path/to/the/wxLua/libs Hope this helps, John
2009年7月23日 John Labenski <jla...@gm...> > On Wed, Jul 22, 2009 at 4:31 PM, "Cédric Floquet > (GMail)"<ced...@gm...> wrote: > > > The Lua src in wxLua/modules/lua/src is the source from the Lua 5.1.4 > tar.gz. Ok, then, it's the latest version. > > 2. Since i wanted to control the wxWidgets version used, i downloaded > > the source (2.8.10), configured and compiled it, without installing it. > > It worked, but i must admit i'm not sure about the configure options i > > should use that could have a (positive or negative) influence on step > > This is what I use for wxWidgets, for better or for worse. > > ... > > This should handle creating the monolithic wx.so module regardless of > the other settings, I think. > configure --enable-monolithic-luamodule Here are the configure options I used: wxWidgets (GTK): --enable-shared \ --enable-monolithic \ --enable-unicode wxLua: --enable-monolithic-luamodule \ --enable-unicode \ --enable-shared \ --with-wxdir=../../wxGTK-2.8.10/ced_build \ --enable-systemlua=yes \ --with-lua-prefix=/home/cedric/src/lua/lua_bin \ LIBS=-ldl The LIBS part is mandatory on Ubuntu 9.04, otherwise there are unresolved symbols dlsym, dlopen, ... when compiling an "external" vanilla Lua. > > > 3. I downloaded the wxLua source code, configured it so it would find my > > "system" Lua (the one i downloaded, not the Ubuntu packaged one). This > > works. I also configured it to find the custom compiled wxWidgets > > directories. This works too. The part i'm not sure about is the same as > > for wxWidgets, i.e. the shared option, the luamodule and > > monolithic-luamodule options, etc. The only way i manage to get wx.so > > built is by enabling the shared option. That's ok, but when i try to put > > the resulting lib/wx.so in my lua bin directory from step 1., then > > require "wx", it complains about missing "sub libs" that wx.so depends > > upon. I thought that "shared" was to create a wx.so, but that monolithic > > would make it independent from anything else. > > I'll have to look into how "monolithic" we can actually make it. You > absolutely have to link to the Lua shared lib, but it might be > possible to compile wxWidgets statically to allow the wxLua module to > incorporate the wxWidgets libraries. If you compile wxWidgets as a > shared lib, then no, it cannot be incorporated into wx.so and will be > a dependence. Well, the lua lib is only one file, and I include it in my archive (or it could be present on the user system if he has Lua 5.1.4 installed), so this should not be a problem. As for wxWidgets, if I compile it statically, then I can't use "shared" when compiling wxLua, which in turn means no wx.so is created. But maybe I'm missing something. > > I did find a bug in the configure generated modules/Makefile. > > Look for these statements and notice that I removed the $(WXLUA_LIBS) > from it. The real fix goes into the Bakefiles, but I have to verify > that it's Ok to do that for the MSW builds. > > ../lib/$(DLLPREFIX_MODULE)wx.$(SO_SUFFIX_MODULE): > $(MOD_LUAMODULE_MONO_OBJECTS) > $(SHARED_LD_MODULE_CXX) $@ $(MOD_LUAMODULE_MONO_OBJECTS) $(LDFLAGS) > -L$(top_builddir)/lib -L$(LUA_LIB_DIR) $(LIBS) $(WX_LIBS) > #$(WXLUA_LIBS) <-- remove this from the line above Ok, i'll try that next, then answer back. > > > > True, when i run ldd on wx.so, the missing libs are mentioned. On the > > other hand, a pre-compiled wx.so like the one in Lua All in One shows no > > such dependencies, so there must be a way... > > What libs are missing for you (see below) and I wonder what the All in > One folks are doing? These ones are missing: libwxlua_gtk2u_wxbindxrc-2.8.so.0 => not found libwxlua_gtk2u_wxbindrichtext-2.8.so.0 => not found libwxlua_gtk2u_wxbindhtml-2.8.so.0 => not found libwxlua_gtk2u_wxbindaui-2.8.so.0 => not found libwxlua_gtk2u_wxbindadv-2.8.so.0 => not found libwxlua_gtk2u_wxbindxml-2.8.so.0 => not found libwxlua_gtk2u_wxbindnet-2.8.so.0 => not found libwxlua_gtk2u_wxbindcore-2.8.so.0 => not found libwxlua_gtk2u_wxbindbase-2.8.so.0 => not found libwxlua_gtk2u_wxluasocket-2.8.so.0 => not found libwxlua_gtk2u_wxluadebug-2.8.so.0 => not found libwxlua_gtk2u_wxlua-2.8.so.0 => not found These are the ones that can be found in the /lib dir of wxLua after the compilation, along with the wx.so file, so it makes sense in a way. I don't know what the Lua AIO folks are doing... Maybe they "join" libs together in one file ? (don't know if that is possible) > > If you have unresolved lib dependencies, as seen using ldd, you can > add search paths like this. > $export LD_LIBRARY_PATH=/path/to/the/wxLua/libs Yes, when I define this variable, the missing libs are found. The thing is, I'd like to package only one lib file (wx.so) instead of many (with very long and cryptic names). > > > Hope this helps, > John Thanks for your answer. Cédric
Hi, Cédric Floquet wrote: > > [snip] > > > True, when i run ldd on wx.so, the missing libs are mentioned. On the > > other hand, a pre-compiled wx.so like the one in Lua All in One > shows no > > such dependencies, so there must be a way... > I managed to compile wx & wxLua in one-monolithic-module (.so/.dll) with using Code::Blocks project file. It is used in CairoPad and BookWorm applications. You may look sources of them here: http://www.dynaset.org/dogusanh/ -- Regards, Hakki Dogusan
On Thu, Jul 23, 2009 at 3:54 AM, Hakki Dogusan<dog...@tr...> wrote: > Hi, > > Cédric Floquet wrote: >> >> [snip] >> >> > True, when i run ldd on wx.so, the missing libs are mentioned. On the >> > other hand, a pre-compiled wx.so like the one in Lua All in One >> shows no >> > such dependencies, so there must be a way... >> > > I managed to compile wx & wxLua in one-monolithic-module (.so/.dll) with > using Code::Blocks project file. It is used in CairoPad and BookWorm > applications. You may look sources of them here: > > http://www.dynaset.org/dogusanh/ > > > -- > Regards, > Hakki Dogusan > > > ------------------------------------------------------------------------------ > _______________________________________________ > wxlua-users mailing list > wxl...@li... > https://lists.sourceforge.net/lists/listinfo/wxlua-users > I would vote for a single wx.so build, out of the default configure. This would be simply great. This is the way that most Lua modules are used/built anyways. Can't wait for a solution. -- Regards, Ryan