0

I need to build some DLLs using Qt 5, but I must be doing something wrong since the program that needs it isnt working. I know there is something wrong because when I run the dependency walker on any of the builded dlls, it says there are wrong linkings or that it cannot find certain DLLs:

enter image description here

I believe it is because some things are in x64bits while others in x32bits. I am working on a 64bits platform, but I am trying to build a 32bits application with 32bits DLLs. I use 32bits mingw compiler, 32bits Qt version, 32bits everything but OS. To be honest Im rather newbie on this and Im somewhat lost, could someone point me in the right direction? Whats wrong with my compiling?

This is the .pro file of the shown DLL:

TEMPLATE = lib
TARGET = QENC
DESTDIR = ../release
QT += core gui widgets
CONFIG += release
DEFINES += QENC_LIB QT_DLL
INCLUDEPATH += ./GeneratedFiles \
    ./GeneratedFiles/Release \
    . \
    ../../../proj-4.8.0/src
DEPENDPATH += .
MOC_DIR += ./GeneratedFiles/release
DLLDESTDIR += release
OBJECTS_DIR += release
UI_DIR += ./GeneratedFiles
RCC_DIR += ./GeneratedFiles
include(QENC.pri)

PS: I even get errors in the QtCored.dll and other DLLs that Qt installs :S it might be nothing or it could be the source of the error.

Community
  • 1
  • 1
Victor
  • 907
  • 2
  • 17
  • 42
  • Can you post your pro file - the issue might be in there. – Amarghosh May 13 '14 at 06:41
  • @Amarghosh Done! Although I dont know if that would be the problem, as some of the DLLs are sources downloaded from the internet and they do work for other people. – Victor May 13 '14 at 06:43
  • For the missing dll files, make sure that their path is specified in LIBS variable as `LIBS += -Wl,--rpath,/path/to/downloaded-dlls` (or its windows equivalent). Or you can use windows equivalent of `LD_LIBRARY_PATH`. If the different-cpu-type error is seen on downloaded dlls, you might want to download the correct files for your platform (others might be on a different version of OS or CPU). – Amarghosh May 13 '14 at 06:54
  • 1
    I think there is nothing wrong on your side. [Dependency walker is just not able to find the dlls](http://stackoverflow.com/a/12373522/33499). – wimh May 13 '14 at 06:55

1 Answers1

2

Things to check when deploying on Windows:

  1. Built in release mode - in PRO file you have CONFIG += release so this should be okay, you may also want to add a CONFIG -= debug debug_and_release line, just to be sure

  2. If using MSVC - Linked against the release version of the C library (/MD) not debug (/MDd)

  3. You are deploying the release version of Qt DLLs (QtCore4.dll) not debug with a d at the end (QtCored4.dll)

  4. You are deploying the correct DLLs for your compiler - the Qt that comes with GCC included will have two versions of the DLLs, ones built with GCC that your program will link against, and ones built with MSVC that the pre-built tools (like qmake) will link against.

  5. If using MSVC, that you have all service packs and updates installed, and that the MSVC re-distributable you ship matches the compiler exactly.

This is quite tricky to get correct, if I've missed something, let me know.

Silas Parker
  • 8,017
  • 1
  • 28
  • 43
  • I am indeed having problems with MSVC, although its when running the main program (I think I am building the libraries alright), could you have a look at this and see what could be wrong? http://stackoverflow.com/questions/23539820/disassembler-failed-cannot-access-memory-at-address-0x773dfff9-qt-debugging it has a bounty! – Victor May 14 '14 at 07:05