Results 1 to 19 of 19

Thread: Run my program on a different computer?

  1. #1

    Default Run my program on a different computer?

    I have created a program in Qt Creator on a mac and now I need to run it on a different computer, which don't have Qt on it. How can I rebuild the program so it can be used on any mac computer?

    A related problem: When I run the program from inside Qt Creator, it works fine. But if i try to start it from the app file on the computer it doesn't work, problems loading a dylib file. I had the same problem from inside Qt before but solved it by specify the permanent directory where the file was located in the running settings in Qt Creator. How can i fix this?

  2. #2
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Run my program on a different computer?

    In order for the application to run on another computer you need to deploy Qt libraries on it. On the other hand you can link your application against static Qt libs, so there will be no need to deploy Qt to the computer where you are going to run your application (but this increases the size of your binary).

    As for your issue with running and application outside Qt Creator, then the reason why that happens is that Qt Creator know where the libs are, but the environment you are running your application in doesn't. So, try to add the paths to Qt libs to LD_LIBRARY_PATH environment variable.
    Last edited by lyuts; 29th October 2010 at 12:16. Reason: updated contents
    I'm a rebel in the S.D.G.

  3. #3

    Default Re: Run my program on a different computer?

    1) How do I know which Qt libraries I have to deploy? But I think the second variant is probably better in this case (don't know yet, and wanna learn both ways for the future) but how do I link it against static Qt libs? Do I have to reinstall Qt itself?

    2) I have set "DYLD_LIBRARY_PATH" to "/opt/local/lib" under Run Settings -> Run Environments and that works when started from Qt. Adding "LD_LIBRARY_PATH" gives the same result.

  4. #4
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Run my program on a different computer?

    Quote Originally Posted by skizzik View Post
    1) How do I know which Qt libraries I have to deploy? But I think the second variant is probably better in this case (don't know yet, and wanna learn both ways for the future) but how do I link it against static Qt libs? Do I have to reinstall Qt itself?

    2) I have set "DYLD_LIBRARY_PATH" to "/opt/local/lib" under Run Settings -> Run Environments and that works when started from Qt. Adding "LD_LIBRARY_PATH" gives the same result.
    1) On Unix/Linux usually ldd is used. As for MacOS then Google says it is otool.
    2) Google suggests man dyld.

    I'm not being rude, I don't any experience with MacOS and didn't notice that you were using it in your original post.
    Last edited by lyuts; 29th October 2010 at 14:11. Reason: updated contents
    I'm a rebel in the S.D.G.

  5. #5

    Default Re: Run my program on a different computer?


    Added after 51 minutes:


    I got otool to work but what should I do with the files it lists?
    Last edited by skizzik; 29th October 2010 at 15:37.

  6. #6
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Run my program on a different computer?

    Quote Originally Posted by skizzik View Post

    Added after 51 minutes:


    I got otool to work but what should I do with the files it lists?
    What did it show?
    I'm a rebel in the S.D.G.

  7. #7

    Default Re: Run my program on a different computer?

    $ otool -L Program.app/Contents/MacOs/Program

    Program.app/Contents/MacOs/Program:
    libboost_filesystem-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    libboost_program_options-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    QtSql.framework/Versions/4/QtSql (compatibility version 4.6.0, current version 4.6.2)
    QtGui.framework/Versions/4/QtGui (compatibility version 4.6.0, current version 4.6.2)
    QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.6.0, current version 4.6.2)
    QtCore.framework/Versions/4/QtCore (compatibility version 4.6.0, current version 4.6.2)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 438.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

  8. #8
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Run my program on a different computer?

    Basically, this is the list of the libs you need to deploy to another computer, in order for your application to work. Except last 3 libs. I wonder, do you use boost in your application?
    I'm a rebel in the S.D.G.

  9. #9

    Default Re: Run my program on a different computer?

    But how do I deploy them? The files are in the same folder as the program but if I try to open the app on this computer, I get the error:

    Dyld Error Message:
    Library not loaded: libboost_filesystem-mt.dylib
    Referenced from: Program.app/Contents/MacOS/Program
    Reason: image not found

    And if I try to start it from another computer, I get something like "the program is not built for this system". It works only when I start it from inside Qt Creator on this computer. Yes, I use boost.

  10. #10

    Default Re: Run my program on a different computer?

    I have done the steps under "Shared Libraries" at http://doc.trolltech.com/qq/qq09-mac-deployment.html, but for my app and for libboost_filesystem-mt.dylib
    but I still get the same message, the only new thing is that the "Referenced from:" part of the errormessage gives the full path now.

  11. #11
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Run my program on a different computer?

    Quote Originally Posted by skizzik View Post
    But how do I deploy them? The files are in the same folder as the program but if I try to open the app on this computer, I get the error:

    Dyld Error Message:
    Library not loaded: libboost_filesystem-mt.dylib
    Referenced from: Program.app/Contents/MacOS/Program
    Reason: image not found
    Set the library paths by running
    Qt Code:
    1. export DYLD_LIBRARY_PATH="/path/to/libs:/path/to/more/libs"
    To copy to clipboard, switch view to plain text mode 

    Quote Originally Posted by skizzik View Post
    Yes, I use boost.
    What are you using boost for?
    I'm a rebel in the S.D.G.

  12. #12

    Default Re: Run my program on a different computer?

    Quote Originally Posted by lyuts View Post
    Set the library paths by running
    Qt Code:
    1. export DYLD_LIBRARY_PATH="/path/to/libs:/path/to/more/libs"
    To copy to clipboard, switch view to plain text mode 
    Hm, where should I write this? "DYLD_LIBRARY_PATH" is already set to "/opt/local/lib" in the project options, which solved the problem when started from inside Qt Creator but not when i try to start it by double-clicking on the file.


    Quote Originally Posted by lyuts View Post
    What are you using boost for?
    I need them for mongodb, a database used in the program.

  13. #13

    Default Re: Run my program on a different computer?

    Now i have used install_name_tool as described at http://lists.apple.com/archives/xcod.../msg00174.html and http://doc.trolltech.com/qq/qq09-mac-deployment.html. The files changed as they should but the program still show the "Library not loaded: libboost_filesystem-mt.dylib"-error. Anyone have an idea?

  14. #14

    Default Re: Run my program on a different computer?

    If I run otool now, after install_name_tool, I get:

    $ otool -L program.app/contents/macos/program

    program.app/contents/macos/program:
    @executable_path/../Frameworks/libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    @executable_path/../Frameworks/libboost_program_options-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    ...etc

    But when I try to run the program, it says:

    Dyld Error Message:
    Library not loaded: libboost_system-mt.dylib
    Referenced from: ...program.app/Contents/MacOS/../Frameworks/libboost_filesystem-mt.dylib
    Reason: image not found

    What is wrong? Thanks for all help so far, I really need this to work.

  15. #15
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Run my program on a different computer?

    Before running the application set DYLD_LIBRARY_PATH by running that export statement in the same shell.
    I'm a rebel in the S.D.G.

  16. #16

    Default Re: Run my program on a different computer?

    I fixed the problem with the boost libraries so now I can start the program from outside Qt. The only problem now is to get it to work on another computer.

    If I run it one another, it doesn't start and the only thing that pops up is the error-message that says:
    You cannot open the application "program.app" because it is not supported on this system.

    Is this only because Qt isn't installed there or is there other problems aswell? I can't install Qt on every computer I need to run this program on so how can I fix it? If I don't use static linking, how do I deploy it? Can I move some Qt-files with the app or is there another solution?
    Last edited by skizzik; 4th November 2010 at 13:49.

  17. #17
    Join Date
    May 2010
    Posts
    61
    Thanks
    2
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Run my program on a different computer?

    Hi skizzik,

    Have a look also over the docs. http://doc.trolltech.com/latest/deployment-mac.html

    Regards,
    wladek
    One second is long, everything longer than two seconds is definitely too long.

  18. #18
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    287
    Thanks
    23
    Thanked 31 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Run my program on a different computer?

    Check the macdeployqt tool
    __________________________________________________
    My projects: calculator MathGraphica ; SuperEpicMegaHero game ; GooglePlay ; bitbucket ; github
    Like my projects ? Buy me a kofi

  19. #19

    Default Re: Run my program on a different computer?

    I have read the docs and copied the files I got from using otool, into the bundle, and then used install_name_tool to change everything. If i try to run the program on the same mac as before (OsX 10.4.something), I still got that error "You cannot open the application ...". I compiled the program on OsX 10.6.4. Can that cause the problem? And if so, what can I do? I have tried to build it with -universal etc but with the same result.

    Today I tried to run it on an OsX 10.5.8, instead of the "You cannot open the application ..." I only got an error:
    Dyld Error Message:
    Symbol not found:
    __ZSt16__ostream_insertIcSt11char_traitsIcEERSt13b asic_ostreamIT_T0_ES6_PKS3_i
    Referenced from: program.app/Contents/MacOS/program
    Expected in: /usr/lib/libstdc++.6.dylib

    I tried copy that lib into the bundle too, and use install_name_tool. If I open the program, program.app/Contents/MacOS/program, in a texteditor, the new @executable_path are there for the .dylib, but I still got the same error "Expected in: /usr/lib/libstdc++.6.dylib". What am I doing wrong?

    EDIT: I tried the macdeployqt tool too, but with the same result.

Similar Threads

  1. QtCored4.dll is missing from your computer
    By dmateer in forum Newbie
    Replies: 1
    Last Post: 7th May 2010, 20:18
  2. Turn off computer
    By swiety in forum KDE Forum
    Replies: 1
    Last Post: 5th January 2008, 15:40
  3. Replies: 4
    Last Post: 14th June 2007, 05:06
  4. Cell Computer Project
    By genetechnics in forum General Discussion
    Replies: 13
    Last Post: 6th August 2006, 15:38

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.