×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    12

    How to link to source files and not to dll:s?

    Hi!

    I'm writing a small windows program in Qt for a project at my university (I have never used Qt before). However, when I mail the program to the rest of the members in my project group, they can't run it because they are missing the dll files necessary for it to work. How can I do if I want to build everything into my program (link to source files) instead making it use dll files?

    My *.pro file currently looks like this:

    Code:
    CONFIG += qt debug staticlib
    TARGET = "Control Panel"
    
    INCLUDEPATH += "../"
    SOURCES += button.cpp
    HEADERS += button.h
    SOURCES += user_interface.cpp
    HEADERS += user_interface.h
    SOURCES += main.cpp
    As you can see, I have already tried and made an attempt by putting a flag staticlib to the CONFIG variable (I found some other thread in which they had done this), but it seems to have no effect, since the executable have the same size as before (if source files would be build into the program instead of letting it link to dll files, it would be bigger).

  2. #2
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: How to link to source files and not to dll:s?

    A documentation says you would need statically build Qt to link Qt libraries statically to your project
    http://doc.trolltech.com/4.6/deployment-windows.html

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    12

    Re: How to link to source files and not to dll:s?

    How long time does it take to rebuild Qt when it is statically configured? It has been compiling on my laptop for two hours straight now; is there something wrong? My laptop is fairly new so it shouldn't take that long time. What I found out like 15 minutes after I started the compiling, was the small note under the instructions I just read, telling me to nmake distclean before running configure again. Since I didn't do this (I did everything in the order I read it :P), may something has been fucked up since it is taking so long time?

    Also, what does the qt option in the CONFIG variable do? To me it seems like this variable can disable statical linking to Qt. Should I maybe remove it?

  4. #4
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: How to link to source files and not to dll:s?

    Quote Originally Posted by TriKri View Post
    How long time does it take to rebuild Qt when it is statically configured?
    It depends on the computer, several hours at least.

    Quote Originally Posted by TriKri View Post
    It has been compiling on my laptop for two hours straight now; is there something wrong? My laptop is fairly new so it shouldn't take that long time.
    Qt is a really large framework.

    Quote Originally Posted by TriKri View Post
    What I found out like 15 minutes after I started the compiling, was the small note under the instructions I just read, telling me to nmake distclean before running configure again. Since I didn't do this (I did everything in the order I read it :P), may something has been fucked up since it is taking so long time?
    distclean return sources to pristine state, so if you were starting with clean sources this command will do nothing.

  5. #5
    Registered User
    Join Date
    Apr 2010
    Posts
    12

    Re: How to link to source files and not to dll:s?

    Quote Originally Posted by divanov View Post
    distclean return sources to pristine state, so if you were starting with clean sources this command will do nothing.
    I didn't start with cleaning anything, I just started with configuring and then compiling directly after. I still wonder if it will succeed or if I will have to make clean and then do everything again? I guess I will find out otherwise in a few hours... :P

  6. #6
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: How to link to source files and not to dll:s?

    If you later need to reconfigure and rebuild Qt from the same location, ensure that all traces of the previous configuration are removed by entering the build directory and typing nmake distclean before running configure again.

    To me it's self-sufficient.

  7. #7
    Registered User
    Join Date
    Apr 2010
    Posts
    12

    Re: How to link to source files and not to dll:s?

    What do you mean by self-sufficient; do you mean it will guaranteed fail? Anyway, I got an error, so it did fail. I don't know if it was because of this or if it was because I accidentally put the computer into sleep mode... However, I'm cleaning, reconfiguring and recompiling now - using a batch file, I can't sit and wait for this - so we will see if it succeeds or not this time. Here is the batch file:

    Code:
    make distclean
    configure -static
    make sub-src
    pause
    As you can see, I'm not using nmake but make, since I'm using MinGW. I hope it will work this time. Anyway, thank you for your help.

  8. #8
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: How to link to source files and not to dll:s?

    Quote Originally Posted by TriKri View Post
    What do you mean by self-sufficient; do you mean it will guaranteed fail?
    It means it's clear to me.

    Quote Originally Posted by TriKri View Post
    Anyway, I got an error, so it did fail. I don't know if it was because of this or if it was because I accidentally put the computer into sleep mode...
    You may find it useful to post output error messages.

  9. #9
    Registered User
    Join Date
    Apr 2010
    Posts
    12

    Re: How to link to source files and not to dll:s?

    I got a few errors when trying to build the project:

    Code:
    c:\Program1\msys\1.0\bin\make.exe: *** couldn't commit memory for cygwin heap, Win32 error 0
    make[1]: *** [debug-all] Error 1
    make[1]: Leaving directory '/c/Program1/Qt/2010.02.1/qt/src/3rdparty/webkit/WebCore'
    make: *** [sub-webkit-sub_src_target_ordered] Error 2
    
    C:\Program1\Qt\2010.02.1\qt>pause
    Press any key to continue . . .

  10. #10
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: How to link to source files and not to dll:s?

    It looks like there is not enough memory configured for cygwin.

  11. #11
    Registered User
    Join Date
    Apr 2010
    Posts
    12

    Re: How to link to source files and not to dll:s?

    What does that mean; have you seen this error before? I don't even have cygwin installed. Then how can I configure enough memory or how do I fix it?
    Last edited by TriKri; 2010-04-28 at 12:55.

  12. #12
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: How to link to source files and not to dll:s?

    Quote Originally Posted by TriKri View Post
    What does that mean; have you seen this error before? I don't even have cygwin installed. Then how can I configure enough memory or how do I fix it?
    No, as I'm not using Windows for anything. That's what I've found in the net:
    http://hackage.haskell.org/trac/ghc/...roubleshooting
    c:\msys\1.0\bin\make.exe: *** couldn't commit memory for cygwin heap, Win32 error 0 ¶

    This error occurs when using the new build system with MSYS on Windows. It is a temporary error; just type make again to continue the build. Hopefully this is a bug in MSYS that will be fixed at some point.

  13. #13
    Registered User
    Join Date
    Apr 2010
    Posts
    12

    Re: How to link to source files and not to dll:s?

    Thank you, it never hit me that I should paste the error message into google, as I always do otherwise with compile errors when I'm compiling from Emacs... I tried just typing make sub-src again, and although the trick was for building GHC, I hope that it will work for Qt as well. I will get back here with the result once it's finished.

    -Kristofer

  14. #14
    Registered User
    Join Date
    Apr 2010
    Posts
    12

    Re: How to link to source files and not to dll:s?

    It seems to have finished now. Actually, I don't know the result of the build; the command prompt window seems to have disappeared for me, so I can't see if I got any error or not. And I did wrote a pause in my batch file.

    However, I tried to run qmake and recompile the program for our project today, and it worked. I got a program at 146 MB. What, why?? Does it need to be this big? What can possibly be in it; can all these 146 MB be made up of compiled source and header files? I mean, is even the total size of all the dll files it used before near to this big? I had expected it to be a little bit bigger, but not this big.

    Does it need to contain everything it does, or is it possible to make it smaller by changing some configuration?
    Last edited by TriKri; 2010-04-28 at 20:42.

  15. #15
    Nokia Developer Moderator
    Join Date
    Oct 2009
    Posts
    4,326

    Re: How to link to source files and not to dll:s?

    Are you sure you compiled with release flag, not with debug?
    With Linux Qt seems to take 10Mb
    Code:
    $du -ch  /usr/lib/libQt*.so.4.6.2
    2.8M	/usr/lib/libQtCore.so.4.6.2
    616K	/usr/lib/libQtDBus.so.4.6.2
    0	/usr/lib/libQtGui.so.4.6.2
    88K	/usr/lib/libQtMaemo5.so.4.6.2
    184K	/usr/lib/libQtMultimedia.so.4.6.2
    1.4M	/usr/lib/libQtNetwork.so.4.6.2
    476K	/usr/lib/libQtOpenGL.so.4.6.2
    2.5M	/usr/lib/libQtScript.so.4.6.2
    936K	/usr/lib/libQtScriptTools.so.4.6.2
    264K	/usr/lib/libQtSql.so.4.6.2
    404K	/usr/lib/libQtSvg.so.4.6.2
    148K	/usr/lib/libQtTest.so.4.6.2
    0	/usr/lib/libQtWebKit.so.4.6.2
    328K	/usr/lib/libQtXml.so.4.6.2
    0	/usr/lib/libQtXmlPatterns.so.4.6.2
    10M	total
    It's natural to expect that you app will have +10Mb. And you don't need all libraries in every application.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •