Error while building Qt Creator Plugin - qt

I tried to create Qt Creator Plugin by following https://doc-snapshots.qt.io/qtcreator-extending/first-plugin.html , but I failed to build with a link error
ld: library not found for -lCore_debug
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [../qt5/build_creator/bin/Qt Creator.app/Contents/PlugIns/libMyPlugin_debug.dylib] Error 1
21:58:13: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project myplugin (kit: Qt 5.5.0 (clang_64))
When executing step "Make"
Please anybody let me know what's wrong with me.
Thanks,

I solved it by deleting _debug keyword in {my plugin project}/qtcreatorplugin/qtcreator.pri
I think it is a bug because we don't need to *_debug library to debug own plugin. But I am not sure my solution don't happen any other problems.
Anyway, I was able to build and run on debug mode.

Related

Xamarin: Native linking error in fresh installation

Recently I moved my project to a fresh installation of macOS. I installed Xcode, Visual Studio Mac and Xamarin.iOS, then I retrieved the last build of the project from git server. My configuration is as follows:
macOS Mojave 10.14
Xcode 10.1
Visual Studio for Mac 7.6
Xamarin.iOS 12.2
My problem is that the project no longer builds. I keep getting native linking errors, the build output can be seen below:
/Users/u/Projects/appname/clang: Error: linker command failed with
exit code 1 (use -v to see invocation) (prj)
/Users/u/Projects/appname/error MT5209: Error: warning: directory not
found for option '-FFInstncID-3.2.1/Frameworks' (prj) Native linking
/Users/u/Projects/appname/error MT5209: Error: warning: directory not
found for option '-FFAnlytcs-5.1.4/Frameworks' (prj) Native linking
/Users/u/Projects/appname/error MT5209: Error: warning: directory not
found for option '-FFAnlytcs-5.1.4/Frameworks' (prj) Native linking
/Users/u/Projects/appname/error MT5209: Error: warning: directory not
found for option '-FGAppM-5.1.4/Frameworks' (prj) Native linking
/Users/u/Projects/appname/error MT5209: Error: framework not found
FirebaseInstanceID (prj) Native linking
/Users/u/Projects/appname/MTOUCH: Error MT5201: Native linking failed.
Please review the build log and the user flags provided to gcc: -ObjC
-ObjC -lc++ -lsqlite3 -lz -ObjC -lc++ -lsqlite3 -lz (MT5201) (prj) /Users/u/Projects/appname/MTOUCH: Error MT5202: Native linking failed.
Please review the build log. (MT5202) (prj)
The problem seems to be related to Firebase packages, but I cannot figure out how. Do you have any suggestions?

Qt error: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../libGL.so when searching for -lGL

Qt 5.7.0 GCC 4.9.1
I created a simple widget project (no single code written, no settings changed, only drag a few controls to the form) right after installing Qt and did a test compile. I got error messages:
:-1: error: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../libGL.so when searching for -lGL
:-1: error: skipping incompatible /lib/libGL.so when searching for -lGL
:-1: error: skipping incompatible /usr/lib/libGL.so when searching for -lGL
:-1: error: cannot find -lGL
:-1: error: collect2: error: ld returned 1 exit status
I reckon that it was trying to link to the 32 bit OpenGL in my 64 bit machine. /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../libGL.so is indeed located in /usr/lib/libGL. The 64 bit version, I think, is the one in /usr/lib64/libGL. How can I change the linking path so that it will link to the right library?
This seems like you are missing libraries needed to compile 32-bit binaries.
Try running:
sudo yum install glibc-devel.i686 libgcc.i686 libstdc++-devel.i686
this is how I solved this problem.
locate libGL.so and find the right 64 bit version (I used the latest);
create a link in the Qt lib path: ln -s /usr/lib64/libGL.so.352.79 ~/Qt/5.7/gcc_64/lib/libGL.so

How to compile QT examples with QT creator and visual studio 2012 compiler?

I used the following configure options and commands to build qt5.5:
configure -developer-build -opensource -confirm-license -platform win32-msvc2013 -opengl desktop -nomake examples -nomake tests
nmake
QT is built successfully. After this, I installed QT creator 3.4.0 beta and configured qmake for qt5.5 and using Microsoft Visual studio C++ compiler 12.0 . Now when i try to build the qt3D examples using the QT creator, I am getting the following compile errors:
cpp.exe.2968.1625.jom
qtmain.lib(qtmain_win.obj) : error LNK2019: unresolved external symbol __imp__CommandLineToArgvW#8 referenced in function _WinMain#16
release\cylinder-cpp.exe : fatal error LNK1120: 1 unresolved externals
jom: C:\qt5.5\build-qt3d-Desktop-Release\examples\cylinder-cpp\Makefile.Release [release\cylinder-cpp.exe] Error 1120
jom: C:\qt5.5\build-qt3d-Desktop-Release\examples\cylinder-cpp\Makefile [release] Error 2
12:57:27: The process "C:\Qt\qtcreator-3.3.81\bin\jom.exe" exited with code 2.
Error while building/deploying project qt3d (kit: Desktop)
When executing step "Make"
12:57:27: Elapsed time: 00:03.
I understand that this error is because of winmain function missing which is required by visual studio compiler for any windows applications, However how does qt take care of it? What are the header files to be included to avoid this error for qt examples?
Please help me with your suggstions and let me know if I am missing any steps also.
I had a similar problem - I fixed it by linking Shell32.lib. See this discussion compilation of qt5.5 examples with qt creator with visual studio 2012 (msvc2012) fails for details.

