Jump to navigation Jump to search
6,327 bytes added ,  08:44, 1 August 2016
# Install mercurial with ''pacman -S mercurial''
At this point I had many questions. There were mingw64 toolchains and also the non-mingw version of those toolchains on Msys2. Moreover, for any program such as Python, we can call either ''/c/Python27/python.exe'' from windows of or simply ''/bin/python'' which will run the *nix executable. Also, I could not find ''libboost-python'' for Msys2 which is a dependency for pytave.
Tatsuro told to use the mingw64 toolchains that come with octave (for consistency reasons). As octave has msys toolchains along with it. And just use the extra MSYS2 toolchains on top of it.
=== Use MSYS2 on top of Octave's MSYS environment ===
When using the bash prompt from 'octave-cli.exe' we could not use the libboost-python that we used with MSYS2, so we had to build boost from source using octave's msys tools.. The steps I used to build boost are:
# Open octave-cli.exe
# cd e:/boost_1_61_0
# system bash
# export PATH=$PATH:/c/msys64/usr/bin
# ./bootstrap
# ./b2 install --with-python --prefix=/e/boost_build
But I was getting some linking error with octave. Tatsuro provided a 32 bit version of octave that he had built. After this, I had to use install 32 bit Python and rebuild boost.
There was an error in configure that PYTHON_EXTRA_LIBS was 'None' on windows and hence the configure failed. As per Mike's suggestion I set it to a valid gcc flag for the time being with ''export $PYTHON_EXTRA_LIBS=-g''
After this too the build failed with undefined references to few symbols. Tatsuro suggested to build boost with ''link=static,shared''. He had successfully built boost with it but I could not build boost with this option on my PC.
To sum up, Tatsuro has built 32 bit version of octave and used it to build libboost-python with the option ''link=static,shared'' and has successfully got the configure step done. But in the ''make'' step he is getting some undefined symbol errors for ''__imp__'' symbols.
=== Summary ===
Here, I will note down the steps (which worked) as per Tatsuro's mail from the very start. So, anyone can try to build pytave on windows. These are the details he sent on the mailing list (slightly edited):
* Build 32bit 4.1.0+ for windows by mxe-octave on linux. Refer to the [ wiki page].
* Install 32 bit Python for windows from [ Python website].
* Install numpy on 32 bit Python for windows
:# Get (e.g.
:# In command prompt cd to python2.7 32bit directory e.g. ''cd C:\Python27_32''
:# Install pip by executing ''python''
:# cd to Scripts dir with ''cd C:\Python27_32\Scripts''
:# Install numpy via pip by executing ''pip install numpy''
* Install msys2, update and install tools
:# Download and install [ msys2].
:# Startup msys2 prompt from shortcut C:\msys64\
:# Execute ''update-core''
:# After update is finished, exit with "x" button and do not use exit command.
:# Start MSYS2 again and execute ''pacman -Suu''
:# Again exit with "x" button on title bar
:# Start MSYS2 and install build toolkit with ''pacman -S --needed base-devel msys/dos2unix'' and mercurial with ''pacman -S mercurial''
* Build liboost-python with shared libraries
:# Download [ boost_1_61_0.tar.bz2] and un-archieve it.
:# Open octave-cli from bin directory of the 32 bit octave that you built
:# run ''system bash'' and then cd to the unarchieved directory of boost
:# export path to include msys2 tools and python with ''export PATH=$PATH:/c/msys64/usr/bin:/c/Python27_32:/c/Python27_32/scripts''
:# Run ''./'' then b2.exe and bjam.exe will be built
:# Compile source files and link object files to generate (shared) libraries.
:: ''./b2 install link=static,shared --with-python cflags='IC:/Python27_32/include' \''
:: ''cxxflags='-IC:/Python27_32/include' linkflags='-LC:/Python27_32/libs' \''
:: ''--prefix=/d/usr/Tatsu/program/Pytave/PytaveBuild/boost/mingw32/boost_1_16_inst \''
:: ''2>&1 | tee make.log''
:: cflags, cxxflags and linkflags are not required if youinstall python2.7 (32bit) to the default directory (C:\Python27).
:: ''link=static,shared'' gives static and shared libraries
:: ''--with-python'' builds only libboost_python. ''--prefix'' specifies install directory.
:: ''2>&1 | tee make.log'' is added to memorize build process.
:# copy (install dir )/lib/libboost_python-mgw49-mt-1_61.dll.a and rename it as libboost_python.dll.a
* Build PyTave
:# Open octave-cli and run ''system bash'' and export PATH to include msys2 tools and python ''export PATH=$PATH:/c/msys64/usr/bin:/c/Python27_32:/c/Python27_32/scripts''
:# Also export libboost_python dir to PATH with ''export PATH=$PATH:/d/usr/Tatsu/program/Pytave/PytaveBuild/boost/mingw32/boost_1_16_inst/lib''
:# cd to build directory for pytave ''cd "D:\usr\Tatsu\program\Pytave\PytaveBuild\Pytave\build32"''
:# Set CPPFLAGS as libtool is escaping th '\' characters...
:: ''export CPPFLAGS='-IC:/Python27_32/include -ID:/usr/Tatsu/program/Pytave/PytaveBuild/boost/mingw32/boost_1_16_inst/include -ID:/usr/Tatsu/program/Pytave/PytaveBuild/boost/mingw32/boost_1_16_inst/include/boost-1_61 -IC:/octave/octave-4.1.0plus_x86-2016-06-25-08-57/include/octave-4.1.0+ -IC:/octave/octave-4.1.0plus_x86-2016-06-25-08-57/include/octave-4.1.0+/octave -Ic:/Python27_32/include -Ic:/Python27_32/lib/site-packages/numpy/core/include'''
:# set LDFLAGS as pytave misdirects library directory of python.
:: ''export LDFLAGS='-Wl,--enable-auto-import -Wl,-export-all-symbols -LC:/Python27_32/libs -LD:/usr/Tatsu/program/Pytave/PytaveBuild/boost/mingw32/boost_1_16_inst/lib -LC:/octave/octave-4.1.0plus_x86-2016-06-25-08-57/lib -LC:/octave/octave-4.1.0plus_x86-2016-06-25-08-57/lib/octave/4.1.0+'''
:# Run configure of pytave
:: ''../pytave/configure LIBS='-LC:/Python27/libs' --prefix='D:/usr/Tatsu/program/Pytave/PytaveInst32' \''
:: ''--build=i686-w64-mingw32 --host=i686-w64-mingw32 \''
:: ''--with-boost='D:/usr/Tatsu/program/Pytave\/PytaveBuild/boost/mingw32/boost_1_16_inst'''
:: The build and host --build=i686-w64-mingw32 --host=i686-w64-mingw32 are set because many configure scripts mis-detect them when msys2 is 64bit.
:# Execute ''make''. Build fails with ''warning: undefined symbols not allowed in i686-w64-mingw32 shared libraries; building static only'' and ''error: object name conflicts in archive: .libs/_pytave.lax/libpytave.a//d/usr/Tatsu/program/Pytave/PytaveBuild/Pytave/build32/./.libs/libpytave.a''
=== Conclusion ===
To quote Tatsuro ''A lot of _imp__ symbols errors are detected because no _imp__(symbol)s exist in object files. While object files libboost_python for threading-multi have _imp__(symbol)s in their object files. Boost does not show full compiling states. Therefore I do not know what libboost is to do.''
I too have googled extensively but haven't gotten to any solution for this problem.

Navigation menu