Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#86 Trouble compiling xca for Windows

v1.0_(example)
closed
nobody
None
3
2014-11-24
2013-11-19
dvo
No

[Sorry for the formatting errors in my previous post, which unfortunately I cannot be edit or delete]

It was pretty straightforward to compile xca under Ubuntu Linux (with the minor quirks reported in https://sourceforge.net/p/xca/bugs/83/), but with Windows I have major trouble.

Which is the preferred build environment for Windows?
I found the misc/build-w32.sh script for cross compilation under Linux,
but it appears outdated. I updated it as follows:
5c5
< OPENSC_DIR="opensc-0.11.13"
---
> OPENSC_DIR="opensc-0.13.0"
7c7
< OPENSC_DL="http://www.opensc-project.org/files/opensc/${OPENSC_GZ}"
---
> OPENSC_DL="http://heanet.dl.sourceforge.net/project/opensc/OpenSC/${OPENSC_DIR} /${OPENSC_GZ}"
15c15
< OPENSSL_DL="http://openssl.org/source/${OPENSSL_GZ}"
---
> OPENSSL_DL="http://www.openssl.org/source/${OPENSSL_GZ}"
but then it turned out that the openssl-1.0.0a/ms/mingw32-cross.sh script is not available.
At this point I got stuck. Can you please update the script?

Has anyone succeeded compiling xca natively under Windows?
I tried using both Cygwin and MinGW (the 32-bit versions under Windows 7 64-bit).
I spent many hours fiddling with various changes to Local.mak until I finally got all the static and dynamic libraries glued such that the executable loads without linking errors.
Yet in the end I am stuck experiencing a runtime error (segmentation fault).
Here is the abbreviated gdb output:

gdb ./xca
GNU gdb (GDB) 7.6.50.20130728-cvs (cygwin-special)
[...]
Reading symbols from /cygdrive/p/XCA/src/xca...rudone.
(gdb) run
Starting program: /cygdrive/p/XCA/src/xca
[New Thread 4432.0x5ac4]

Program received signal SIGSEGV, Segmentation fault.
0x6e1cf6dc in ZN16QCoreApplication9translateEPKcS1_S1_NS_8EncodingEi ()
from /cygdrive/p/XCA/src/QtCore4.dll
(gdb) bt
#0  0x6e1cf6dc in ZN16QCoreApplication9translateEPKcS1_S1_NS_8EncodingEi ()
   from /cygdrive/p/XCA/src/QtCore4.dll
#1  0x6e1cfba2 in ZN16QCoreApplication9translateEPKcS1_S1_NS_8EncodingE ()
   from /cygdrive/p/XCA/src/QtCore4.dll
#2  0x6e1d4dea in ZNK11QMetaObject2trEPKcS1_ () from /cygdrive/p/XCA/src/QtCore4.dll
#3  0x004e34ed in tr (c=0x0,
    s=0x505c34 <x509name::getMostPopular() const::nids+2144> "Please enter the new SO PIN  (PUK)                                    for the token: '%1'")
    at /cygdrive/c/Qt/4.8.5/include/QtCore/../../src/corelib/kernel/qobject.h:113
#4  __static_initialization_and_destruction_0 (__initialize_p=<optimized out>,
    __priority=<optimized out>) at pkcs11.cpp:326
#5  _GLOBAL__sub_I__ZThn8_N12ExportDialogD1Ev () at pkcs11.cpp:668
#6  0x004a760a in __do_global_ctors ()
    at /usr/src/debug/mingw-runtime-4.0-1/src/libcrt/crt/gccmain.c:77    
#7  0x004a765c in __main () at /usr/src/debug/mingw-runtime-4.0-1/src/libcrt/crt/gccmain.c:94
#8  0x00401289 in __mingw_CRTStartup ()
    at /usr/src/debug/mingw-runtime-4.0-1/src/libcrt/crt/crt1.c:246
#9  0x00401515 in mainCRTStartup ()
    at /usr/src/debug/mingw-runtime-4.0-1/src/libcrt/crt/crt1.c:272

Chris, to speed up the process, would you mind producing a Windows version of xca that includes the patch reported in http://sourceforge.net/p/xca/bugs/82/ ?

Discussion

  • I'll create a new release now, containing this and other small fixes

     
  • dvo
    dvo
    2013-11-21

    Excellent - when/where is it going to be available?

    If you ever succeeded compiling XCA natively under Windows, how to do it?

     
  • Your first comment indicates that you did not use the 0.9.3 sources.
    OPENSC_DIR is not needed anymore. If you cloned the git repository, please use the "release.0.9.x" branch.
    In the past, It ried to compile it under windows, but never succeeded.
    I tried cross-compiling it on linux right now and it worked after fixing the openssl download URL (+www.)
    Please read "INSTALL.w32" and use the build-w32.sh script

     
  • dvo
    dvo
    2013-11-21

    Thanks a lot Chris for your hints.
    Now I've been able to cross-compile xca for Windows!
    In particular, using the "release.0.9.x" branch was crucial.

    I suggest adding two more hints:

    • "qt" must point to the directory with the version number, e.g., "4.8.5" (not the actual Qt directory containing, e.g., "lib").
    • "wine" must be installed.

    Concerning the native Windows build, even with the latest source I still get the runtime error as mentioned before. Just in case anyone wants to try himself, this is what I did:

    install cygwin (32bit) including make, mingw-gcc-g++, libtool, pkg-config, zlib
    install OpenSSL static libraries to /usr/lib

    In the Cygwin shell, execute:

    export QTDIR=/cygdrive/c/Qt/4.8.5
    ln -s /usr/include/openssl /usr/i686-pc-mingw32/sys-root/mingw/include/
    ln -s /usr/share/libtool/libltdl/ltdl.h /usr/i686-pc-mingw32/sys-root/mingw/include/
    ln -s /usr/share/libtool/libltdl/libltdl /usr/i686-pc-mingw32/sys-root/mingw/include/
    
    ./configure
    

    (or:

    export INSTALL_DIR=/usr
    ln -s $INSTALL_DIR/lib/{libcrypto.a,libeay32.a}
    ./configure.w32
    

    )

    Changes I made to Local.mak:

    CC=i686-pc-mingw32-gcc
    

    (or:

    CROSS=i686-pc-mingw32-
    

    and remove any -mno-cygwin option from CFLAGS
    )

    LDFLAGS=-L/usr/lib
    LIBS=-lstdc++ -lQtGui4  -lQtCore4 -lcrypto -lltdl -lws2_32
    

    Then execute "make".

     
  • Is "wine" really needed for compiling ? I don't think so.
    Please tell me where the dependency is.

    You only need "wine" for testing the windows binary on linux.

     
  • dvo
    dvo
    2013-11-21

    You should know better than me ;-)
    In my installation, grepping for "wine" returns in particular:

    xca_build/Local.mak:MOC=wine $(QTDIR)/bin/moc
    xca_build/Local.mak:UIC=wine $(QTDIR)/bin/uic
    xca_build/Local.mak:RCC=wine $(QTDIR)/bin/rcc
    xca_build/Local.mak:LRELEASE=wine $(QTDIR)/bin/lrelease
    
     
  • Ah, indeed. This is a fallback if the installed linux QT version is incompatible to the windows QT version.
    And the build-w32 script forces the windows moc/uic/lrelease.
    So you are right, wine is required. You obviously know better than me :-)

     
    • status: open --> closed
     
  • I think we can close this

     
  • dvo
    dvo
    2014-11-24

    Have you taken over my comments/hints into the xca documentation?