Qt error cannot find -lQtCored collect2: ld returned 1 exit status

I am getting the following error, when I run programs in debug mode.
cannot find -lQtCored
collect2: ld returned 1 exit status
I can run programs normally in release mode. Is it because I have done static linking (I can run my executable without Qt Creator)?
I am using Qt Creator with Qt 4.7.0 on Windows.
The following command would solve this issue:
sudo apt-get install libglu1-mesa-dev
Your linker can not see debug library of QtCore (as shown - -lQtCored, release lib - -lQtCore).
You need checked, really you build this debug library or not, then checked all pathes to this debug library.
PS. Yes, you can run executable without Qt-Creator. You should use qmake (into directory with your .pro) and make (when your qmake has generate Makefile).
PSS. If you want to run .exe then you should put some Qt libraries into directory with .exe.

/usr/bin/ld: cannot find -lfreetype qt

Compiling on Fedora 10.
I am using qt for the first time. I started by creating a simple GUI application with all the default settings. When I tried to build the project I got the following error messages.
However, when I did a search for -lfreetype I found it in the following directory.
/usr/lib/libfreetype.so.6
/usr/lib/libfreetype.so.6.3.18
Is there anyway to resolve this issue?
Many thanks for any advice
Running build steps for project test1...
Creating gdb macros library...
Configuration unchanged, skipping QMake step.
Starting: /usr/bin/make debug -w
make: Entering directory `/home/steve/projects/qt/test1/test1'
/usr/bin/make -f Makefile.Debug
make[1]: Entering directory `/home/steve/projects/qt/test1/test1'
g++ -Wl,-rpath,/opt/qtsdk-2009.01/qt/lib -o test1 debug/main.o
debug/mainwindow.o debug/moc_mainwindow.o
-L/opt/qtsdk-2009.01/qt/lib
-lQtGui -L/opt/qtsdk-2009.01/qt/lib -L/usr/X11R6/lib
-pthread -lfreetype
-lgobject-2.0 -lSM -lICE -pthread -pthread
-lXrender -lfontconfig
-lXext -lX11 -lQtCore -lm -pthread -lgthread-2.0 -lrt
-lglib-2.0 -ldl -lpthread
/usr/bin/ld: cannot find -lfreetype
collect2: ld returned 1 exit status
make[1]: *** [test1] Error 1
make[1]: Leaving directory `/home/steve/projects/qt/test1/test1'
make: *** [debug] Error 2
make: Leaving directory `/home/steve/projects/qt/test1/test1'
Exited with code 2.
Error while building project test1
When executing build step 'Make'
You have to install the freetype-devel package. The devel package contains the header files which in the case of freetype shoud be located at: /usr/include/freetype.
I had the same problem on Ubuntu 8.10, QT 4.5. I "fixed" it with the following bizarre hack:
After the build fails, rename the QT lib directory to something else - e.g. "mv ../../qtsdk-2009.01/qt/lib ../../qtsdk-2009.01/qt/lib2"
Run "make" again, and it will fail again.
Restore the lib directory
Run "make" again, and now it works.
I have no idea why this happens.
Install freetype1-dev libgtk2.0-dev
and it will compile ok.
On Ubuntu 9.04, installing freetype1-dev & libgtk2.0-dev solves this problem.
But to surprise everyone the hack mentioned by Ross also works, I would really like to know how and why.. M looking into the source code of QTcreator to see if i can find out the reason why. If any one already know the reason, please let me know.
Thanks..
Just installed a newly fresh ubuntu 9.04 (dell D820)- installed qt creator nothing else - same problem
use option from S R that works because it needs libgtk2.0-dev (this will also load freetype6 ) installed from package manager.
Same effect you will see if you also install qt designer from package manager (it will install all the right packages
regards
Nico
I had same problems with Elive, freetype1-dev and libgtk2.0-dev and for the /usr/bin/ld: cannot find -lSM thing xorg-dev fixed the problem.
The first thing you have to make sure is that you have libfreetype.so installed in your computer. Use the command 'locate libfreetype.so', and you may find there is a '/usr/lib/libfreetype.so.6' in the result. The compile software can't identify libfreetype.so.6 as a shared library, so, you have to make a symbolic link to the target. Use the command 'ln -s /usr/lib/libfreetype.so.6 /usr/lib/libfreetype.so', when you compile the program again, you will find the error had gone. You can also solve the errors likely. Good Luck!

Resources