Libxml2 with Qt project under wine



  • Hello, I am trying to include libxml from http://xmlsoft.org/downloads.html here, and use it in my qt project, I`ve placed the folder of libxml2 in my wine drive then in qt project I did:
    @
    win32 {
    message("*using settings for windows")
    INCLUDEPATH += "Z:\home\ilian\.wine\drive_c\Qt\Qt5.3.1\Tools\mingw482_32\i686-w64-mingw32\include"
    "Z:\home\ilian\.wine\drive_c\libxml2\include\libxml"

    LIBS += -L "Z:\\home\\ilian\\.wine\\drive_c\\Qt/Qt5.3.1\\Tools\\mingw482_32\\i686-w64-mingw32\\include\\windows.h" \
    "Z:\\home\\ilian\\.wine\\drive_c\\libxml2\\include\\libxml\\xmlversion.h" \
    "Z:\\home\\ilian\\.wine\\drive_c\\libxml2\\include\\libxml\\xmlexports.h" \
    "Z:\\home\\ilian\\.wine\\drive_c\\libxml2\\include\\libxml\\xmlreader.h" \
    "Z:\\home\\ilian\\.wine\\drive_c\\libxml2\\include\\libxml\\tree.h" \
    

    @

    It does not work the error is:
    @
    Z:\home\ilian.wine\drive_c\libxml2\include\libxml\xmlversion.h:13: error: libxml/xmlexports.h: No such file or directory
    #include <libxml/xmlexports.h>
    ^
    Z:\home\ilian.wine\drive_c\libxml2\include\libxml\xmlreader.h:13: error: libxml/xmlversion.h: No such file or directory
    #include <libxml/xmlversion.h>
    ^
    Z:\home\ilian.wine\drive_c\libxml2\include\libxml\tree.h:16: error: libxml/xmlversion.h: No such file or directory
    #include <libxml/xmlversion.h>
    ^
    @

    Can you tell me how to fix it?


  • Lifetime Qt Champion

    Hi,

    Just remove libxml from "Z:\home\ilian\.wine\drive_c\libxml2\include\libxml"

    Also your LIBS line doesn't make sense. -L is to tell the linker where to look to find libraries so it should be followed by a folder.

    Note that with Qt you can (and should) use only forward slashes for path even on windows.



  • Forward slashes... I noticed it but now that you mention, I`ll take note. I am learning Qt on the fly while working so I am treating myself as a noob yet :)
    [quote author="SGaist" date="1412848291"]Hi,

    Just remove libxml from "Z:\home\ilian\.wine\drive_c\libxml2\include\libxml"

    Also your LIBS line doesn't make sense. -L is to tell the linker where to look to find libraries so it should be followed by a folder.

    Note that with Qt you can (and should) use only forward slashes for path even on windows.[/quote]


  • Lifetime Qt Champion

    Did you got the rest working ?



  • It`s perfect for linux compile/run but for windows I still get the undefined references. Here is the .pro file:
    @
    win32 {
    message("*using settings for windows")
    INCLUDEPATH += "Z:\home\ilian\.wine\drive_c\Qt\Qt5.3.1\Tools\mingw482_32\i686-w64-mingw32\include"
    INCLUDEPATH += "Z:\home\ilian\.wine\drive_c\libxml2\include"
    }
    @

    I know about the slashes, I just keep these because the INCLUDEPATH for mingw... windows.h is working ( the first one ).

    The file I am using libxml is as follows ( it`s small so I am c/p the whole):
    @
    #ifndef XMLTEST_H
    #define XMLTEST_H
    #ifdef gnu_linux
    #include <libxml2/libxml/parser.h>
    #include <libxml2/libxml/tree.h>
    #include <libxml2/libxml/xmlversion.h>
    #include <libxml2/libxml/xmlexports.h>
    #include <libxml2/libxml/xmlreader.h>
    #include <stdio.h>
    #else
    #include <libxml2/include/libxml/parser.h>
    #include <libxml2/include/libxml/tree.h>
    #include <libxml2/include/libxml/xmlversion.h>
    #include <libxml2/include/libxml/xmlexports.h>
    #include <libxml2/include/libxml/xmlreader.h>
    #include <stdio.h>
    #endif

    #include "DList.h"
    /* read the XML file from args then return it as DList,
    call DList passToDaemonArgvs() to return char** /
    DList
    main_xml(int, char**);

    void parseDirectoryAddToList(DList*, xmlDocPtr, xmlNodePtr);

    #endif // XMLTEST_H
    @
    Still can`t get why this is not working... the windows.h was success including and building, but libxml?

    [quote author="SGaist" date="1412980151"]Did you got the rest working ?[/quote]


  • Lifetime Qt Champion

    From your win32 scope I don't see anywhere where you give the path to find the libxml2 libraries.
    You need to add something like

    @LIBS += -L/Path/to/where/libxml2/windows/libfiles/can/be/found@

    or using double backslashes


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.