Talk:Apertium on Windows

From Apertium
Jump to navigation Jump to search

Packaging a windows release?

Perhaps Cygwin license[1] would allow a packging of apertium and the required cygwin items to create a windows release?

Ote 22:55, 9 November 2007 (UTC)

It should be possible, but cygwin distribution must be optimized for size. I've tried compiling apertium with cygwin last week, but it gave some errors and could not advance further. I would also appreciate if someone had packaged cygwin with apertium and also supplied a batch file which enables translation with a simple double click under Windows environment.--Msalperen 09:14, 10 November 2007 (UTC)

I'm sorry, but you're wrong. It's not possible to build Apertium with any currently existing version of Cygwin. Cygwin's great, but it's not 100%. Cygwin 1.7 reputedly has the missing pieces of Unicode support that we need, but it doesn't as yet use GCC 4, which we also need. As soon as Cygwin 1.7 is available with GCC 4, I'll look into it again. -- Jimregan 18:05, 22 November 2008 (UTC)
Oh, and to answer the original question; the licence of Cygwin is not a problem. Apertium hasn't been packaged for cygwin due to technical issues -- Jimregan 18:07, 22 November 2008 (UTC)

Compilation

Is "valgrind" the correct version to use for Windows ? But next, directory Win32 is missing, on the other hand "branches\apertium" has a Win32 dir. but no lttoolbox. The page can be updated depending on the answer.

All of the Windows stuff is now merged into the trunk. We should really delete the branch[es]. - Francis Tyers 12:51, 22 November 2008 (UTC)
Correction: the win32 work on lttoolbox has all been merged - it should build without problems in VC++. The work on Apertium hasn't all been merged, and it's not yet complete. I'll get to it, I'm just not majorly motivated, because I despise Windows :) -- Jimregan 18:05, 22 November 2008 (UTC)
I think all the necessary stuff has been merged no ? A couple of weeks ago we guided a guy through compiling it on Windows, and he managed it without any patches. It might be worth looking at the mailing list posts, look up the thread [Apertium-stuff] Help on errors in Windows build. - Francis Tyers 18:10, 22 November 2008 (UTC)
I remember that thread. Nope, no magical fixes slipped in under my nose. Same problems exist. -- Jimregan 22:08, 22 November 2008 (UTC)

Windows not supported ?

But the code I am trying to compile now will work right ? Mlavaud 18:32, 23 November 2008 (UTC)

Yes. What "not supported" means is that we don't really know _how_ it works, and can't offer the same level of support as on *nix. :) At least two or three people have got it working under Windows, so it is possible. - Francis Tyers 18:35, 23 November 2008 (UTC)
I will help fix things with pleasure if I can. Mlavaud 18:38, 23 November 2008 (UTC)
Cool thanks :) I think that at the moment the main thing we're lacking is documentation. So any details you can add or clarify we'd be very happy :) - Francis Tyers 18:54, 23 November 2008 (UTC)

First I need a few parameters to be correctly positioned: I have "#define MB_CUR_MAX ___mb_cur_max_func()" activated in stdlib.h and it is not compatible with "char symbol[MB_CUR_MAX+1];" in apertium_deshtml.cc -> "error constant needed", also I have "wchar_t cad[filename.size()];" in the same file, but an array definition needs a constant, or is there a parameter somewhere in Visual C++ for that ? Mlavaud 19:47, 23 November 2008 (UTC)

