root/main/trunk/greenstone2/common-src/indexers/packages/windows/iconv/GS-README-VS14-VS2015-AND-LATER.txt @ 32637

Revision 32637, 4.2 KB (checked in by ak19, 22 months ago)

1. Returning to the original windows iconv.zip. 2. Making and documenting the final change to get the original windows iconv.zip to compile with VS2017 (or is it VS14/2015) without errors.

Line 
1*****************************************************************
2COMPILING LIBICONV ON WINDOWS USING VS14/VS2015 AND LATER
3*****************************************************************
4In order to get libiconv to compile with Visual Studio 14 (which is Visual Studio 2015) and later,
5I needed to do the following to produce gs-libiconv-winVS14-VS2015-plus.zip now uploaded on GS SVN
6at GS2\common-src\indexers\packages\windows\iconv
7
8For compiling GS3 with VS14 (VS2015) and later, after running ant prepare, rename this zip file as "iconv.zip"
9and then proceed to run ant install.
10
11
12[
13NO NEED FOR STEP 1
14X 1. Libiconv 1.11 appears to be the last version of the package that can be compiled with Visual Studio.
15Subsequent versions require Mingw and/or Cygwin and won't work easily with our existing GS compile workflow.
16
17We already have a gs-libiconv 1.11 tarball at GS3\gs2build\common-src\packages\iconv\gs-libiconv-1.11.tar.gz
18
19I followed Dr Bainbridge's initial attempts and copied this into GS3\gs2build\common-src\indexers\packages\windows\iconv
20where I untarred it and made the following changes (points 2 and 3 below).
21Then I renamed the untarred version from libiconv-1.11 to iconv
22and finally I zipped it up to produce iconv.zip.
23]
24
252. In the Makefile.msvc files inside gs-libiconv 1.11 that are listed below,
26change the now syntax error
27
28    !if $(DEBUG)
29to
30    !if "$(DEBUG)" == "1"
31   
32(example is here:
33https://github.com/adobe/chromium/blob/master/third_party/libxslt/win32/Makefile.msvc)
34
35
36List of affected Makefile.msvc files:
37- ./lib/Makefile.msvc
38- ./libcharset/lib/Makefile.msvc
39- ./src/Makefile.msvc
40- ./srclib/Makefile.msvc
41- ./tests/Makefile.msvc
42
43Not sure if other similar instances need similar changes, e.g. !if !$(DLL)
44but they didn't give rise to syntax errors or GS3 compilation failures, so I left them as is.
45
46
473. To overcome mbstate_t "redefinition *conflict*" error:
48
49loop_wchar.h, need last line below to replace existing typedef
50https://stackoverflow.com/questions/31960646/visual-studio-2015-libc-is-not-backwards-compatible
51(explains the need to recompile 'everything' when changing to VS 2015 to use the new definition of mbstate_t)
52
53    typedef struct _Mbstatet
54    { // state of a multibyte translation
55        unsigned long _Wchar;
56        unsigned short _Byte, _State;
57    } _Mbstatet;
58
59    typedef _Mbstatet mbstate_t;
60
61
62So in GS3svn\gs2build\common-src\indexers\packages\windows\iconv\iconv\lib\loop_wchar.h,
63change:
64    # ifndef mbstate_t
65       typedef int mbstate_t;
66    # endif
67to:
68
69    # ifndef mbstate_t
70    typedef _Mbstatet mbstate_t;
71    # endif
72
73
744. stdbool.h redefinition of bool
75
76- The solution wasn't: http://www.cplusplus.com/forum/beginner/72957/
77(and which issue produced the flow on errors at https://lists.gnu.org/archive/html/bug-gnu-libiconv/2007-07/msg00002.html)
78
79- The solution was indicated at: https://github.com/chansen/p5-time-moment/issues/12
80That new VS compilers had their own stdbool.h where bool was typedefed to some other type with a different size in memory.
81So we have to use this stdbool.had
82
83My solution was therefore to get rid of iconv/windows/stdbool.h for the iconv-VS14+ version,
84to let it find the iconv in VS14+ instead.
85So I renamed iconv/windows/stdbool.h to iconv/windows/stdbool.unusable_for_VS14plus
86   
87
88INFORMATIVE LINKS THAT WEREN'T RELEVANT AT THE TIME OR TO SOLVING THE ABOVE PROBLEMS:
89* libiconv 1.14 binaries?
90https://sourceforge.net/projects/mingw-w64/
91
92* Vis Studio 2013 (VS12) and before:
93https://stackoverflow.com/questions/2733402/how-to-build-gnu-libiconv-on-for-windows
94
95* Beware the notes in libconv 1.11's README.woe32 that says:
96"- Requires MS Visual C/C++ 4.0 or 5.0 or 6.0 or 7.0.
97
98  Note that binaries created with MSVC 7.0 should not be distributed: They
99  depend on a closed-source library 'msvcr70.dll' which is not normally part
100  of a Woe32 installation. You cannot distribute 'msvcr70.dll' with the
101  binaries - this would be a violation of the GPL and of the Microsoft EULA.
102  You can distribute the binaries without including 'msvcr70.dll', but this
103  will cause problems for users that don't have this library on their system.
104  Therefore it is not recommended. This problem does not occur with MSVC 6.0
105  and earlier.
106"
Note: See TracBrowser for help on using the browser.