[texworks] Building TeXworks on Windows using MinGW

Stefan Löffler st.loeffler at gmail.com
Sat Jun 13 18:52:53 CEST 2009


Hi again,

I think we're getting close ;).

On 2009-06-13 16:28, Alain Delmotte wrote:
> Stefan Löffler a écrit :
>> As for the problem with compiling: Googling reveals that this is also a
>> well-known problem and apparently a bug in the Qt include files. There
>> is a workaround posted at http://www.itworld2.com/qtcompilation.aspx
>> (scroll to the very bottom of the page) which unfortunately involves
>> hacking the source code again (I hoped to get rid of that ;)).
>>   
>
> There is no Qt\4.4.3\src directory, but I did find qatomic_windows.h
> in \include\Qt and \include\Qtcore
> In these files there is no:
> /*#if !(defined Q_CC_BOR) || (__BORLANDC__ < 0x560)   extern "C" {
> __declspec(dllimport) long __stdcall InterlockedCompareExchange(long
> *, long, long);   __declspec(dllimport) long __stdcall
> InterlockedIncrement(long *);   __declspec(dllimport) long __stdcall
> InterlockedDecrement(long *);
> __declspec(dllimport) long __stdcall InterlockedExchange(long *,
> long);   __declspec(dllimport) long __stdcall
> InterlockedExchangeAdd(long *, long);   }   #else */
> extern "C" {   __declspec(dllimport) long __stdcall
> InterlockedCompareExchange(long volatile*, long, long);  
> __declspec(dllimport) long __stdcall InterlockedIncrement(long
> volatile*);   __declspec(dllimport) long __stdcall
> InterlockedDecrement(long volatile*);   __declspec(dllimport) long
> __stdcall InterlockedExchange(long volatile*, long);  
> __declspec(dllimport) long __stdcall InterlockedExchangeAdd(long
> volatile*, long);   }   // #endif
>
> but only the first part (here the commented part); so I modified the
> existing part to have "long volatile*"
> I did this in both files !!!!

Sounds good to me. The information on the web page was for actually
compiling Qt, which we're not doing here. But modifying the include
files seems the right thing to do.

> Now compilation is different, it goes long before to end with errors.
> In the attached files you'll find what is output in the redirection
> file (compil.log) and what is not redirected but goes immediately to
> the console (mingw32-make_compilation.log)

That's a good sign. In fact, from the errors you sent, I think we're
almost there. It seems that all the source files got compiled correctly
now, it's just the last step that's making problems: linking them. The
errors indicate that there are some libraries missing, and this is
confirmed by the command line given in the second log (only mingw32 and
some Qt libs are linked).

My guess is that when modifying TeXworks.pro, you removed too many
lines. I realize that my initial guide, stating just the differences to
the existing guide for msvc, was probably a bit misleading there. All in
all, you need to have the following lines in there:
    INCLUDEPATH += C:/KDE/include/poppler/qt4
    INCLUDEPATH += C:/texworks-mingw/hunspell-1.2.8/src/hunspell
    LIBS += -LC:/texworks-mingw/hunspell-1.2.8/src/hunspell/.libs
    LIBS += -lpoppler-qt4
    LIBS += -lpoppler
    LIBS += -lfreetype
    LIBS += -lhunspell-1.2
    LIBS += -lz

The last lines tell qmake and later make which libraries to use. In the
msvc case, they were replaced by others, but for mingw they need to be
retained. In fact I don't even know if you have to link to poppler,
freetype, and z explicitly. I don't think so, and would appreciate it if
you tried it without them, but the lines I just gave you are the ones
that worked for me (I just left them from the original TeXworks.pro).

Hopefully, this will give you a working TW application ;).

-Stefan


More information about the texworks mailing list