PDA

View Full Version : DLL linking problem after putting winavr on path



binyul
13th March 2013, 17:50
I have a fully working application compiled using qt 5.0 and it uses fftw and qwtplot Dlls.
I also have to work with the winavr for my project.
However once i add winavr folder to path, qt shows error like D:DDocumentsQtIPtest-build-Desktop_Qt_5_0_1_MinGW_32bit-Releasereleaselibfftw3-3.dll: No such file or directory.
I mean where are all the / i had given between each word.
I checked and found out my console qt application are working fine though.
Is it qt problem or winavr?
If it is winavr's problem, why does the console application works perfectly??
Please help me..

amleto
13th March 2013, 21:05
show pro file

binyul
14th March 2013, 00:42
QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = "Bin Mini PS"
TEMPLATE = app

SOURCES += main.cpp\
mainwindow.cpp \
spatial.cpp \
frequency.cpp \
SegmentationNothers.cpp

HEADERS += mainwindow.h
INCLUDEPATH += C:\Qwt\include
FORMS += mainwindow.ui

INCLUDEPATH += C:\Qwt-6.1.0-rc3\include
#LIBS += C:\Qwt-6.1.0-rc3\lib\qwtd.dll
INCLUDEPATH += C:\fftw-3.3.3-dll32
LIBS += D:\DDocuments\Qt\IP\test-build-Desktop_Qt_5_0_1_MinGW_32bit-Release\release\libfftw3-3.dll
LIBS += D:\DDocuments\Qt\IP\test-build-Desktop_Qt_5_0_1_MinGW_32bit-Release\release\qwt.dll

OTHER_FILES += \
iconw.rc
RC_FILE = iconw.rc

This is my pro file .am i doing something wrong??
The dlls are in release folder..

wysota
14th March 2013, 02:27
Do you have all the libraries you use (e.g. qwt, fftw) built with this compiler?

binyul
14th March 2013, 05:52
Yes i build them on qt command prompt

amleto
16th March 2013, 00:30
change \ for / (just guessing)

binyul
16th March 2013, 13:01
hi amleto,
i have tried using / and double \ ie D:\\DDocuments\\.. both..
But no luck.
For now i am removing avr-gcc from path to compile desktop app.
and again putting it to path for burning avr..
It would have not been a problem if programmer's notepad (IDE for Winavr) could use avrgcc and avrdude without adding them to path
just like qtcreator does without adding its exes to path..

f8eho
7th April 2013, 12:22
Hi,

I had a similar problem when making qwt dll. So i made some debug and found the the ld parameters where with backslashes (-L parameter). I found that the winavr sh.exe shell was used by the toolchain and the link cmd line was (notice backslashes in :-LC:\Qt\Q...)
echo linking ../lib/qwtd.dll && g++ -shared -mthreads -Wl,--out-implib,C:/MinGW-Lib/qwt-6.1-rc3/src/../lib/libqwtd.a -o ../lib/qwtd.dll object_script.qwtd.Debug -LC:\Qt\Qt5.0.1\5.0.1\mingw47_32\lib -lQt5OpenGLd -lQt5Svgd -lQt5PrintSupportd -lQt5Widgetsd -lQt5Concurrentd -lQt5Guid -lQt5Cored -llibEGLd -llibGLESv2d -lgdi32 -luser32
this produce the following errors :
linking ../lib/qwtd.dll
c:/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5OpenGLd
c:/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Svgd
c:/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5PrintSupportd
c:/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Widgetsd
c:/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Concurrentd
c:/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Guid
c:/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lQt5Cored
c:/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibEGLd
c:/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llibGLESv2d
collect2.exe: error: ld returned 1 exit status

So, i tried manualy running the same command with C:\WinAVR\utils\bin\sh.exe but replacing the backslashes with slashes, and it worked...
The problem is, when qmake detects a sh.exe, it tries to use it in the toolchain, but this winavr sh.exe does not like backslashes. I didn't try the MSYS shell.
I found the following in qmake.conf (c:\Qt\Qt5.0.1\5.0.1\mingw47_32\mkspecs\win32-g++\qmake.conf):

!isEmpty(QMAKE_SH) {
MINGW_IN_SHELL = 1
QMAKE_DIR_SEP = /
include(../common/shell-unix.conf)
} else {
include(../common/shell-win32.conf)
}

and in spec_pre.prf (c:\Qt\Qt5.0.1\5.0.1\mingw47_32\mkspecs\features\s pec_pre.prf) :

equals(QMAKE_HOST.os, Windows) {
QMAKE_EXT_OBJ = .obj
QMAKE_EXT_RES = .res
QMAKE_SH =
PATH = $$(PATH)
PATH = $$split(PATH, ;)
for(dir, PATH) {
exists($$dir/sh.exe) {
QMAKE_SH = $$dir/sh.exe
break()
}
}
unset(PATH)
} else {
QMAKE_EXT_CPP += .C
QMAKE_EXT_H += .H
QMAKE_EXT_OBJ = .o
QMAKE_SH = sh
}

You comment these some lines to force qmake to use the windows shell, not the winavr shell, but it won't work, because mingw32-make also search for a shell, on my case it finds :
find_and_set_shell() path search set default_shell = C:/WinAVR/utils/bin/sh.exe (from trace file , mingw32-make -d --trace > file)
So, the easy solution is to temporarily remove winavr from path.... it works, i finaly managed to have qwt.dll and qwt.a compiled...

I think (I am new to Qt, trying to move from BC++ to Qt) that the problem is within the Qt environment, perhaps in the c:\Users\......\AppData\Roaming\QtProject\qtcreato r\toolchains.xml or profiles.xml, where the pathes are stored with backslashes for the mingw conf. I tried to edit these files, but QtCreator put backslashes again each time i run it....).
.