[Top][All Lists]

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

Re: [lmi] Cross-compiling lmi from Linux to MSW

From: Greg Chicares
Subject: Re: [lmi] Cross-compiling lmi from Linux to MSW
Date: Mon, 25 Jan 2016 04:54:16 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0

On 2016-01-14 01:35, Vadim Zeitlin wrote:
>  Here is what I did to cross-compile lmi from a Debian Jessie system.

A few days ago I started writing a reply thanking you for such a splendid
birthday present. Unfortunately, before I finished it, I tried rebuilding
wx with '--jobs' and no maximum specified--unfortunately, not in a VM. I
did manage to move the mouse pointer a couple centimeters every minute or
so, but I couldn't interact in any other way with the machine. Ctrl-Alt-F2
got no response. I guess Ctrl-Alt-Backspace is blocked because fugitives
from msw might use it by accident. And Ctrl-Alt-SysRq-REISUB is limited
by default (the E and I are blocked, apparently because...anyone with
physical access to the machine could kill processes? and that's worse than
yanking the power cord?). Well, I did get the machine stopped, but I lost
that email I was writing...so let me offer my belated thanks now.

I've gotten all the way to the libtool '_putenv' obstacle here:

>       $ mkdir ~/build/lmi-msw
>       $ cd $_
>       $  PATH=$HOME/msw/i686-w64-mingw32/bin:$PATH ~/src/lmi/configure \
>               --prefix=$HOME/msw/i686-w64-mingw32 --host=i686-w64-mingw32 \
>               CPPFLAGS=-I$HOME/msw/i686-w64-mingw32/include \
>               LDFLAGS=-L$HOME/msw/i686-w64-mingw32/lib \
>               CXXFLAGS='-Wno-unused-local-typedefs -Wno-unused-variable'
>       $ make install

so I haven't delved into this stuff yet:

> The only remaining problem is that there are a few extra steps to be done
> before the program can be actually used:
> - Copy (or move, to save space) the wx DLLs from lib to bin so that they're
>   found without having to explicitly set the PATH for them under MSW:
>       $ mv ~/msw/i686-w64-mingw32/lib/*.dll ~/msw/i686-w64-mingw32/bin
> - Copy the required MinGW to the same directory:
>       $ cp 
> /usr/lib/gcc/i686-w64-mingw32/4.9-win32/lib{stdc++-6.dll,gcc_s_sjlj-1}.dll 
> ~/msw/i686-w64-mingw32/bin
> - Generate the product files manually (this needs to be done under MSW,
>   either after copying the files or by sharing them with the VM):
>       > cd ~/msw/i686-w64-mingw32/share/lmi
>       > ../../bin/product_files.exe
> - Create configurable_settings.xml file in ~/msw/i686-w64-mingw32/bin.

>  To summarize, I can now cross-compile lmi easily, the main remaining
> problem is that I still can't do it in C++11 mode because our version of
> Boost is too old to support being built with a C++11 compiler. I'd like to
> change this a.s.a.p., I already have the minimal Boost.Filesystem patches
> to make the code compile with the latest Boost.

First, I'd like to get the 4.9.1 cross-compiler to work with libtool.
Then I'd like to add '-std=c++11'. As you point out elsewhere, the
version of boost we're using in production is so ancient that it
doesn't conflict with C++11.

> And ideally we'd also
> replace parts of Boost which are now part of C++11 standard library itself
> (e.g. shared_ptr, regex, ...) with the corresponding standard classes. But
> this, of course, would require more changes.

That's the next step after we get libtool patched.

>  Please let me know how would you like to proceed, but in the meanwhile
> I'll stop here (and it's even still January 13 in your time zone so I
> almost fulfilled my promise...)

We've made some changes to the procedures you outlined, so let me
document what I've been doing on various machines here.

# prerequisites

apt-get update
apt-get install g++-mingw-w64-i686 automake libtool make pkg-config
apt-get install subversion git
# optional--personal preferences only:
apt-get install zsh gnome-system-monitor geany
# only for VM clipboard support
apt-get install spice-vdagent
# ...in VM...apparently not needed
# update-rc.d spice-vdagent defaults

# fix libtool breakage (needs work)


diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 9358ec5..8e5c588 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -3388,7 +3388,7 @@ EOF
 /* declarations of non-ANSI functions */
 #if defined(__MINGW32__)
 # ifdef __STRICT_ANSI__
-int _putenv (const char *);
+_CRTIMP int _putenv (const char *);
 # endif
 #elif defined(__CYGWIN__)
 # ifdef __STRICT_ANSI__

# downloads: once only

mkdir --parents ~/src
cd ~/src
svn checkout http://svn.sv.nongnu.org/svn/lmi/lmi/trunk lmi 2>&1 |less

mkdir --parents ~/src/3rdparty

