Question

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'
Was it helpful?

Solution

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.

OTHER TIPS

I had the same problem on Ubuntu 8.10, QT 4.5. I "fixed" it with the following bizarre hack:

  1. 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"

  2. Run "make" again, and it will fail again.

  3. Restore the lib directory

  4. 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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top