Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Project using libarchive on Windows



  • Hi,

    I am a Linux user but have to get a project (which works on Linux) running on Windows 10 using libarchive and I am a bit lost.
    Kits available: Qt5.9.9 MSVC 2017 64 bit or Qt5.9.9 MinGW 32bit
    I'm not 100% sure that I have installed libarchive correctly (not sure which type of installation I should be running, binary, developer???) Some advice on that would be great.. just put it in Program Files dir?

    In Qt Creator I have done an "Add Library" on the project and added an External Library (undecided as weather to use dynamic or static yet... )which gave me this:

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/'../ProgramFiles(x86)/libarchive-2.4.12-1-bin/lib/' -llibarchive.dll
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/'../ProgramFiles(x86)/libarchive-2.4.12-1-bin/lib/' -llibarchive.dlld
    else:unix:!macx: LIBS += -L$$PWD/'../ProgramFiles(x86)/libarchive-2.4.12-1-bin/lib/' -llibarchive.dll
    
    INCLUDEPATH += $$PWD/'../ProgramFiles(x86)/libarchive-2.4.12-1-bin/include'
    DEPENDPATH += $$PWD/'../ProgramFiles(x86)/libarchive-2.4.12-1-bin/include'
    

    I also have:

    INCLUDEPATH += C:\DevTools\ProgramFiles(x86)\libarchive-v3.4.3-win64\libarchive\include
    

    if fails on the -llibarchive.dlld as it doesn't exist... if I remove then I get the following error:

    C:\X\DBuilder\archiver.cpp:123: error: undefined reference to `archive_write_free'
    

    I have archive.h and archive_entry.h defined at the top of the file that uses the archive_write_free command...

    #include <archive.h>
    #include <archive_entry.h>
    

    adding full path here doesn't made any difference.

    Can't seem to get past this and wondering what I have done wrong...

    Thanks in advance!!!


  • Lifetime Qt Champion

    @taraj said in Qt Project using libarchive on Windows:

    libarchive

    What compiler was used to build this library? On Windows you have to use same compiler for C++. Also, did you make sure that the path to the lib is correct (check the build log to see the actual paths).



  • I haven't used a compiler to build the libarchive. I have used the binary that is available: libarchive-v3.4.3-win64
    This is something i am unsure about, i'm not sure if i have to compile libarchive - if so, what, where, how, I found the installation instructions overwhelming and very complex (compared to linux) so went with the binary.


  • Lifetime Qt Champion

    @taraj said in Qt Project using libarchive on Windows:

    I haven't used a compiler to build the libarchive

    I didn't say that you did. But somebody did.
    From where did you download the lib?
    You also did not answer my last question.




  • Lifetime Qt Champion

    @taraj said in Qt Project using libarchive on Windows:

    fails on the -llibarchive.dlld as it doesn't exist

    Try to build in release mode.


Log in to reply