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?
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.
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.
Re: Run my program on a different computer?
Quote:
Originally Posted by
skizzik
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.
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?
Re: Run my program on a different computer?
Quote:
Originally Posted by
skizzik
Added after 51 minutes:
I got otool to work but what should I do with the files it lists?
What did it show?
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)
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?
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.
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.
Re: Run my program on a different computer?
Quote:
Originally Posted by
skizzik
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
Code:
export DYLD_LIBRARY_PATH="/path/to/libs:/path/to/more/libs"
Quote:
Originally Posted by
skizzik
Yes, I use boost.
What are you using boost for?
Re: Run my program on a different computer?
Quote:
Originally Posted by
lyuts
Set the library paths by running
Code:
export DYLD_LIBRARY_PATH="/path/to/libs:/path/to/more/libs"
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
What are you using boost for?
I need them for mongodb, a database used in the program.
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?
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.
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.
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?
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
Re: Run my program on a different computer?
Check the macdeployqt tool
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.