tags:

views:

7530

answers:

9

Hello,

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'
+2  A: 

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.

Node
Thanks, I get this now/usr/bin/ld: cannot find -lgobject-2.0collect2: ld returned 1 exit statusmake[1]: *** [test1] Error 1make[1]: Leaving directory `/home/steve/projects/qt/test1/test1'make: *** [debug] Error 2make: Leaving directory `/home/steve/projects/qt/test1/test1'Exited with code 2.
robUK
I think you have to add the libgobject-2.0 or gobject-2.0 package (Don't know the exact name of the package for Fedora.).
Node
yum install glib2-develThat worked.However, now I am getting this:/usr/bin/ld: cannot find -lSMI have tried to google but not sure what package to install.
robUK
Something like xorg-x11-devel.
Node
Hello, There is no package xorg-x11-develIs x11 - are they 2 ones? Because that is what I entered. yum install xorg-x11-develLoaded plugins: refresh-packagekitSetting up Install ProcessParsing package install argumentsNo package xorg-x11-devel available.thanks for any other advice,
robUK
I managed to install this. yum install xorg-x11-proto-develHowever, I am still getting the same error when I try and build my qt application. "cannot find -lSM"
robUK
search for 'sm' and 'session management' ( which is what libSM does ) , and install their development packages.
Kent Fredric
libsm-dev is what it is on debian.
Kent Fredric
Maybe a search at https://admin.fedoraproject.org/pkgdb/ helps.
Node
yum install libsm-devel worked. libXrender-devel, fontconfig-devel, libXext-devel. Everything worked ok after that. The website Node recommended was very good.
robUK
+5  A: 

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.

This fix works really well.
Michael B.
worked for me. I wonder why.
rupello
Yup ... worked for me too. That's freaking bizarre.
AgentLiquid
same here, and no idea why
Berschi
A: 

I had the same problem on Fedora 10. And I did with the method offerd by Ross C. To my suprise, it worked.

A: 

Sorry for my English, I'm Italian. I compile on Ubuntu 9.04 and I have the same problem. I try the method above, but it doesn't work. After I rename "../../qtsdk-2009.02/qt/lib" in "../../qtsdk-2009.02/qt/lib2", I have the following error:

/usr/bin/ld: cannot find -lQtGui collect2: ld returned 1 exit status

Then, I restore lib with the command: "mv ../../qtsdk-2009.02/qt/lib2 ../../qtsdk-2009.02/qt/lib" and I obtain the following error:

/usr/bin/ld: cannot find -lfreetype collect2: ld returned 1 exit status

Why it doesn't work? Becouse I am working with Ubuntu 9.04? Because I have the newest release of qtsdk (note: my qtsdk directory is qtsdk-2009.02 instead of qtsdk-2009.01)?

I solved my problem with help of an Ubuntu user!I had to install the freetype lib (libfreetype6-dev).On my system, I had libfreetype.so.6.3.20 but not the libfreetype.so.6.3.20. When I have installed it, my first qt project works fine!
Sorry! I mistake. I write: "On my system, I had libfreetype.so.6.3.20 but not the libfreetype.so.6.3.20" instead of: "On my system, I had libfreetype.so.6.3.20 but not libfreetype6-dev"
A: 

Install freetype1-dev libgtk2.0-dev and it will compile ok.

A: 

Hi,

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

Ask questions as questions, not answers.
Welbog
A: 

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

A: 

Hi guys, 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.

electroweak
A: 

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!