cd ~/src/3rdparty
wget http://downloads.sourceforge.net/boost/boost_1_38_0.tar.bz2
tar xf boost_1_38_0.tar.bz2

cd ~/src/3rdparty
wget ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.26.tar.bz2
tar xf libxml2-2.6.26.tar.bz2

cd ~/src/3rdparty
#wget http://svn.sv.nongnu.org/svn/lmi/lmi/trunk/libxslt-1.1.17-lmi.patch
wget ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/libxslt-1.1.17.tar.bz2
tar xf libxslt-1.1.17.tar.bz2
patch --strip=1 <~/src/lmi/libxslt-1.1.17-lmi.patch

cd ~/src/3rdparty
git clone https://github.com/vadz/xmlwrapp.git
cd xmlwrapp

cd ~/src/3rdparty
git clone https://github.com/wxWidgets/wxWidgets.git

cd ~/src/3rdparty
git clone https://github.com/vadz/wxpdfdoc.git

# updates: only after initial download

# [svn update; git too; we can flesh this step out later]

# build

mkdir ~/build
mkdir --parents ~/msw/i686-w64-mingw32/lib
cd ~/src/3rdparty/boost_1_38_0
# it would seem nicer not to build in the source directories
for z in regex system filesystem; \
  do (cd libs/$z/src && \
  i686-w64-mingw32-g++ -I../../.. -c *.cpp && \
  i686-w64-mingw32-ar rc ~/msw/i686-w64-mingw32/lib/libboost_$z.a *.o); done
mkdir --parents ~/msw/i686-w64-mingw32/include
cp -a boost ~/msw/i686-w64-mingw32/include/

export coefficiency="--jobs=`nproc`"

cd ~/src/3rdparty
mkdir ~/build/libxml2-msw
cd $_
~/src/3rdparty/libxml2-2.6.26/configure \
  --disable-static --enable-shared \
  --with-{debug,schemas} --without-{iconv,modules,python,schematron} \
  --prefix=$HOME/msw/i686-w64-mingw32 \
  --build=x86_64-unknown-linux-gnu \
  --host=i686-w64-mingw32 \
make $coefficiency --quiet install

cd ~/src/3rdparty
mkdir ~/build/libxslt-msw
cd $_
~/src/3rdparty/libxslt-1.1.17/configure \
  --disable-static --enable-shared \
  --with-debug --without-{crypto,python} \
  --prefix=$HOME/msw/i686-w64-mingw32 \
  --build=x86_64-unknown-linux-gnu \
  --host=i686-w64-mingw32 \
# repair this packaging mistake before invoking 'make':
rm ~/src/3rdparty/libxslt-1.1.17/libxslt/xsltconfig.h
make $coefficiency --quiet install

cd ~/src/3rdparty/xmlwrapp
mkdir ~/build/xmlwrapp-msw
cd $_
~/src/3rdparty/xmlwrapp/configure \
  --disable-shared --disable-tests --disable-docs \
  --with-boost=$HOME/msw/i686-w64-mingw32 \
  --prefix=$HOME/msw/i686-w64-mingw32 \
  --host=i686-w64-mingw32 \
make $coefficiency install

mkdir ~/build/wx-msw
cd $_
# same options as lmi production, sans --build and --enable-vendor:
~/src/3rdparty/wxWidgets/configure \
  --prefix=$HOME/msw/i686-w64-mingw32 \
  --host=i686-w64-mingw32 \
  --disable-apple_ieee \
  --disable-aui \
  --disable-compat24 \
  --disable-fswatcher \
  --disable-gif \
  --disable-mediactrl \
  --disable-propgrid \
  --disable-ribbon \
  --disable-richtext \
  --disable-stc \
  --disable-threads \
  --disable-webview \
  --enable-monolithic \
  --enable-shared \
  --enable-std_iostreams \
  --enable-stl \
  --without-libjpeg \
  --without-libtiff \
  --without-opengl \
make $coefficiency install
mkdir ~/build/wxpdfdoc-msw
cd $_
~/src/3rdparty/wxpdfdoc/configure \
    --prefix=$HOME/msw/i686-w64-mingw32 --host=i686-w64-mingw32 \
make $coefficiency install

cd ~/src/lmi
mkdir ~/build/lmi-msw
cd $_
PATH=$HOME/msw/i686-w64-mingw32/bin:$PATH ~/src/lmi/configure \
  --prefix=$HOME/msw/i686-w64-mingw32 --host=i686-w64-mingw32 \
  CPPFLAGS=-I$HOME/msw/i686-w64-mingw32/include \
  LDFLAGS=-L$HOME/msw/i686-w64-mingw32/lib \
  CXXFLAGS='-Wno-unused-local-typedefs -Wno-unused-variable' 2>&1 |less
make $coefficiency install 2>&1 |less

reply via email to

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