Results 1 to 7 of 7

Thread: makefile troubles

  1. #1
    Join Date
    Mar 2007
    Location
    Vienna / Austria
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default makefile troubles

    Hello, ...

    I want to create a SIP Client Application using Qt4 for the User Interface. My developing is really at the beginning and I got a problem with the makefile. My SIP Client GUI is based on a OpenSource SIP Stack (pjsip.org). On this Homepage is a Manual which explains how to create a own SIP Client GUI. They say, that I have to write my own makefile which involves following lines.

    Qt Code:
    1. #Modify this to point to the PJSIP location.
    2. PJBASE=/home/myself/pjproject-0.5.10.2
    3.  
    4. include $(PJBASE)/build.mak
    5.  
    6. CC = $(APP_CC)
    7. LDFLAGS = $(APP_LDFLAGS)
    8. LDLIBS = $(APP_LDLIBS)
    9. CFLAGS = $(APP_CFLAGS)
    10. CPPFLAGS= ${CFLAGS}
    11.  
    12. # If your application is in a file named myapp.cpp or myapp.c
    13. # this is the line you will need to build the binary.
    14. all: myapp
    15.  
    16. myapp: myapp.cpp
    17. $(CC) -o $@ $< $(CPPFLAGS) $(LDFLAGS) $(LDLIBS)
    18.  
    19. clean:
    20. rm -f myapp.o myapp
    To copy to clipboard, switch view to plain text mode 

    But also the command
    Qt Code:
    1. qmake
    To copy to clipboard, switch view to plain text mode 
    generates his own makefiles which involve the path for the Qt4 include files.

    So when I use the the makefile generated by qmake, the compiler doesn't find the includes from the pjsip.

    So my Question: How can or must I combine or build the makefile that i can make a successful build of my program.


    Best Regards,...

  2. #2
    Join Date
    Mar 2007
    Location
    Vienna / Austria
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: makefile troubles

    Okay, I try it another way:

    This is my makefile generated by qmake:

    Qt Code:
    1. -#############################################################################
    2. # Makefile for building: usc-es_0-1
    3. # Generated by qmake (2.01a) (Qt 4.2.3) on: Thu Apr 12 08:32:45 2007
    4. # Project: usc-es_0-1.pro
    5. # Template: app
    6. # Command: /usr/local/Trolltech/Qt-4.2.3/bin/qmake -unix -o Makefile usc-es_0-1.pro
    7. #############################################################################
    8.  
    9. ####### Compiler, tools and options
    10.  
    11. CC = gcc
    12. CXX = g++
    13. LEX = flex
    14. YACC = yacc
    15. DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
    16. CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
    17. CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
    18. LEXFLAGS =
    19. YACCFLAGS = -d
    20. INCPATH = -I/usr/local/Trolltech/Qt-4.2.3/mkspecs/linux-g++ -I. \
    21. -I/usr/local/Trolltech/Qt-4.2.3/include/QtCore -I/usr/local/Trolltech/Qt-4.2.3/include/QtCore \
    22. -I/usr/local/Trolltech/Qt-4.2.3/include/QtGui -I/usr/local/Trolltech/Qt-4.2.3/include/QtGui
    23. -I/usr/local/Trolltech/Qt-4.2.3/include -I. -Isrc -I. -I.
    24. LINK = g++
    25. LFLAGS = -Wl,-rpath,/usr/local/Trolltech/Qt-4.2.3/lib
    26. LIBS = $(SUBLIBS) -L/usr/local/Trolltech/Qt-4.2.3/lib -lQtGui
    27. -L/home/nb100146/qt-x11-opensource-src-4.2.3/lib -L/usr/X11R6/lib \
    28. -lpng -lSM -lICE -pthread -pthread -lXi -lXrender -lXrandr -lXfixes -lXcursor \
    29. -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread \
    30. -lgthread-2.0 -lglib-2.0 -ldl -lpthread
    31. AR = ar cqs
    32. RANLIB =
    33. QMAKE = /usr/local/Trolltech/Qt-4.2.3/bin/qmake
    34. TAR = tar -cf
    35. COMPRESS = gzip -9f
    36. COPY = cp -f
    37. COPY_FILE = $(COPY)
    38. COPY_DIR = $(COPY) -r
    39. INSTALL_FILE = install -m 644 -p
    40. INSTALL_DIR = $(COPY_DIR)
    41. INSTALL_PROGRAM = install -m 755 -p
    42. DEL_FILE = rm -f
    43. SYMLINK = ln -sf
    44. DEL_DIR = rmdir
    45. MOVE = mv -f
    46. CHK_DIR_EXISTS= test -d
    47. MKDIR = mkdir -p
    48.  
    49. ####### Output directory
    50.  
    51. OBJECTS_DIR = ./
    52.  
    53. ####### Files
    54.  
    55. SOURCES = src/uscgui.cpp \
    56. src/uscinterface.cpp moc_uscgui.cpp
    57. OBJECTS = uscgui.o \
    58. uscinterface.o \
    59. moc_uscgui.o
    60. DIST = /usr/local/Trolltech/Qt-4.2.3/mkspecs/common/unix.conf \
    61. /usr/local/Trolltech/Qt-4.2.3/mkspecs/common/g++.conf \
    62. /usr/local/Trolltech/Qt-4.2.3/mkspecs/common/linux.conf \
    63. /usr/local/Trolltech/Qt-4.2.3/mkspecs/qconfig.pri \
    64. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_functions.prf \
    65. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_config.prf \
    66. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/exclusive_builds.prf \
    67. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_pre.prf \
    68. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/release.prf \
    69. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_post.prf \
    70. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/warn_on.prf \
    71. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt.prf \
    72. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/unix/thread.prf \
    73. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/moc.prf \
    74. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/resources.prf \
    75. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/uic.prf \
    76. usc-es_0-1.pro
    77. QMAKE_TARGET = usc-es_0-1
    78. DESTDIR =
    79. TARGET = usc-es_0-1
    80.  
    81. first: all
    82. ####### Implicit rules
    83.  
    84. .SUFFIXES: .o .c .cpp .cc .cxx .C
    85.  
    86. .cpp.o:
    87. $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
    88.  
    89. .cc.o:
    90. $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
    91.  
    92. .cxx.o:
    93. $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
    94.  
    95. .C.o:
    96. $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
    97.  
    98. .c.o:
    99. $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
    100.  
    101. ####### Build rules
    102.  
    103. all: Makefile $(TARGET)
    104.  
    105. $(TARGET): $(OBJECTS)
    106. $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
    107.  
    108. Makefile: usc-es_0-1.pro /usr/local/Trolltech/Qt-4.2.3/mkspecs/linux-g++/qmake.conf \
    109. /usr/local/Trolltech/Qt-4.2.3/mkspecs/common/unix.conf \
    110. /usr/local/Trolltech/Qt-4.2.3/mkspecs/common/g++.conf \
    111. /usr/local/Trolltech/Qt-4.2.3/mkspecs/common/linux.conf \
    112. /usr/local/Trolltech/Qt-4.2.3/mkspecs/qconfig.pri \
    113. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_functions.prf \
    114. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_config.prf \
    115. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/exclusive_builds.prf \
    116. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_pre.prf \
    117. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/release.prf \
    118. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_post.prf \
    119. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/warn_on.prf \
    120. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt.prf \
    121. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/unix/thread.prf \
    122. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/moc.prf \
    123. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/resources.prf \
    124. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/uic.prf \
    125. /usr/local/Trolltech/Qt-4.2.3/lib/libQtGui.prl \
    126. /usr/local/Trolltech/Qt-4.2.3/lib/libQtCore.prl
    127. $(QMAKE) -unix -o Makefile usc-es_0-1.pro
    128. /usr/local/Trolltech/Qt-4.2.3/mkspecs/common/unix.conf:
    129. /usr/local/Trolltech/Qt-4.2.3/mkspecs/common/g++.conf:
    130. /usr/local/Trolltech/Qt-4.2.3/mkspecs/common/linux.conf:
    131. /usr/local/Trolltech/Qt-4.2.3/mkspecs/qconfig.pri:
    132. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_functions.prf:
    133. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt_config.prf:
    134. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/exclusive_builds.prf:
    135. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_pre.prf:
    136. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/release.prf:
    137. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/default_post.prf:
    138. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/warn_on.prf:
    139. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/qt.prf:
    140. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/unix/thread.prf:
    141. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/moc.prf:
    142. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/resources.prf:
    143. /usr/local/Trolltech/Qt-4.2.3/mkspecs/features/uic.prf:
    144. /usr/local/Trolltech/Qt-4.2.3/lib/libQtGui.prl:
    145. /usr/local/Trolltech/Qt-4.2.3/lib/libQtCore.prl:
    146. qmake: FORCE
    147. @$(QMAKE) -unix -o Makefile usc-es_0-1.pro
    148.  
    149. dist:
    150. @$(CHK_DIR_EXISTS) .tmp/usc-es_0-11.0.0 || $(MKDIR) .tmp/usc-es_0-11.0.0
    151. $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/usc-es_0-11.0.0/ && \
    152. $(COPY_FILE) --parents src/uscgui.h .tmp/usc-es_0-11.0.0/ && \
    153. $(COPY_FILE) --parents src/uscgui.cpp src/uscinterface.cpp .tmp/usc-es_0-11.0.0/ && \
    154. (cd `dirname .tmp/usc-es_0-11.0.0` && $(TAR) usc-es_0-11.0.0.tar usc-es_0-11.0.0 && \
    155. $(COMPRESS) usc-es_0-11.0.0.tar) && $(MOVE) `dirname .tmp/usc-es_0-11.0.0`/usc-es_0-11.0.0.tar.gz . && \
    156. $(DEL_FILE) -r .tmp/usc-es_0-11.0.0
    157.  
    158.  
    159. yaccclean:
    160. lexclean:
    161. clean:compiler_clean
    162. -$(DEL_FILE) $(OBJECTS)
    163. -$(DEL_FILE) *~ core *.core
    164.  
    165.  
    166. ####### Sub-libraries
    167.  
    168. distclean: clean
    169. -$(DEL_FILE) $(TARGET)
    170. -$(DEL_FILE) Makefile
    171.  
    172.  
    173. /usr/local/Trolltech/Qt-4.2.3/bin/moc:
    174. (cd $(QTDIR)/src/tools/moc && $(MAKE))
    175.  
    176. mocclean: compiler_moc_header_clean compiler_moc_source_clean
    177.  
    178. mocables: compiler_moc_header_make_all compiler_moc_source_make_all
    179.  
    180. compiler_moc_header_make_all: moc_uscgui.cpp
    181. compiler_moc_header_clean:
    182. -$(DEL_FILE) moc_uscgui.cpp
    183. moc_uscgui.cpp: src/uscgui.h \
    184. /usr/local/Trolltech/Qt-4.2.3/bin/moc
    185. /usr/local/Trolltech/Qt-4.2.3/bin/moc $(DEFINES) $(INCPATH) src/uscgui.h -o moc_uscgui.cpp
    186.  
    187. compiler_rcc_make_all:
    188. compiler_rcc_clean:
    189. compiler_image_collection_make_all: qmake_image_collection.cpp
    190. compiler_image_collection_clean:
    191. -$(DEL_FILE) qmake_image_collection.cpp
    192. compiler_moc_source_make_all:
    193. compiler_moc_source_clean:
    194. compiler_uic_make_all:
    195. compiler_uic_clean:
    196. compiler_clean: compiler_moc_header_clean compiler_rcc_clean \
    197. compiler_image_collection_clean compiler_moc_source_clean compiler_uic_clean
    198.  
    199. ####### Compile
    200.  
    201. uscgui.o: src/uscgui.cpp src/uscgui.h
    202. $(CXX) -c $(CXXFLAGS) $(INCPATH) -o uscgui.o src/uscgui.cpp
    203.  
    204. uscinterface.o: src/uscinterface.cpp src/uscgui.h
    205. $(CXX) -c $(CXXFLAGS) $(INCPATH) -o uscinterface.o src/uscinterface.cpp
    206.  
    207. moc_uscgui.o: moc_uscgui.cpp
    208. $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_uscgui.o moc_uscgui.cpp
    209.  
    210. ####### Install
    211.  
    212. install: FORCE
    213.  
    214. uninstall: FORCE
    215.  
    216. FORCE:
    To copy to clipboard, switch view to plain text mode 

    I have to include in this makefile some other lines, because I want to build a application which is based on the sources of the pjproject sources. In a manual of pjproject is written that my makefile have to look like this:

    Qt Code:
    1. #Modify this to point to the PJSIP location.
    2. PJBASE=/home/myself/pjproject-0.5.10.2
    3.  
    4. include $(PJBASE)/build.mak
    5.  
    6. CC = $(APP_CC)
    7. LDFLAGS = $(APP_LDFLAGS)
    8. LDLIBS = $(APP_LDLIBS)
    9. CFLAGS = $(APP_CFLAGS)
    10. CPPFLAGS= ${CFLAGS}
    11.  
    12. # If your application is in a file named myapp.cpp or myapp.c
    13. # this is the line you will need to build the binary.
    14. all: myapp
    15.  
    16. myapp: myapp.cpp
    17. $(CC) -o $@ $< $(CPPFLAGS) $(LDFLAGS) $(LDLIBS)
    18.  
    19. clean:
    20. rm -f myapp.o myapp
    To copy to clipboard, switch view to plain text mode 



    My question: How can I include this few lines to the Qt specific makefile that the make also finds the pjproject sources????


    Best Regards,...
    Last edited by jacek; 12th April 2007 at 17:45. Reason: wrapped too long lines

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: makefile troubles

    I answered your question yesterday but Konqueror crashed during posting the message, so it didn't make it onto the board.

    You should try to split the application into two components - one should contain all SIP related code, which you can then compile using a custom (non-Qt) makefile into a library and the other one should contain Qt code (which you can compile using qmake) and call functions/classes defined in the other part which needs to be linked with the main part during compilation.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: makefile troubles

    Can't you just set LIBS and INCLUDEPATH accordingly in your .pro file? Does this library support pkgconfig?

  5. #5
    Join Date
    Mar 2007
    Location
    Vienna / Austria
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: makefile troubles

    Quote Originally Posted by wysota View Post
    I answered your question yesterday but Konqueror crashed during posting the message, so it didn't make it onto the board.

    You should try to split the application into two components - one should contain all SIP related code, which you can then compile using a custom (non-Qt) makefile into a library and the other one should contain Qt code (which you can compile using qmake) and call functions/classes defined in the other part which needs to be linked with the main part during compilation.
    Okay that sounds like a very god idea! Because today i tried to include the relevant SIP-makefile lines into the Qt-makefile and it causes further troubles anywhere.

    But your info isn't very helpful in this way. How can implement these call functions/classes and how can I manually link them during the compilation?

    I please you to give me more and detailed information about that.

    Best Regards!

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: makefile troubles

    You have to create a library of classes or functions and link your application against it just like you link against Qt libraries. There are lots and lots of materials on how to create libraries for various systems available in the Internet. In doubt consult your compiler manual.

  7. #7
    Join Date
    Mar 2007
    Location
    Vienna / Austria
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: makefile troubles

    Hey Wysota,

    Thanks for your information. But just yet I find out how to handle my problem. qmake also generates me a .pro file before it generates me the Makefile. The .pro file is much easier to understand and to configure by a "human being".

    So today I find out how to fill up this .pro file correctly with the PSJIP specific Includes and Libraries.

    My Profile looks like this at the moment:

    Qt Code:
    1. ######################################################################
    2. # Automatically generated by qmake (2.01a) Thu Apr 12 15:03:47 2007
    3. ######################################################################
    4.  
    5.  
    6. TEMPLATE = app
    7. TARGET =
    8. DEPENDPATH += . src
    9. INCLUDEPATH += . src
    10.  
    11. LIBS += -L/home/user/pjproject-0.5.10.2/pjlib/lib
    12. LIBS += -L/home/user/pjproject-0.5.10.2/pjlib-util/lib/
    13. LIBS += -L/home/user/pjproject-0.5.10.2/pjmedia/lib
    14. LIBS += -L/home/user/pjproject-0.5.10.2/pjsip/lib
    15.  
    16. LIBS += -lpjsua-i686-pc-linux-gnu
    17. LIBS += -lpjsip-ua-i686-pc-linux-gnu
    18. LIBS += -lpjsip-simple-i686-pc-linux-gnu
    19. LIBS += -lpjsip-i686-pc-linux-gnu
    20. LIBS += -lpjmedia-codec-i686-pc-linux-gnu
    21. LIBS += -lpjmedia-i686-pc-linux-gnu
    22. LIBS += -lpjmedia-codec-i686-pc-linux-gnu
    23. LIBS += -lpjlib-util-i686-pc-linux-gnu
    24. LIBS += -lpj-i686-pc-linux-gnu
    25. LIBS += -lm -lnsl -lrt -lpthread
    26.  
    27. INCLUDEPATH += /home/user/pjproject-0.5.10.2/pjlib/include
    28. INCLUDEPATH += /home/user/pjproject-0.5.10.2/pjlib-util/include
    29. INCLUDEPATH += /home/user/pjproject-0.5.10.2/pjmedia/include
    30. INCLUDEPATH += /home/user/pjproject-0.5.10.2/pjsip/include
    31.  
    32.  
    33. # Input
    34. HEADERS += src/uscgui.h
    35. SOURCES += src/uscgui.cpp src/uscinterface.cpp
    To copy to clipboard, switch view to plain text mode 

    And it works with this configuration.

    Thanks for your help!

    Best Regards,...

Similar Threads

  1. makefile without using QMake
    By Rayven in forum Qt Programming
    Replies: 2
    Last Post: 6th April 2010, 22:04
  2. A way to transfer info from .pro to Makefile
    By thawkins in forum Qt Programming
    Replies: 3
    Last Post: 2nd May 2006, 21:06
  3. Replies: 5
    Last Post: 13th March 2006, 20:22
  4. Problem with a makefile
    By Tweety in forum Qt Programming
    Replies: 16
    Last Post: 15th February 2006, 19:34
  5. cant ceate makefile
    By raphaelf in forum Qt Programming
    Replies: 7
    Last Post: 24th January 2006, 13:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.