newbie qmake issue - multi threading package?
I really have two issues here but I think they both are symptoms of the same problem so I've stuck them both in the same message here. I'm trying to compile the famous 'hello world' program. The first issue I'm running into is tellng qmake the location of qapplication.h or any include files at all. I have QTDIR set, as well as the appropriate entry in ld.so.conf but it still cannot find those files unless I include the complete path in the #include entry. Then I run into the second issue. When compiling I get this error: .../bin/ld: cannot find -lqt-mt collect2: ld returned 1 exit status make: *** [hello_world] Error 1 My googling has led me to believe that I need to install the qt-mt package (or something along those lines) but I have been unable to find any such package. I'm using suse 9.0 and qt is installed from the suse 9.0 packages, NOT from sources. Any hint is appreciated. -- Allen Seelye Alleninmt@yahoo.com A Linux user since 1999. --------------- "It's a trick, get an axe."
Allen Seelye wrote:
I really have two issues here but I think they both are symptoms of the same problem so I've stuck them both in the same message here.
I'm trying to compile the famous 'hello world' program. The first issue I'm running into is tellng qmake the location of qapplication.h or any include files at all. I have QTDIR set, as well as the appropriate entry in ld.so.conf but it still cannot find those files unless I include the complete path in the #include entry.
Then I run into the second issue. When compiling I get this error:
.../bin/ld: cannot find -lqt-mt collect2: ld returned 1 exit status make: *** [hello_world] Error 1
My googling has led me to believe that I need to install the qt-mt package (or something along those lines) but I have been unable to find any such package.
I'm using suse 9.0 and qt is installed from the suse 9.0 packages, NOT from sources.
Any hint is appreciated.
Is this one of the qt examples????? If so did you compile it in example dir???? What is in the *.pro file???? Had some trouble with qt-3.3.1-beta-mac..... It really didn't like being out the qt examples dir. Stefan.
Is this one of the qt examples?????
No, I copied the code from the tutorial on trolltech's website.
What is in the *.pro file????
###################################################################### # Automatically generated by qmake (1.06c) Fri Mar 5 09:02:57 2004 ###################################################################### TEMPLATE = app CONFIG -= moc INCLUDEPATH += $QTDIR/include # Input SOURCES += main.cpp This actually solved the first part of my problem with make not finding the include files. The INCLUDEPATH entry here originally was blank. I set it to $QTDIR/include and that part of the issue went away. I never bothered to look in the .pro file. I just assumed that qmake set it up correctly for me. Many thanks. Still at a loss about telling it where to find libqt-mt.so. It's where it's supposed to be in /usr/lib/qt3/lib and $LD_LIBRARY_PATH is pointed there but make just isn't seeing it. -- Allen Seelye Alleninmt@yahoo.com A Linux user since 1999. --------------- "It's a trick, get an axe."
Hi I think you sould add the following to the project file CONFIG += qt thread release then delete the makefile and rerun qmake. It worked for me ... Zsolt Allen Seelye wrote:
Is this one of the qt examples?????
No, I copied the code from the tutorial on trolltech's website.
What is in the *.pro file????
###################################################################### # Automatically generated by qmake (1.06c) Fri Mar 5 09:02:57 2004 ######################################################################
TEMPLATE = app CONFIG -= moc INCLUDEPATH += $QTDIR/include
# Input SOURCES += main.cpp
This actually solved the first part of my problem with make not finding the include files. The INCLUDEPATH entry here originally was blank. I set it to $QTDIR/include and that part of the issue went away. I never bothered to look in the .pro file. I just assumed that qmake set it up correctly for me.
Many thanks.
Still at a loss about telling it where to find libqt-mt.so. It's where it's supposed to be in /usr/lib/qt3/lib and $LD_LIBRARY_PATH is pointed there but make just isn't seeing it.
Is this one of the qt examples?????
If so did you compile it in example dir????
What is in the *.pro file????
Had some trouble with qt-3.3.1-beta-mac..... It really didn't like being out the qt examples dir.
Stefan.
Also, here is my Makefile. Everything looks good to me but I'm not really sure what all to look for. ############################################################################# # Makefile for building: hello_world # Generated by qmake (1.06c) (Qt 3.2.1) on: Fri Mar 5 14:45:48 2004 # Project: hello_world.pro # Template: app # Command: $(QMAKE) -o Makefile hello_world.pro ############################################################################# ####### Compiler, tools and options CC = gcc CXX = g++ LEX = flex YACC = yacc CFLAGS = -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -DQT_NO_DEBUG CXXFLAGS = -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -DQT_NO_DEBUG LEXFLAGS = YACCFLAGS= -d INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -I$QTDIR/include -I/usr/include -I$(QTDIR)/include LINK = g++ LFLAGS = LIBS = $(SUBLIBS) -L/usr/lib/ -L$(QTDIR)/lib/ -L/usr/X11R6/lib/ -lqt -lXext -lX11 -lm AR = ar cqs RANLIB = MOC = $(QTDIR)/bin/moc UIC = $(QTDIR)/bin/uic QMAKE = qmake TAR = tar -cf GZIP = gzip -9f COPY = cp -f COPY_FILE= $(COPY) COPY_DIR = $(COPY) -r DEL_FILE = rm -f SYMLINK = ln -sf DEL_DIR = rmdir MOVE = mv -f CHK_DIR_EXISTS= test -d MKDIR = mkdir -p ####### Output directory OBJECTS_DIR = ./ ####### Files HEADERS = SOURCES = main.cpp OBJECTS = main.o FORMS = UICDECLS = UICIMPLS = SRCMOC = OBJMOC = DIST = hello_world.pro QMAKE_TARGET = hello_world DESTDIR = TARGET = hello_world first: all ####### Implicit rules .SUFFIXES: .c .o .cpp .cc .cxx .C .cpp.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .cc.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .cxx.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .C.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $< .c.o: $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< ####### Build rules all: Makefile $(TARGET) $(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP) mocables: $(SRCMOC) uicables: $(UICDECLS) $(UICIMPLS) $(MOC): ( cd $(QTDIR)/src/moc ; $(MAKE) ) Makefile: hello_world.pro /usr/lib/qt3/mkspecs/default/qmake.conf $(QMAKE) -o Makefile hello_world.pro qmake: @$(QMAKE) -o Makefile hello_world.pro dist: @mkdir -p .tmp/hello_world && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/hello_world/ && ( cd `dirname .tmp/hello_world` && $(TAR) hello_world.tar hello_world && $(GZIP) hello_world.tar ) && $(MOVE) `dirname .tmp/hello_world`/hello_world.tar.gz . && $(DEL_FILE) -r .tmp/ hello_world mocclean: uiclean: yaccclean: lexclean: clean: -$(DEL_FILE) $(OBJECTS) -$(DEL_FILE) *~ core *.core ####### Sub-libraries distclean: clean -$(DEL_FILE) $(TARGET) $(TARGET) FORCE: ####### Compile main.o: main.cpp ####### Install install: all uninstall: -- Allen Seelye Alleninmt@yahoo.com A Linux user since 1999. --------------- "It's a trick, get an axe."
Allen Seelye wrote:
Is this one of the qt examples?????
If so did you compile it in example dir????
What is in the *.pro file????
Had some trouble with qt-3.3.1-beta-mac..... It really didn't like being out the qt examples dir.
Stefan.
Also, here is my Makefile. Everything looks good to me but I'm not really sure what all to look for.
############################################################################# # Makefile for building: hello_world # Generated by qmake (1.06c) (Qt 3.2.1) on: Fri Mar 5 14:45:48 2004 # Project: hello_world.pro # Template: app # Command: $(QMAKE) -o Makefile hello_world.pro #############################################################################
####### Compiler, tools and options
CC = gcc CXX = g++ LEX = flex YACC = yacc CFLAGS = -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -DQT_NO_DEBUG CXXFLAGS = -pipe -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -Wall -W -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -fPIC -DQT_NO_DEBUG LEXFLAGS = YACCFLAGS= -d INCPATH = -I/usr/lib/qt3/mkspecs/default -I. -I$QTDIR/include -I/usr/include -I$(QTDIR)/include LINK = g++ LFLAGS = LIBS = $(SUBLIBS) -L/usr/lib/ -L$(QTDIR)/lib/ -L/usr/X11R6/lib/ -lqt -lXext -lX11 -lm AR = ar cqs RANLIB = MOC = $(QTDIR)/bin/moc UIC = $(QTDIR)/bin/uic QMAKE = qmake TAR = tar -cf GZIP = gzip -9f COPY = cp -f COPY_FILE= $(COPY) COPY_DIR = $(COPY) -r DEL_FILE = rm -f SYMLINK = ln -sf DEL_DIR = rmdir MOVE = mv -f CHK_DIR_EXISTS= test -d MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
HEADERS = SOURCES = main.cpp OBJECTS = main.o FORMS = UICDECLS = UICIMPLS = SRCMOC = OBJMOC = DIST = hello_world.pro QMAKE_TARGET = hello_world DESTDIR = TARGET = hello_world
first: all ####### Implicit rules
.SUFFIXES: .c .o .cpp .cc .cxx .C
.cpp.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cc.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cxx.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.C.o: $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.c.o: $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
####### Build rules
all: Makefile $(TARGET)
$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)
mocables: $(SRCMOC) uicables: $(UICDECLS) $(UICIMPLS)
$(MOC): ( cd $(QTDIR)/src/moc ; $(MAKE) )
Makefile: hello_world.pro /usr/lib/qt3/mkspecs/default/qmake.conf $(QMAKE) -o Makefile hello_world.pro qmake: @$(QMAKE) -o Makefile hello_world.pro
dist: @mkdir -p .tmp/hello_world && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/hello_world/ && ( cd `dirname .tmp/hello_world` && $(TAR) hello_world.tar hello_world && $(GZIP) hello_world.tar ) && $(MOVE) `dirname .tmp/hello_world`/hello_world.tar.gz . && $(DEL_FILE) -r .tmp/ hello_world
mocclean:
uiclean:
yaccclean: lexclean: clean: -$(DEL_FILE) $(OBJECTS) -$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean -$(DEL_FILE) $(TARGET) $(TARGET)
FORCE:
####### Compile
main.o: main.cpp
####### Install
install: all
uninstall:
-- Allen Seelye Alleninmt@yahoo.com A Linux user since 1999.
--------------- "It's a trick, get an axe."
-- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
I didn't see QTDIR set in the makefile (maybe I missed it). Even if it's in your environment, I thought you had to tell make to use env. stuff w/ 'make -e ....'.
I reinstalled the qt-devel packages and it's working fine now. I have no idea what the hang up was but that fixed it.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday 06 March 2004 11:46 am, Allen Seelye wrote:
I reinstalled the qt-devel packages and it's working fine now. I have no idea what the hang up was but that fixed it.
The main purpose of this message is to apologize for my rudeness. I had not noticed you were here talking to yourself outloud. I was too caught up in my own little world to realize someone was asking for help that I most likely could have provided. In the future you may want to try the TrollTech mailing list for qt-specific help. I will be there to ignore you as well ;-) but there will be other people who won't ignore you. There is something weird about how SuSE bundled the Qt RPMs. Here's my inelegant, yet effective method of finding information about what's in RPMs. This will find all that you have installed. The -qa will dump everything, then you filter that with grep. :> rpm -qa | grep qt qt3-postgresql-3.3.1-2 qt3-extensions-3.3.1-2 unixODBC-gui-qt-2.2.6-63 qt3-examples-3.3.1-2 qt3-devel-doc-3.3.1-2 qt3-unixODBC-3.3.1-2 avifile-qt-0.7.38-57 qt3-mysql-3.3.1-2 qt3-man-3.3.1-2 yast2-qt-2.8.16-3 qt3-static-3.3.0-47 qt3-devel-3.3.1-2 qt3-devel-tools-3.3.1-2 qt3-3.3.1-2 qt3-non-mt-3.3.1-2 I recently learned about a program called pin which will find where RPMS are on the distribution media. Try `pin qt'. To get info about what's in an installed rpm try something along the lines of `rpm -ql qt3-3.3.1-2'. That will list all the files the rpm provided. Use a - -qi to get the info about the RPM. By poking around a few of us determined the /usr/lib/qt3/lib/libqt.so from the SuSE RPMs is from the non-mt RPM. That is kind of weird form my POV. I don't think that was the problem however. When working with QT do these things before checking anything else: :> echo $QTDIR /usr/lib/qt3 #points to where QT is installed. # /usr/lib/qt3 is the default. :> echo $LD_LIBRARY_PATH :/usr/lib/qt3/lib:/lib:/home/hattons/opt/org/apache/xml-xerces/c/lib:/home/hattons/opt/com/ibm/icu/lib You only need /usr/lib/qt3/lib in the LD_LIBRARY_PATH. If it's not there use export LD_LIBRARY_PATH=/usr/lib/qt/lib:$LD_LIBRARY_PATH That only works for the current session. Put that in your ~/.bashrc for future use. Do the exactly similar thing for QTDIR. It may help to do the following, but it's probably not necessary: export LIBRARY_PATH=/usr/lib/qt/lib:$LIBRARY_PATH Always be sure the development versions of libraries are installed when trying to compile against a library, such as Qt. STH -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD4DBQFAUdofwX61+IL0QsMRAtjwAJYv4tjtMXKYFhDT4qH7tJ7XziWpAJwN3Ubk 8fK+zjr1IfMAp3qSxB7oEQ== =rfwd -----END PGP SIGNATURE-----
On Friday 12 March 2004 16:41, Steven T. Hatton wrote:
There is something weird about how SuSE bundled the Qt RPMs.
Exactly what? Hundreds of developers (KDE and here in-house) are working with them. If our RPMs really had problems, we would have notice that by now. I am using them on a daily basis. They work fine for me. Believe me, the problem is not in the RPMs - it must be the way you set up your work environment. CU -- Stefan Hundhammer <sh@suse.de> Penguin by conviction. YaST2 Development SuSE Linux AG Nuernberg, Germany
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 12 March 2004 10:43 am, Stefan Hundhammer wrote:
On Friday 12 March 2004 16:41, Steven T. Hatton wrote:
There is something weird about how SuSE bundled the Qt RPMs.
Exactly what?
Weird doesn't mean bad, necessarily. This is the issue: rpm -ql qt3-non-mt-3.3.1-2 /usr/lib/libqt.so.3 /usr/lib/pkgconfig/qt.pc /usr/lib/qt3 /usr/lib/qt3/lib /usr/lib/qt3/lib/libqt.prl /usr/lib/qt3/lib/libqt.so /usr/lib/qt3/lib/libqt.so.3 /usr/lib/qt3/lib/libqt.so.3.3 /usr/lib/qt3/lib/libqt.so.3.3.1 /usr/lib/qt3/plugins /usr/lib/qt3/plugins/imageformats /usr/lib/qt3/plugins/imageformats/libqjpeg.non-mt.so /usr/lib/qt3/plugins/imageformats/libqmng.non-mt.so I, and a few others expected the mt would be the default. The fact that non-mt was the default, caused my code not to compile. I added two switches to the LIBS variable in the Makefile: - -lqt-mt -lGL (or -lGLU I've forgotten which wasn't there.) and it compiled fine. That was for the OpenGL cube example from the QT Book.
Hundreds of developers (KDE and here in-house) are working with them. If our RPMs really had problems, we would have notice that by now.
Mark Summerfield seemed to find it odd that the non-mt was the default library. You may have perfectly good reasons for doing things that way. It's not how I would have done it - unless I had a good reason.
I am using them on a daily basis. They work fine for me.
Believe me, the problem is not in the RPMs - it must be the way you set up your work environment.
I'm not sure what's up. If the same code compiled for you without modification, there is certainly something different between our respective systems. Another SuSE user attempted to compile the same code on his box with the same results I had. He found the solution shown above which also worked for me. I have a solution, so it doesn't matter to me. I would like to understand why things are the way they are. But that's just curiosity.
CU -- Stefan Hundhammer <sh@suse.de> Penguin by conviction. YaST2 Development SuSE Linux AG Nuernberg, Germany
STH -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQFAUeCLwX61+IL0QsMRAuqXAJ9S+SoctPDHoeRq7NVWgSp0T2wgxgCeJpvD CJT7+3gZezuGfSNdHJr7lBE= =z0jU -----END PGP SIGNATURE-----
On Friday 12 March 2004 16:41, Steven T. Hatton wrote:
Always be sure the development versions of libraries are installed when trying to compile against a library, such as Qt.
You mean to say: Make sure you have the development package of such a library installed, too. It contains the header files which you need for development work. The libraries are the same in both cases; the development package usually doesn't contain any libraries anyway. CU -- Stefan Hundhammer <sh@suse.de> Penguin by conviction. YaST2 Development SuSE Linux AG Nuernberg, Germany
Oops, one other vital piece of information. These errors are popping up when running make. I have already run "qmake -project" and "qmake" with no problems. -- Allen Seelye Alleninmt@yahoo.com A Linux user since 1999. --------------- "It's a trick, get an axe."
Allen Seelye wrote:
Oops, one other vital piece of information. These errors are popping up when running make. I have already run "qmake -project" and "qmake" with no problems.
You're looking for a file called libqt-mt.so, which is almost certainly in some lib directory and not any of the ones listed in /etc/ld.so.conf I'd guess it's in /usr/lib/qt/lib but I could easily be wrong. Once you know where it is, I think you can do $ LD_LIBRARY_PATH=/usr/lib/qt/lib make substituting as necessary. -- JDL Non enim propter gloriam, diuicias aut honores pugnamus set propter libertatem solummodo quam Nemo bonus nisi simul cum vita amittit.
On Thursday 04 March 2004 1:13 pm, John Lamb wrote:
Allen Seelye wrote:
Oops, one other vital piece of information. These errors are popping up when running make. I have already run "qmake -project" and "qmake" with no problems.
You're looking for a file called libqt-mt.so, which is almost certainly in some lib directory and not any of the ones listed in /etc/ld.so.conf
I'd guess it's in /usr/lib/qt/lib but I could easily be wrong. Once you know where it is, I think you can do
$ LD_LIBRARY_PATH=/usr/lib/qt/lib make
substituting as necessary.
-- JDL
Non enim propter gloriam, diuicias aut honores pugnamus set propter libertatem solummodo quam Nemo bonus nisi simul cum vita amittit.
I do have that file. It's located in /usr/lib/qt3/lib and $LD_LIBRARY_PATH is already pointed at that directory. Although the file is actually a symlink pointing to libqt-mt.so.3.2.1, if that makes any difference. -- Allen Seelye Alleninmt@yahoo.com A Linux user since 1999. --------------- "It's a trick, get an axe."
participants (7)
-
Allen Seelye
-
John Lamb
-
Lukacs Zsolt
-
S. Bulterman
-
Stefan Hundhammer
-
Steven T. Hatton
-
William A. Mahaffey III