Hello, I cross-compile Wt 3.3.1, Windows binaries on Debian Wheezy (Linux):
# install requirements: http://mxe.cc/#requirements-debian $ git clone https://github.com/mxe/mxe.git $ cd mxe $ make wt Best regards, Boris Nagaev On Sun, Dec 7, 2014 at 5:19 PM, K. Frank <kfrank2...@gmail.com> wrote: > Hello List! > > I have been successful building Wt 3.3.3 with mingw-w64 > gcc 4.9.2. At this point I have successfully built and > run the "hello" example. > > (This is something of a follow-up to an earlier posting > of mine where I asked whether Wt was likely to build > smoothly with mingw-w64.) > > I built and ran Wt natively on 64-bit windows 7. The > build went reasonably smoothly, but I did hit some issues > along the way, so I will take this opportunity to record > the process and what I had to do to work though things. > > I worked on this on and off for the past couple of weeks, > so these notes are relevant to the time period of the last > two weeks of November 2014. I generally worked with the > latest stable versions of the various components. In general > I followed the "standard" instructions for building the > various pieces, although these instructions were not always > complete nor in a centralized location. > > Download latest mingw-w64. I used the mingw-builds version. > The mingw-builds installer didn't work for some reason, so > I downloaded the ".7z" archive. I downloaded: > > x86_64-4.9.2-release-posix-seh-rt_v3-rev0.7z > > from: > > > http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.2/threads-posix/seh/ > > unzipped it and set up my path (and CPLUS_INCLUDE_PATH and > LIBRARY_PATH) to point to the 4.9.2 installation. > > Download and build boost. > > (Note: I hope that Wt gets A LOT of USEFUL functionality > from boost because boost is, at best, and UNWIELDY piece > of dependency BLOAT. I spent more time monkeying around > with boost than I did with Wt.) > > First boost-build: > boost-build-2014-10.zip > from: > http://www.boost.org/doc/libs/1_57_0/tools/build/index.html > > In boost-build (the root directory of the unzipped > boost-build-2014-10.zip archive) I ran bootstrap.bat: > > ...\boost-build>bootstrap mingw > > Note, I first tried to run bootstrap.bat without gcc in > my path, and I got an unhelpful error: > > ****** B A T C H R E C U R S I O N exceeds STACK limits ****** > > but adding gcc to my path and re-running resolved the problem. > > Then I built boost-build: > > .\b2 --prefix=..\build_dir install > > Now I "configure" b2 to use mingw / gcc by adding: > using gcc ; > to: > ...\build_dir\share\boost-build\src\kernel\user-config.jam > > Next boost itself: > boost_1_57_0.zip > from: > http://sourceforge.net/projects/boost/files/boost/1.57.0/ > > In boost_1_57_0 (the root directory of the unzipped > boost_1_57_0.zip archive) I ran: > > ...\b2.exe --build-dir=..\build_boost toolset=gcc --build-type=complete > stage > > There were a number of warnings and some "errors," but > most stuff built: > ...failed updating 24 targets... > ...skipped 56 targets... > ...updated 5409 targets... > > At least some of the failures are presumably due to missing > optional dependencies. I don't know if any of the "errors" > or "failed" targets represent real or serious errors or not. > (I didn't investigate.) Anyway, this build of boost, even > with the errors, was good enough to build Wt and the hello > example. The build took about four hours. > > Download and build Wt. > > Download cmake: > cmake-3.0.2-win32-x86.zip > from: > http://www.cmake.org/download/ > > Download Wt: > wt-3.3.3.tar.gz > from: > http://sourceforge.net/projects/witty/files/wt/3.3.3/ > > The build / install procedure for Wt was to run cmake, then > make, then make install. > > For the cmake phase I had to tell cmake where boost was. > This was not clearly documented, but I needed to set > BOOST_INCLUDEDIR: > set BOOST_INCLUDEDIR=...\boost_1_57_0 > (I had also tried setting BOOST_ROOT AND BOOST_PREFIX. > That didn't work, but it's possible that those are needed > in addition to BOOST_INCLUDEDIR.) > > I created a build directory, wt-3.3.3_build, parallel to the > root directory of the unzipped Wt archive, wt-3.3.3.tar.gz > > In wt-3.3.3_build, I ran the cmake command: > cmake ..\wt-3.3.3 -G "MinGW Makefiles" > > That ran the cmake process and produced the Makefile (in > wt-3.3.3_build). > > To build Wt itself I had to make some minor patches: > > I added: > #include <boost/weak_ptr.hpp> > to: > ...\boost_1_57_0\boost\signals2\trackable.hpp > > This was to patch what appears to be a known bug in > boost 1.57.0: > https://svn.boost.org/trac/boost/ticket/10100 > > Then there were some issues with the spirit parser. It > appears that boost reorganized some headers as of 1.56 > and this was addressed in Wt after 3.3.3: > http://redmine.webtoolkit.eu/issues/3561 > > I wanted to stick with a released version of Wt, so I > did not upgrade to 3.3.4 RC1 (nor download from git). > But I used 3.3.4 RC1 (wt-3.3.4-rc1.tar.gz) for guidance > for the patches: > > In ...\wt-3.3.3\src\Wt\Json\Parser.C replace: > #include <boost/spirit/home/phoenix/statement/throw.hpp> > with: > #if BOOST_VERSION < 105600 > #include <boost/spirit/home/phoenix/statement/throw.hpp> > #else > #include <boost/phoenix.hpp> > #endif > > Replace ...\wt-3.3.3\src\Wt\Render\CssParser.C with the version > from Wt 3.3.4 RC1. (The new version has two changes wrapped with > "#if BOOST_VERSION < 105600".) > > Replace ...\wt-3.3.3\src\Wt\Dbo\SqlQueryParse.C with the version > from Wt 3.3.4 RC1. (The new version has the same > "#include <boost/phoenix.hpp>" change that was hand-patched into > Parser.C.) > > With these patches in place I ran: > mingw32-make > from: > wt-3.3.3_build > (the directory in which cmake created the Makefile). > > This almost worked. The build failed compiling CssParser.C, but > there were hints it might have been an out-of-memory problem. I > killed off some unnecessary applications, and re-ran mingw32-make. > The build picked up where it left off, compiling CssParser.C, and > completing successfully. > > Note, it looked like it took about 2 GB of RAM to compile CssParser.C. > (It appears that CssParser.C uses the boost spirit parser-generator > to build its parser, so probably boost's template metaprogramming > used a lot of memory during compilation.) > > I then ran: > mingw32-make install > > This created the directory: > C:/Program Files (x86)/WT > and copied relevant files to it. > > (Note, I had to run "ming32-make install" as administrator, i.e., by > running the command in an "Administrator: Command Prompt" in > order for the above directory to be creatable / accessible.) > > I then moved "C:\Program Files (x86)\WT" (and its contents) to a > desired location because I didn't want it in "C:\Program Files (x86)". > Unfortunately, I couldn't find any documented way of telling the > build process to install Wt where I wanted it. > > The install process also created the directory C:/witty and the > single file it contained, C:/witty/wt_config.xml. Again, I > couldn't find any way to change this hard-wired location. I left > this location alone because it appears that Wt programs depend > upon it. > > The install process did report some errors: > Process failed because: The system cannot find the file specified > for command: mkdir -p c:/witty > Process failed because: The system cannot find the file specified > for command: chown apache:apache c:/witty > > It looks like some unix-isms have crept into the build script, > but it looks like these errors did not actually cause the install > process any problems. > > Lastly, I built the hello.C example. I copied just that one source > file out of the Wt installation into its own test directory. > > I added the Wt include files to CPLUS_INCLUDE_PATH: > ...\WT\include > and the Wt libraries to LIBRARY_PATH: > ...\WT\lib > > (These path variables also contain the boost include files and > libraries.) > > I then built hello.C with "g++ -std=gnu++14 -o hello hello.C" > and by observing which symbols were missing at link time, I > figured out which libraries to add. The complete build command > is: > > g++ -std=gnu++14 -o hello hello.C -lwt -lwthttp > -lboost_date_time-mgw49-1_57 -lboost_filesystem-mgw49-1_57 > -lboost_program_options-mgw49-1_57 -lboost_random-mgw49-1_57 > -lboost_regex-mgw49-1_57 -lboost_system-mgw49-1_57 > -lboost_thread-mgw49-mt-s-1_57 -lws2_32 -lwsock32 > > This command successfully compiles and links hello.C --> hello.exe. > > Hooray! My first 100 MB executable! > 12/03/2014 08:20 PM 110,604,961 hello.exe > > Running: > > hello --http-address=0.0.0.0 --http-port=80 --deploy-path=/hello > --docroot=. > > launches the hello-web-app server, and it is accessible from the url: > > http://localhost/hello > > Note, for hello.exe to run I need the boost libraries (as well as the > mingw-w64 libraries) in my path, but I do not need the Wt libraries in > my path. So it looks like my build is linking statically to Wt, but > dynamically to boost. > > > Thanks to the Wt team for developing the Wt framework and making > it available. > > > K. Frank > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk > _______________________________________________ > witty-interest mailing list > witty-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/witty-interest ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest