Results 1 to 14 of 14

Thread: How to statically link qt?

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    31

    How to statically link qt?

    I love v4, but all of my other apps want the old qt libs. How do I modify the make to statically link the 2.3.2 libs?

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    31

    Question

    Anyone? Zaphod?

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    951
    it is my understanding that qt-2.3.2 should be backward compatible to qt-2.3.1, so along these lines... i did an rpm -e qt-devel --nodeps and rpm -e qt --nodeps. i THEN made /usr/lib/qt-2.3.1 a symlink to /usr/lib/qt-2.3.2 and haven't really had any problems since. i did this because at SOME point, KDE barfed and spit out qt errors (this was when i had just rpm -e qt, then rm -Rf /usr/lib/qt-2.3.1 due to seq STILL trying to insist on using qt-2.3.1). also, be sure to put /usr/lib/qt-2.3.2 in your /etc/ld.so.conf and run ldconfig

    ln -s /usr/lib/qt-2.3.2/ /usr/lib/qt-2.3.1

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    31
    Thanks, fry, that will probably work for me! I'll try it.

    But, just for my own continuing education how do I tell something to statically link in a library? I've been looking at this for a couple of days now, and I would love to close the loop on the solution I was looking for.

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    31
    Interesting - it doesn't work. Kwrite and Knode both give errors loading shared libraries with the 2.3.2 version of qt. if I put the symbolic links back to the 2.3.1 version, they run fine.

    kwrite: error while loading shared libraries: /usr/lib/libDCOP.so.1: undefined symbol: newItem__11QCollectionPv
    [root@denmdk etc]# knode
    knode: error while loading shared libraries: /usr/lib/libDCOP.so.1: undefined symbol: _7QString.shared_null


    Any ideas? Still interested in statically linking showeq with qt2.3.2 as well.

  6. #6
    Registered User
    Join Date
    Dec 2001
    Posts
    951
    instead of just changing a symbolic link, try removing the qt-2.3.1 dir entirely (be sure you have the qt-rpms on hand, its easy enough to fix).

    then, be SURE you put "/usr/lib/qt-2.3.2/lib" into the file /etc/ld.so.conf then re-run "ldconfig"

    this is of course AFTER you have compiled qt with the ./configure -thread option (and NOT....)

    doh, mid-post i realized why it probably won't work. showeq wants to be compiled with gcc3 (which meants qt has to be compiled with gcc3... which means only programs compiled WITH gcc3 can USE qt (i think?))

    anyway, that is starting to make me wonder why my linux system at home is actually working... perhaps its because i'm ONLY using kde and showeq, not running any other apps that i can think of... humm, super freaky.

  7. #7
    Registered User
    Join Date
    Dec 2001
    Posts
    31
    I've tried it both ways - just changing the symbolic link, updating ld.so.conf, and running ldconfig, and also removing 2.3.1 altogether, updating ld.so.conf and running ldconfig.

    either way, if 2.3.1 is set, then kwrite & knode work, but showeq won't or, if 2.3.2 is setup, then showeq works, but not kwrite & knode.

    this bites.

    Thanks for your tips, though, fry. I appreciate you taking the time.

  8. #8
    Registered User
    Join Date
    Dec 2001
    Posts
    33

    env

    i assume you have set all env variable correctly
    "I've heard it said there's a window that opens from one mind to another, but if there's no wall, there's no need for fitting the window, or the latch."
    -Rumi

  9. #9
    Registered User
    Join Date
    Dec 2001
    Posts
    31
    Yep, and, if I put /usr/local/qt/lib (contains 2.3.2) in front of /usr/lib (contains 2.3.1) in the LD_LIBRARY_PATH first, then showeq works, but not kwrite. Reverse the order, and kwrite works, but not showeq. So, i can set up a script to reverse the order, export, source, and run showeq, but it sure is a kludge.

  10. #10
    Registered User
    Join Date
    Dec 2001
    Posts
    31
    OK, I just scripted it. Now everything is happy happy. But, the original question on this thread is "How do I compile seq with qt statically linked?

    Someone has to know. Please tell me so I will learn something.

    Thanks!

  11. #11
    Registered User
    Join Date
    Dec 2001
    Posts
    31
    No one?

  12. #12
    Registered User
    Join Date
    Dec 2001
    Posts
    33

    Lightbulb

    Just spent a couple hours figuring it out:

    You need to compile QT statically, and then compile showeq statically.

    Following Zaphod's instructions at http://seq.sourceforge.net/showthrea...s=&threadid=70 you will replace the following command:

    ./configure -release -shared -gif -xft -sm -system-libmng -system-zlib -system-libpng -system-jpeg -no-g++-exceptions -thread

    With this command:

    ./configure -release -static -gif -xft -sm -system-libmng -system-zlib -system-libpng -system-jpeg -no-g++-exceptions -thread

    Then recompile qt-2.3.2.

    Now is qt compiled statically (You should have: libqt.a, libqt-mt.a and libqutil.a files in your /usr/lib/qt-2.3.2/lib directory)

    Then goto your showeq source directory.

    do:

    make -f Makefile.dist
    ./configure --disable-shared --enable-static
    make

    You aren't done yet, all your .o files are made correctly, but the statically linked showeq program file is not.

    You need to then run the following command:

    g++3 -D_REENTRANT -O2 -Wall -g -ggdb -DDEBUG -finline-functions -DQT_THREAD_SUPPORT=1 -o showeq main.o spawn.o spawnshell.o spawnlist.o spellshell.o spelllist.o preferences.o m_preferences.o vpacket.o editor.o filter.o m_spawnshell.o m_spawnlist.o m_spellshell.o m_spelllist.o m_editor.o packet.o m_packet.o interface.o m_interface.o compass.o m_compass.o map.o m_map.o util.o experiencelog.o m_experiencelog.o msgdlg.o m_msgdlg.o player.o m_player.o decode.o m_decode.o skilllist.o m_skilllist.o statlist.o m_statlist.o filtermgr.o m_filtermgr.o mapcore.o category.o m_category.o compassframe.o m_compassframe.o group.o m_group.o itemdb.o gdbmconv.o /usr/lib/qt-2.3.2/lib/libqt.a /usr/lib/qt-2.3.2/lib/libqutil.a /usr/lib/qt-2.3.2/lib/libqt-mt.a -L/usr/lib/qt-2.3.2/lib -lqt-mt -lpthread -lEQ /usr/lib/libgdbm.so -lz -lpcap



    The differance here is that you are not only compiling in all the .o files, but also compiling in the qt.a static files.

    If you scroll up to the line starting like the command I just gave you you will notice that it is missing:

    /usr/lib/qt-2.3.2/lib/libqt.a
    /usr/lib/qt-2.3.2/lib/libqutil.a
    /usr/lib/qt-2.3.2/lib/libqt-mt.a

    Doing that you should be able to mv the /usr/lib/qt-2.3.2 directory and still run showeq.


    Also this should make it so that you can compile on a machine with qt-2.3.2 and GCC3 and run it on a machine without those, althought I have not tested it. You *MAY* need to statically link in the GCC libs and also any glibc libs as well, which I will leave as an excercise to the user. Just follow the hints on statically compiling in the libqt.a and you should figure it out just fine.


    Hope that helps,

    KennySP

    EDIT: Oh and for referance on why shared libraries are a *GOOD* thing overall just look at the following:

    The stripped version of showeq using shared libs is:

    1204820 kbytes (1.2MB)


    While the statically compiled version of showeq is:

    16812431 kbytes (16.8MB) -- if you need to statically compile in glibc it will add even more size.
    Last edited by KennySP; 12-27-2001 at 05:52 PM.

  13. #13
    Registered User
    Join Date
    Dec 2001
    Posts
    33
    Did this help you? Or were you looking for something more detailed?

    KennySP

  14. #14
    Registered User
    Join Date
    Dec 2001
    Posts
    31

    Thumbs up

    KennySP, you are my god. thanks for taking the time to figure it out - it worked perfectly.

    Many thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

You may post new threads
You may post replies
You may post attachments
You may edit your posts
HTML code is Off
vB code is On
Smilies are On
[IMG] code is On