[sword-devel] Building Python binding to Sword on Windows returns exit code 1

Greg Hellings greg.hellings at gmail.com
Wed May 14 19:18:10 MST 2014

I now have the core library compiling through CMake with the following

C:\Users\Gregory\Documents\building\sword-build>cmake ..\sword -G"Visual
Studio 12" -DBZIP2_LIBRARY=..\bzip2\Release\libbz2.lib
-DBZIP2_INCLUDE_DIR=..\bzip2 -DXZ_LIBRARY=..\xz\bin_i486\liblzma.lib
-DXZ_INCLUDE_DIR=..\xz\include -DICU_LIBRARY=..\icu-sword\lib\icuuc.lib

This obviously requires Visual Studio 12 (2013). Change to "Visual Studio
11" if you are using the previous version, or the like. For me, this had to
be invoked from the command line because CMake-GUI was forcing me to build
64-bit binaries. This also assumes you have the latest SVN of sword checked
out into a directory called "sword", that you are in a parallel directory
(I named mine sword-build), and that you have followed all the same
instructions that you would for invoking the regular build projects as
documented in the wiki. If not, you might have to adjust the manually
specified directories above. I hope to improve that automatic detection
here in a little bit, but for the moment I'm just happy it's compiling and
kinda-almost-sorta running.

There are a LOT of redundant warnings, mainly about functions that are not
declared as DLL export functions and some about casting variable types that
are not present in the "normal" build. It will take me a while to track
down exactly what is different between the two to eliminate those warnings.
I also haven't tried throwing swig at these results yet, either.


On Wed, May 14, 2014 at 12:55 PM, Greg Hellings <greg.hellings at gmail.com>wrote:

> On Tue, May 13, 2014 at 3:56 PM, Greg Hellings <greg.hellings at gmail.com>wrote:
>> On Tue, May 13, 2014 at 3:48 PM, R Johnson <
>> ps16thypresenceisfullnessofjoy at gmail.com> wrote:
>>> Thanks, Greg and Ben.
>> If we could get that working, it would be great! Unfortunately, I don't
>>> have any experience with CMake either (in fact, I had never heard of it
>>> until I started trying to build Sword). But I'm willing to learn, and will
>>> try to do what I can.
>>> Following the instructions in some of the Sword README files, I was
>>> successfully able to create a VS2010 project for Sword with CMake (with the
>>> argument -DSWORD_BINDINGS="Python" added). But when I tried to build the
>>> Visual Studio project that it created, I got several errors. The output
>>> from the attempted build was 1625 lines, but many of them were not fatal
>>> errors, just warnings. I used a regex to remove all the warnings, and have
>>> attached the resulting file.
>>> It appears that the problem is that two header files cannot be found:
>>> 'dirent.h' and 'inttypes.h'. As far as I can tell, the former is in the
>>> Sword repository, but the latter is not (but is mentioned, along with
>>> HAVE_INTTYPES_H, in 'config.h.in' in the 'include' directory). The
>>> fatal errors that I got afterwards are likely caused by the previous builds
>>> failing, I think. Perhaps the problem could be fixed by simply adding these
>>> files to the correct directory?
>> dirent.h is present in most Linux/Unix environments but is absent in
>> windows environments. There is an appropriate flag we will need to enable
>> in CMakeLists.txt to tell SWORD to use the bundled dirent.h file. I believe
>> it's just a matter of setting the appropriate include directory when
>> building with MSVC (dirent.h is available when cross-compiling from MinGW
>> but that doesn't really help the MSVC/Python case).
> I've gotten past this compile error and identified a second one that Troy
> fixed (actually a known bug in MSVC that we created a workaround for). Now
> I need to fix its detection of dependent library include/link paths.
> --Greg
>> I'll have to look into inttypes.h - it's probably an issue with finding
>> the appropriate compiler flags to set. I know that Sword builds with and
>> supports MSVC as there is a native MSVC build file that works fine with
>> VS2010. So it's just a matter of garnering from it to figure out what CMake
>> needs to do.
>> --Greg
>>> Also, since the C# project solution file is unmaintained, do you think
>>> it would be a good idea to remove it from the repository? If that was done,
>>> it wouldn't cause confusion for other Sword newbies in the future like it
>>> did me.
>>> Thank you for your help.
>>> -- Timothy
>>> _______________________________________________
>>> sword-devel mailing list: sword-devel at crosswire.org
>>> http://www.crosswire.org/mailman/listinfo/sword-devel
>>> Instructions to unsubscribe/change your settings at above page
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20140514/07c43332/attachment.html>

More information about the sword-devel mailing list