For Windows, there's a precompiled binary that works out of the box.But six
month ago, I wanted to release a Linux version of one of my wxLua project.wxLua
is too a tiny project to enter a well maintained package repository, so I had
to rebuild from source.It took me a whole day, from 6 to 22, without even that
much pause inbetween.While I won't doubt more clever folk could do it more
easily, for the record I felt like sharing how I eventually managed:
How to compile wxLua for Linux, as of 27/05/2017:Tested under a mostly fresh
Linux Mint 17.1 Rebecca
Get some tools:
Compiler:
sudo apt-get install gcc
sudo apt-get install g++
Source control:
sudo apt-get install git
sudo apt-get install svn
Text editor:
notepadqq is the closest clone of notepad++ (which is my favorite Windows
editor):
sudo add-apt-repository ppa:notepadqq-team/notepadqq
sudo apt-get update
sudo apt-get install notepadqq
Some diffing tool:
sudo apt-get install meld
Get the build dependencies:
To build lua:
sudo apt-get install libreadline-dev
sudo apt-get install libncurses5-dev
To build wxWidgets
sudo apt-get install libgtk2.0-dev
And maybe (but best not to even try "media"):
sudo apt-get install gstreamer1.0
sudo apt-get install libgstreamer1.0-dev
sudo apt-get install libgstreamer-plugins-base1.0-dev
Prolly not needed, but somebody mentioned them:
libgconf2-dev
libgconfmm2.6-devel
wxLua already contains source of Lua 5.1 and Lua 5.2,
but if you want to get Lua source from a more official source:
download .tar.gz from https://www.lua.org/ftp/
untargz, and: make linux
To test Lua:
cd ./src/lua
print(_VERSION) -- or whatever Lua command
os.exit() -- or plain CTRL+C
Get and build wxWidgets 3.1.0
svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-src
As of now, it's revision 78524, so, the same as:
svn checkout -r 78524 http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk
wxWidgets-src
These other source also exist but I didn't use them
svn checkout
http://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH wxWidgets-2.8
git clone https://github.com/wxWidgets/wxWidgets.git
It's best to build in a subfolder rather than in root:
cd wxWidgets-src
mkdir buildgtk
cd buildgtk
Build (well, configure) with:
../configure --with-gtk --disable-shared --enable-compat28 --enable-stc
--enable-richtext --enable-clipboard --with-libpng=builtin --with-zlib=builtin
--with-expat=builtin
To list all possible options:
../configure --help
Do not forget --enable-compat28 that is important for wxLua, or else it can't
find some function
Do not forget --with-libpng=builtin or it'll fail on newer Ubuntu that don't
ship with libpng12.so but libpng16-16.so
Do not use --enable-monolithic that cause weird issue later when linking with
wxLua (ex: https://forums.wxwidgets.org/viewtopic.php?t=33364 )
Do not use --enable-mediactrl, not only it has many dependencies (gstreamer),
but even they're all installed, there are issues at a later stage
Build (actually build) with:
sudo make install
sudo ldconfig
You can check version with:
wx-config --version
Get and build wxLua:
svn checkout https://wxlua.svn.sourceforge.net/svnroot/wxlua/trunk/wxLua
wxLua-src
As of now, it's revision 252, so, the same as:
svn checkout -r 252 https://svn.code.sf.net/p/wxlua/svn/trunk/wxLua
wxLua-src
There is also a more recent, which I didn't dare to try:
git clone https://github.com/pkulchenko/wxlua.git
Make a sym link from /modules/lua-5.1/ into /modules/lua/
cd modules
ln -s lua-5.1 lua
cd ..
Plain copy the include of lua to wxLua cause it can't find them
from /modules/lua/src/ to /modules/wxlua so:
cp modules/lua/src/*.h modules/wxlua/
In /wxLua-src/build/Makefile_wx-config.in
Remove media from line 54:
WXLIBS_NAMES = stc,gl,media,aui,xrc,qa,html,adv,core,xml,net,base
changed to:
WXLIBS_NAMES = stc,gl,aui,xrc,qa,html,adv,core,xml,net,base
Comment the first APPEXTRALIBS and modify the second to remove STC_LIB and
WXXRC_LIB:
APPEXTRALIBS := -L$(WXLIB_DIR) $(WXLIB_DIR)/lib$(WXLUA_LIB).a
$(LUA_LIBS)
Note: you can see that they are missing by using in that makefile*.in stuff like
$(info WXLIB_DIR=$(WXLIB_DIR))
$(info WXLUA_LIB=$(WXLUA_LIB))
$(info STC_LIB=$(STC_LIB))
$(info WXXRC_LIB=$(WXXRC_LIB))
$(info LUA_LIBS=$(LUA_LIBS))
Start compiling (from wxLua-src)
make -f Makefile.wx-config
If fails to finds its own libwxlua_*.a
Well, plain copy them where it looks for them:
sudo cp lib/*.a /usr/local/lib/
Retry
make -f Makefile.wx-config
It fails.
Compile wxluafreeze_app specifically, as it's all that really matters:
make -f Makefile.wx-config wxluafreeze_app
It fails to find all the .o it needs, with lots of undefined reference to
wxLuaBinding_wx*_init()
But it gives us the g++ commandline to build it!
So, modify it to point it to where they are:
cd apps/wxluafreeze/
g++ -o wxLuaFreeze *.o ../../modules/wxbind/src/*.o
../../modules/wxlua/debugger/*.o ../../modules/wxlua/debug/*.o -L/usr/local/lib
-pthread /usr/local/lib/libwx_gtk2u_stc-3.1.a
/usr/local/lib/libwx_gtk2u_gl-3.1.a /usr/local/lib/libwx_gtk2u_aui-3.1.a
/usr/local/lib/libwx_gtk2u_xrc-3.1.a /usr/local/lib/libwx_gtk2u_qa-3.1.a
/usr/local/lib/libwx_baseu_net-3.1.a /usr/local/lib/libwx_gtk2u_html-3.1.a
/usr/local/lib/libwx_gtk2u_adv-3.1.a /usr/local/lib/libwx_gtk2u_core-3.1.a
/usr/local/lib/libwx_baseu_xml-3.1.a /usr/local/lib/libwx_baseu-3.1.a
-lwxscintilla-3.1 -lGL -lGLU -pthread -lgthread-2.0 -lX11 -lXxf86vm -lSM
-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0
-lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0
-lfreetype -lpng -lexpat -lwxregexu-3.1 -lwxtiff-3.1 -lwxjpeg-3.1 -lz -ldl -lm
-ldl -Wl,--rpath -Wl,/home/bob/wxLua/wxLua-src/lib -L/usr/local/lib
/usr/local/lib/libwxlua_gtk2u_wxlua-3.1.a ../../lib/liblua.a
/usr/local/lib/libwxpng-3.1.a
Hopefully at this point you have just succesfully compiled wxLuaFreeze
Get the wxLuaFreeze from /wxLua-src/apps/wxlua
Try it alone
./wxLuaFreeze
Try it with a script:
./wxLuaFreeze KPL_vXX.wx.lua
But then when you try with a script appended at the end of wxLuaFreeze nothing
happens
To fix that, edit wxluafreeze.cpp to use some wxString::From8BitData(..) when
creating a wxString from the const char*
Also, newer Ubuntu use libpng16-16 instead of libpng12.so, so to fix that:
add --with-libpng=builtin to wxWidgets ./configure
add /usr/local/lib/libwxpng-3.1.a to the g++ compile of wxLuaFreeze
When cleaning up, please note that parts of wxWidgets and wxLua are installed
in /usr/local/lib/
which cannot be written by regular user.
To get a root explorer use something like:
sudo nemo
To verify the shared library used by an executable: ldd ./wxLuaFreeze
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users