Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Help making my Qt program cross-platform.
Ok so using Qt on Linux Ubuntu 12.04. I designed a GUI application that just encrypts a message. I want to make it so It works on Windows.
So that leaves me with two questions.
- How do I know the dependencies of my program?
- How do I find those dependencies in the Qt folder?
As i undertood you right you want to copy your linux compiled binary files to windows with all it's dependencies?!
If yes, that's not what it's meant by "cross-platform compatibility" ;) Only the source code you write in Qt is ... so you have to compile your source code on a windows machine against a windows-compiled Qt version.
well I know that I don't have to compile it on a Windows computer. I want to just include with executable, the libraries we need. That way everybody that uses it doesn't have to download Qt. Or if someone could point me to an article that tells me how to make a Install wizard that downloads the libraries for the program that would also be fine.
There are tools that let you compile a windows *.exe on a linux machine, but you definitely have to compile 2 separate binaries...
And this would also apply to your install wizard...
How do you know the dependencies of a linux application? ldd /your/application is your friend there.
The binaries you build on Linux will not work on Windows though. You can try to cross-compile the code for Windows on a Linux platform with mingw, but that is an advanced topic. In any case you will need to test your binaries on all platforms to make sure they work properly everywhere.
Ok then what would one of those tools be?
[quote author="Tobias Hunger" date="1368196219"]In any case you will need to test your binaries on all platforms to make sure they work properly everywhere.[/quote]
...and if you use windows for testing, you can use it for compilation as well, that's much easier ;)
Ok so If i download and install Qt on a windows computer can i delete it off after I'm done compiling and my program still work?
yes, but you have to deploy the correct qt-dlls with it
Not if your program actually uses Qt. It will need (some) of the shared libraries then. Dependency walker will show which. Please make sure you also include the plugins to the libs you need. Dependency walker will most likely not list those as they are not linked into the binaries (that is why they are plugins;-).
Tools like strace on linux and a file system monitor (not sure what the name was, it is part of the sysinternal tools IIRC) will help to catch those.
I don't think It actually uses Qt. It uses Qt types though. (QString, QComboBox, QByteArray, QString, QTextEdit, QLabel). And I'm on linux So i can't use Dependency Walker. Is there a linux version? And Where can I find the plugins for the Libraries.
bq. I don’t think It actually uses Qt. It uses Qt types though. (QString, QComboBox, QByteArray, QString, QTextEdit, QLabel).
That is "using Qt".
bq. And I’m on linux So i can’t use Dependency Walker.
See my previous post: ldd /your/application is your friend there.
bq. And Where can I find the plugins for the Libraries.
That depends on the library. strace will show you what your program tries to open (grep for "^open").
On linux you might want to do packages for your distribution(s) of choice. You just need to depend on the Qt packages then and don't need to bother about plugins, etc. The package management will make sure they are available for you.
On windows on the other hand you will need to copy the libraries and plugins yourself into the right places. There is some documentation on moving Qt libraries around... since there are paths compiled into the binary that is not straight forward. You will want to read up on that for windows.
linux-gate.so.1 => (0xb779f000)
libQtGui.so.4 => /usr/lib/i386-linux-gnu/libQtGui.so.4 (0xb6cb0000)
libQtCore.so.4 => /usr/lib/i386-linux-gnu/libQtCore.so.4 (0xb69d3000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb68ed000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb68cf000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb6726000)
libfontconfig.so.1 => /usr/lib/i386-linux-gnu/libfontconfig.so.1 (0xb66f2000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb66d7000)
libaudio.so.2 => /usr/lib/i386-linux-gnu/libaudio.so.2 (0xb66bd000)
libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb65c4000)
libpng12.so.0 => /lib/i386-linux-gnu/libpng12.so.0 (0xb659a000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb6584000)
libfreetype.so.6 => /usr/lib/i386-linux-gnu/libfreetype.so.6 (0xb64ea000)
libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb649a000)
libSM.so.6 => /usr/lib/i386-linux-gnu/libSM.so.6 (0xb6491000)
libICE.so.6 => /usr/lib/i386-linux-gnu/libICE.so.6 (0xb6477000)
libXi.so.6 => /usr/lib/i386-linux-gnu/libXi.so.6 (0xb6467000)
libXrender.so.1 => /usr/lib/i386-linux-gnu/libXrender.so.1 (0xb645d000)
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb644a000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb6316000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb62ea000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb62e5000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb62dc000)
libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0xb62b1000)
libXt.so.6 => /usr/lib/i386-linux-gnu/libXt.so.6 (0xb6255000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb6251000)
libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb6215000)
libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb620e000)
libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xb6207000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb61e6000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb61df000)
That is all that it gives me for ldd. do I need all of these?