Results 1 to 2 of 2

Thread: Problem with static linking in Linux

  1. #1
    Join Date
    Jun 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Problem with static linking in Linux

    It's one week that I have tried everything I have found on the Internet about static linking, but everything goes wrong.
    So you are my last hope!
    I use debian 6 32bit and I have done a project with qt ceator.

    From here I found these:
    "First you have to download the source package from Trolltech and unpack it."
    I went here I downloaded the Qt library tar.gz (228 MB) and I extracted it on desktop.
    After
    "Qt 4.3.x and Later
    • type:
    "
    Qt Code:
    1. ./configure -static -nomake demos -nomake examples -nomake tools
    2. make
    To copy to clipboard, switch view to plain text mode 
    "
    I typed on a terminal
    Qt Code:
    1. ./configure -static -nomake demos -nomake examples -nomake tools
    To copy to clipboard, switch view to plain text mode 
    but I couldn't do "make" because there wasn't any Makefile
    So I found these advices and I wrote:
    Qt Code:
    1. ./configure -release -opensource -static -platform linux-g++ -no-fast -no-qt3support -no-phonon -no-phonon-backend -no-declarative-debug -no-ssse3 -no-sse4.1 -no-sse4.2 -no-avx -no-neon -qt-zlib -qt-gif -qt-libpng -no-libmng -qt-libjpeg -openssl-linked -nomake examples -nomake demos -nomake docs -no-nis -no-cups -dbus-linked -no-gtkstyle -no-nas-sound -no-opengl -no-openvg -no-glib
    To copy to clipboard, switch view to plain text mode 
    This made a Makefile so next I wrote
    "make"
    and after 2 hours as root "make install"

    1) Have I now static libraries?
    How can I see it?

    Then a Qt folder created in /usr/local/Trolltech/Qt-4.8.2

    I went in my .pro and added
    Qt Code:
    1. CONFIG += static
    2. LIBS += -L/usr/local/Trolltech/Qt-4.8.2
    To copy to clipboard, switch view to plain text mode 

    So, now here says to go to the folder that has my project and write:
    Qt Code:
    1. make clean
    2. PATH=/usr/local/Trolltech/Qt-4.8.2/bin:$PATH
    3. export PATH
    4. qmake -config release
    5. make
    To copy to clipboard, switch view to plain text mode 

    "make" did this
    Qt Code:
    1. g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.8.2/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.8.2/include/QtCore -I/usr/local/Trolltech/Qt-4.8.2/include/QtGui -I/usr/local/Trolltech/Qt-4.8.2/include -I. -o main.o main.cpp
    2. g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.8.2/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.8.2/include/QtCore -I/usr/local/Trolltech/Qt-4.8.2/include/QtGui -I/usr/local/Trolltech/Qt-4.8.2/include -I. -o findscenario.o findscenario.cpp
    3. /usr/local/Trolltech/Qt-4.8.2/bin/moc -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.8.2/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.8.2/include/QtCore -I/usr/local/Trolltech/Qt-4.8.2/include/QtGui -I/usr/local/Trolltech/Qt-4.8.2/include -I. findscenario.h -o moc_findscenario.cpp
    4. g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.8.2/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.8.2/include/QtCore -I/usr/local/Trolltech/Qt-4.8.2/include/QtGui -I/usr/local/Trolltech/Qt-4.8.2/include -I. -o moc_findscenario.o moc_findscenario.cpp
    5. g++ -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/Qt-4.8.2/lib -o findscenario main.o findscenario.o moc_findscenario.o -L/usr/local/Trolltech/Qt-4.8.2/lib -L/usr/local/Trolltech/Qt-4.8.2/lib -lQtGui -L/usr/X11R6/lib -lQtCore -lpthread
    To copy to clipboard, switch view to plain text mode 

    then I wrote
    ldd ./the_name_of_the_executable and it says
    Qt Code:
    1. elina@debian:~/Desktop/findscenario$ ldd ./findscenario
    2. linux-gate.so.1 => (0xb775d000)
    3. libQtGui.so.4 => /usr/local/Trolltech/Qt-4.8.2/lib/libQtGui.so.4 (0xb6be5000)
    4. libQtCore.so.4 => /usr/local/Trolltech/Qt-4.8.2/lib/libQtCore.so.4 (0xb68fe000)
    5. libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb68d8000)
    6. libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb67e3000)
    7. libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb67bd000)
    8. libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb679f000)
    9. libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb6658000)
    10. libz.so.1 => /usr/lib/libz.so.1 (0xb6643000)
    11. libSM.so.6 => /usr/lib/libSM.so.6 (0xb663b000)
    12. libICE.so.6 => /usr/lib/libICE.so.6 (0xb6624000)
    13. libXext.so.6 => /usr/lib/libXext.so.6 (0xb6615000)
    14. libX11.so.6 => /usr/lib/libX11.so.6 (0xb64f8000)
    15. libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb64f3000)
    16. librt.so.1 => /lib/i686/cmov/librt.so.1 (0xb64ea000)
    17. /lib/ld-linux.so.2 (0xb775e000)
    18. libuuid.so.1 => /lib/libuuid.so.1 (0xb64e6000)
    19. libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb64cd000)
    20. libXau.so.6 => /usr/lib/libXau.so.6 (0xb64ca000)
    21. libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb64c4000)
    To copy to clipboard, switch view to plain text mode 
    2) Is it ok? I think no
    And when i add the folder with my project in a new debian that hasn't Qt libraries and it says
    Qt Code:
    1. error while loading shared libraries: libQtGui.so.4: cannot open shared object file: No such file or directory
    To copy to clipboard, switch view to plain text mode 

    3) Why shared libraries?
    What do I do wrong?

    Thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Problem with static linking in Linux

    What does qmake -v return? What is the content of the lib folder under your Qt installation path?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 18th April 2012, 20:01
  2. Static linking problem in Linux
    By daou in forum Qt Programming
    Replies: 1
    Last Post: 25th October 2009, 09:10
  3. Problem configuring qt for static linking.
    By Netich in forum Qt Programming
    Replies: 4
    Last Post: 11th October 2009, 23:55
  4. Static linking in Linux
    By anupamgee in forum Qt Programming
    Replies: 4
    Last Post: 2nd June 2009, 14:34
  5. problem on static linking in Linux.
    By anupamgee in forum Installation and Deployment
    Replies: 1
    Last Post: 29th May 2009, 13:45

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.