In my Android native project, I need to use some core Qt functionality. Following the instructions at http://qt-project.org/wiki/Qt5ForAndroidBuilding, I managed to build Qt for Android. I can see that all the generated archive files are stored in qtbase/lib directory.
I am linking my C++ code with libQt5Core.a, libQt5Bootstrap.a, and libqtpcre.a. Almost all of my Qt references are resolved exception two non-qt references - compress() and uncompress(). I have searched for these symbols in qtbase/lib/*.a files but haven't found any definition.
So where are these two functions defined? Are they in one of the standard NDK libraries or do I need to build something separately?
It seems qbytearray.cpp is using these two functions. It seems these functions are defined if QT_NO_COMPRESS is not defined. Looks like I could get away with the unresolved errors if I could somehow define QT_NO_COMPRESS. How do I define this? Do I pass it to configure script?
$ ./configure -DQT_NO_COMPRESS ...
Hoping I could simply find references to the missing functions. Otherwise, please advice on how to achieve the second option. Regards.
It turns out zlib is already part of Android NDK. All that was needed was -lz flag:
LOCAL_LDLIBS += -lz
Related
I am trying to compile the SpeechMe project: http://projects.developer.nokia.com/speechme/wiki so that I can use the voice recognition in another project I want to make.
I have followed all the instructions and downloaded the full sources of Sphinxbase and Pocketsphinx and used them to add all the missing files to the Sphinxbase and Pocketsphinx directories included in SpeechMe. I have compiled them all in the order the wiki says and they all returned: "***Build Complete" but it seems that they did not produce any output files?
I then tried compiling SpeechMe in Qt Creator but it gives me these three errors:
Here is the build log for all configurations: http://sdrv.ms/PxlD6r
Please help, I really don't understand why this is not working!
I'm guessing Carbide should have created those 3 files when compiling but it didn't, any ideas why and what I can do to fix it?
Files must be created inside pocketsphinx tree but they shouldn't be placed in the required location. Most likely you need to find library files and put them into the required folder manually.
Another reason might be that you are compiled a debug version of pocketsphinx while the latest project is looking for a release version of the libraries.
I have followed the instructions on http://doc.qt.nokia.com/stable/sql-driver.html#qibase for compiling Interbase support into Qt, and made sure all of my libraries are in the right place. qmake runs successfully, but when I run nmake, I get a series of undefined reference errors in qsql_ibase.cpp. If I open up the .pro in Qt Creator and hover over one of the functions that is throwing the undefined reference errors and follow the symbol (F2), it takes me to the ibase.h file where it is declared. Is it throwing the undefined reference errors because there is no function definition? If that is the case, why isn't it giving me any errors about a missing library?
Output example:
Creating library file: debug\libqsqlibased4.a
debug/qsql_ibase.o: In function getIBaseError':
C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../../sql/drivers/ibase
/qsql_ibase.cpp:80: undefined reference toisc_sqlcode'
C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../../sql/drivers/ibase
/qsql_ibase.cpp:85: undefined reference to isc_interprete'
debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../.
./sql/drivers/ibase/qsql_ibase.cpp:406: undefined reference toisc_dsql_free_st
atement'
debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../.
./sql/drivers/ibase/qsql_ibase.cpp:421: undefined reference to isc_create_blob2
'
debug/qsql_ibase.o:C:\QtSDK\QtSources\4.7.4\src\plugins\sqldrivers\ibase/../../.
./sql/drivers/ibase/qsql_ibase.cpp:427: undefined reference toisc_put_segment'
This continues for many more errors, all undefined references.
That really sounds like the first issue mentioned under the "Troubleshooting" section of the page to which you link above:
You should always use client libraries that have been compiled with
the same compiler as you are using for your project. If you cannot get
a source distibution to compile the client libraries yourself, you
must make sure that the pre-compiled library is compatible with your
compiler, otherwise you will get a lot of "undefined symbols" errors.
Some compilers have tools to convert libraries, e.g. Borland ships the
tool COFF2OMF.EXE to convert libraries that have been generated with
Microsoft Visual C++.
Which compiler are you using to compile Qt, and where did you get the Interbase libraries? You also need to make sure those libraries can be found at link time. If you look at the output of your compiler, it should show you all the link directories in which it is searching (in addition to any globally defined, like PATH in Windows.) If the folder with your Interbase library is listed, it is probably that the compiler versions aren't matching.
Sorry for raising so old theme, but I found a solution and want to share with it. The problem is that macro ISC_EXPORT was not defined in Interbase's SDK due to conditional compilation defines. See details here - Howto build Interbase plugin for Qt by MinGW
I am trying to build a simple Qt app with the VTK libraries included, but I am getting a link error:
The Reg....A functions are unresolved (like RegOpenKeyExA) referenced
from vtksys.lib.
I think that I have Advapi32.lib linked.
Am I supposed to specify ASCII in the build somehow or is a library missing or what?
What does your CMakeLists.txt look like? You should have a line like:
target_link_libraries(YourProgram QVTK ${VTK_LIBRARIES})
What is your compiler used to build VTK? And Qt? Are them identical? It seems most linked problems between Qt and VTK are due to mismatching library files.
I am trying to compile QT for ARM.
But the linker requires "--sysroot" option to be added for linking files.
So in qmake.conf file, we added under QMAKE_LFLAGS.
But when we compile, its adding this even for initial tools build on the x86 PC. So gcc complains and gives error.
The cross compiler tool chain which doesnt have a .pc file.
Please let me know where to add the "--sysroot" so that this is added only when it tries to cross compile.
Thanks.
Hari
You can do this using qmake scopes - specifically platform scope variables. To ensure that -sysroot is only evaluated for your ARM builds you can do something like this:
arm-linux: {
QMAKE_LFLAGS += --sysroot
}
You may need to change the scope, depending on the platform you're actually targetting.
I am developing a Windows (7) application using Qt (4.7.0) to call some methods in a DLL (NI visa32.dll) to communicate with instruments through the GPIB port. The manufacturer's header file is also available (visa.h).
In the project file, I tried adding the path and library reference to the original places where the files are located at as:
INCLUDEPATH += "C:/Program Files/National Instruments/Shared/CVI/Include"
LIBS += "C:/Windows/System32/visa32.dll"
but, I get the compilation error:
collect2: ld returned 1 exit status
Following the instructions in Importing a DLL into Qt, I created a "visa.a" from the "visa32.dll", and copied them to a subfolder "visa/lib", and added the path and library to the project file:
INCLUDEPATH += visa/include
LIBS += -Lvisa/lib
LIBS += -lvisa.a
I tried also with -lvisa or -lvisa.dll, but in all the cases I get also another compilation error saying that the -lvisa, -lvisa.a or -lvisa.dll is not found. I edited the original header file "visa.h", and prefixed with Q_DECL_IMPORT every object in the file, and also made sure that the extern "C" statement be present.
I include the reference to the header file in the application as:
#include "visa.h"
and note that the compiler does recognize the referenced objects belonging to the visa.h file.
Any help to solve this compilation error will be greatly appreciated.
I also tried with Visual C++ (2010) following the instructions of DLL References in Visual C++. In this case, I do not get any compilation error, but linking errors. For example:
AgiE364X.obj: error LNK2019: unresolved external symbol
"extern "C" long __stdcall viClose(unsigned long)"
being viClose a called method in NI-VISA.
I would prefer to use Qt C++ instead of Visual C++, though.
Thanks in advance.
I'm not sure since I'm new to Qt myself but here are some guesses: I noticed you have a space in INCLUDEPATH string. Also, LIBS += -Lvisa/lib has a capitol L (is this correct?). I'm not saying this is your problem but perhaps worth a try. The last thing that comes to mind is that if you're using Qt Creator only partially type #include "visa.h" and see if auto complete can complete it for you. If it can, than prob the rest is OK. Trigger auto-complete with Ctrl+Space. I've noticed that when I mess up the paths auto-complete is a good gauge for this sort of thing.
There are two types of library of VISA provided by NI: the one is compiled by borland c++, the other is compiled by microsoft vc++.
As for Qt, you can use Qt which should be compiled by MSVC, to link the visa32.lib which is compiled by MSVC too. And it MUST link .lib instead of .dll, The MSVC library of VISA is in "C:\Program Files\IVI Foundation\VISA\WinNT\lib\msc" by default.
The include directory is C:\Program Files\IVI Foundation\VISA\WinNT\include by default.
In fact, the above information can be known from VISA example after you install the device driver.