I'm not aware of any parameter for that, although... the deformatters aren't 100% necessary for the correct functioning of the system. I would recommend leaving them until last. - Francis Tyers 19:53, 23 November 2008 (UTC)
apertium_desodt.cc also has a line "wchar_t cad[filename.size()];" with same error (constant waited), probably many files will have the same problem. Mlavaud 20:07, 23 November 2008 (UTC)
I think only the files which are generated from flex (e.g. the de/re-formatters) will have this. - Francis Tyers 20:16, 23 November 2008 (UTC)
A problem at linking, how do I include the libraries needed ? Mlavaud 20:11, 23 November 2008 (UTC)
"apertium_desodt.cc
Linking CXX executable apertium-desodt.exe
apertium_desodt.cc.obj : error LNK2019: symbole externe non rÚsolu _regcomp rÚfÚ
rencÚ dans la fonction "void __cdecl init_escape(void)" (?init_escape@@YAXXZ)
apertium_desodt.cc.obj : error LNK2019: symbole externe non rÚsolu _regexec rÚfÚ
rencÚ dans la fonction "class std::basic_string<wchar_t,struct std::char_traits<
wchar_t>,class std::allocator<wchar_t> > __cdecl escape(class std::basic_string<
char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?esca
pe@@YA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@ABV?$ba
sic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z)
apertium-desodt.exe : fatal error LNK1120: 2 externes non résolus"
Can you show me which libraries it is linking (or trying to link) to ? - Francis Tyers
It needs regcomp and regexec, so I guess it needs a regex lib ? Well my \pcre\lib is empty, that is the problem I think. Mlavaud 20:20, 23 November 2008 (UTC)
Yes that could well be the problem. Did you install libpcre from source or from a binary package ? - Francis Tyers 20:24, 23 November 2008 (UTC)
A package found at http://gnuwin32.sourceforge.net/packages/pcre.htm, but no file pcrecpp.lib is provided, only a pcre-bcc.lib and it doesn't work more. Mlavaud 20:55, 23 November 2008 (UTC)
Try building PCRE from source then I guess... - Francis Tyers 20:58, 23 November 2008 (UTC)
I removed the ref. to pcrecpp.lib and it linked. Mlavaud 15:18, 24 November 2008 (UTC)
Ok, so long as it was in the de/re-formatters or tagger and not any of the transfer modules, it should work fine. - Francis Tyers 17:48, 24 November 2008 (UTC)

An idea to fix this error ? Mlavaud 19:33, 24 November 2008 (UTC)

C:\Apertium\trunk\apertium\apertium\collection.cc(70) : error C2440: 'initialisation' : impossible de convertir de 'std::_Tree<_Traits>::const_iterator' en 'std::_Tree<_Traits>::iterator' with
[ _Traits=std::_Tset_traits<int,std::less<int>,std::allocator<int>,false> ] Aucun constructeur n'a pu prendre le type de source, ou la résolution de la surcharge du constructeur était ambiguë
C:\Apertium\trunk\apertium\apertium\collection.cc(71) : error C2440: 'initialisation' : impossible de convertir de 'std::_Tree<_Traits>::const_iterator' en 'std::_Tree<_Traits>::iterator' with 
[ _Traits=std::_Tset_traits<int,std::less<int>,std::allocator<int>,false> ] Aucun constructeur n'a pu prendre le type de source, ou la résolution de la surcharge du constructeur était ambiguë
set<int>::const_iterator it = element[i]->begin() works, you know what ? I "despise" STL. ;) Mlavaud 20:52, 24 November 2008 (UTC)
Haha :) Did it work finally? - Francis Tyers 22:00, 24 November 2008 (UTC)
not yet, searching for isinf() definition now. Mlavaud 22:04, 24 November 2008 (UTC)
This will do I hope. Mlavaud 22:33, 24 November 2008 (UTC)
#define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) || (_fpclass(x) == _FPCLASS_NINF))
#define isnan(x) _isnan(x)

If someone ever compiled this program with Visual Studio, he should tell me how to allow vector<wstring> translation_window[window.size()]; because there too many arrays defined with a variable instead of a constant and I doubt I will be able to fix them all. Mlavaud 22:55, 24 November 2008 (UTC)

I've emailed one of the guys who managed it before, hopefully he will reply here soon... although I suspect that he changed them all, unless there is a flag to Visual Studio? - Francis Tyers 06:27, 25 November 2008 (UTC)
I try this: vector<wstring> *translation_window = new vector<wstring>[window.size()]; [...] delete translation_window;

"if (wcstok(news, delim, &ptr))" -> "if (ptr = wcstok(news, delim))"

strcasecmp() -> strcmpi()

4 files compile now but the next one needs the full pcre to link I think, I will have to recompile it first.