Deploy Qt program to Windows from Linux - linux

I'm developing a Qt program on Linux which I would like to puplish on Windows too. Compiling and static linking for Windows works well with MXE (qtbase installed) how ever I'd like to link my program dynamically.
Dynamic linking works and the program runs under Wine but when I copy the EXE and the DLLs to Windows the program gives an error: 'This application failed to start because it could not find or load the Qt platform plugin "windows" in "".'
On Windows there's windeployqt that puts everything that the application needs to run neatly in one folder. Is there a way for getting this tool (or similar) running on Linux?

You're missing several files needed around the executable.
Get them under "Qt Dir \ Qt Version \ MinGW Version \ plugins \"
Required :
imageformats\
qgif.dll
qico.dll
qjpeg.dll
qwbmp.dll
platforms\
qwindows.dll (that's what the error is talking about)
(if in Debug mode, use these files with a "d" at the end, for example qwindowsd.dll)
I'm not sure about the imageformats, but I had to use them even in programs not using pictures. Try with "platforms\qwindows.dll" first, then add the imageformats if the programs asks to.
See https://doc.qt.io/qt-5/windows-deployment.html for the full info and more precise options. I'm just giving you the explanation.

Related

how to build a linux-based program for window?

I want to build a inux-based program fully standalone for windows.
And I try to use mingw64 on ubuntu with the command
./configure --host=x86_64-w64-mingw32 --disable-shared --enable-static LDFLAGS="-L /usr/local/lib/"
make
But it failed with
src/libcork/posix/subprocess.c:14:24: fatal error: sys/select.h: No such file or directory
#include <sys/select.h>
^
compilation terminated.
Here is the source code in github:
https://github.com/shadowsocks/simple-obfs
So how can I build the program fully standalone for windows?
May I try the cygwin or msys2?
update:
I find another source code which has been ported.
But when I compiled it with
./configure --host=x86_64-w64-mingw32 CFLAGS="-static" LDFLAGS="-static"
I get an executable file which still needs the libssp-0.dll.
So how can I make the libssp be static linked?
Here is the new source code: https://github.com/Windendless/simple-obfs
I don't think that the functionality in select.h is available on the MinGW version of gcc, because it is not available in the Windows platform. If you're building something that was intended to be built on Windows, then you might find that there are options you can pass to configure that enable a different, Windows-friendly way of achieving the same thing. If you're building something that was only really intended to be used on Linux, then you might be out of luck. In that case, your choices really amount to:
Modify the code so it doesn't require select.h. Some of that functionality might already exist in the Windows Sockets API, with a somewhat different implementation. However, it might equally well not, in which case you'll have to do some work.
Use a Windows compatibility layer that is more feature-rich than MinGW. Cygwin might well work, as might the Windows Subsystem for Linux in Windows 10. However, none of these approaches amounts to building a "standalone" application, because they require some supporting infrastructure.

CMake C:/IntelSWTools/ISSM_2016/tools/compiler/gcc-ia/5.2.1/bin/i586-intel-elfiamcu-gcc is not a full path to an existing compiler tool

I am having issues compiling this project on zephyr.js, the instructions on their GitHub are for Linux however they do have an environment setup for Windows as well which I have completed to the letter.
When I run the compilation using the makefile I get:
CMake C:/IntelSWTools/ISSM_2016/tools/compiler/gcc-ia/5.2.1/bin/i586-intel-elfiamcu-gcc is not a full path to an existing compiler tool.
I am using the msys terminal with MinGW and I have installed CMake separately and configured it... but why is it throwing this error? I have checked, and the file is actually there. If I type C:/IntelSWTools/ISSM_2016/tools/compiler/gcc-ia/5.2.1/bin/i586-intel-elfiamcu-gcc. into the terminal, it also executes the compiler successfully.
Any ideas?
(Before anyone tells me to try on Linux, for now, it is a requirement to use Windows for this project)

How to make self-contained or java-bundled JavaFX application package for ARM

Where could I acquire a working copy of compiled JavaFX app bundled with JRE so I could execute this app on ARM linux?
or
How can I create my JavaFX app + JRE bundle that would work on ARM Linux
Best case scenario for me would be to be ableto create copy-paste enabled folder tree or single executable file..
I do understand that this question might be too vague, but I desperately need some help on this. I have spent more than 6 evenings + 2 nights searching how to get a compiled JavaFX application ( .jar file) to run on ARM linux on UDOO (RPi2-like) board.
I have been more of an .NET guy a long time, and now I had to make WPF-like rich UX app that would run on this specific hardware, and I chose JavaFX due to its likeliness to WPF. It does run fine on my desktop PCs but I absolutely can not get it to run on ARM linux.
I am trying to do this too. Did you get it working? My solution is to package the JAR using tools provided by IntelliJ or any other IDE, include the JRE in a folder within the app, then write a script that invokes the JAR from the included JRE like:
lib/jre/bin/java -jar runthis.jar
I also tried it for two days now but didn't get it to work.
I use maven in combination with the javafx-maven-plugin to build native installers of an application.
At first I got the error, that the javafx-ant.jar tools are missing:
[ERROR] Failed to execute goal build-jar(create-jfxjar) on project foo:
Execution create-jfxjar of goal build-jar failed: Plugin javafx-maven-plugin or
one of its dependencies could not be resolved: Could not find artifact
javafx-packager:javafx-packager:jar:1.8.0 at specified path
/opt/jdk1.8.0/jre/../lib/ant-javafx.jar
Then I found the ant-javafx.jar in a windows JDK but then another error was reported that linux is not supported with this one. Ok so I downloaded a linux JDK and used that ant-javafx.jar. Now it could build and create a *.deb file successfully!
However when I started the installer it failed with a message and when checking the log (/var/log/apt/term.log)
Log started: 2021-04-29 00:40:01
dpkg: Error creating archive
/home/pi/Foo/target/jfx/native/foo.deb (--unpack):
package architecture (amd64) does not match system (armhf)
Then I did research and found the following mailing list entry:
[...] the Java Packager isn’t shipped with any ARM builds that I’m aware of. Currently it is only for X86 Windows, Linux and Mac. [...]
This basically explains it: The packager doesn't work on ARM for now. Maybe we should write the guy to encurage him to add it...
=> So for now I work with the jar directly.

Cross-platform build under Windows targeting Linux using CMake

I am developing a software in C++ on windows 32-bit (using MSVC++), but since I want to be able to use my software on every platform, I have decided to use CMake as my build generator.
Therefore, I am still just a beginner in CMake. From the CMake tutorials, I understand that in order to cross compile codes, first a toolchain simulating the target platform should be installed on the host platform. Then using the appropriate target-platform C and C++ compilers provided by this toolchain, CMake would be able to generate makefiles etc.
Now, I want to build my code for Linux platform(GNU/Linux) on a Win32 platform. I tried doing the above procedure using CMake combined with Cygwin and using gcc and g++ as compilers. It built fine, created makefiles, and when I issued "make" in Cygwin terminal, the generated makefiles were "made". Now I have got an executable which I was hoping would run on Linux platform. But on Linux I get the error: bash cannot execute binary file.
Using command file executablename, I realized the executable which is made by the above procedure is of type PE32 which is only for Windows.
Now my question is: Is my understanding of cross-platform build procedure using cmake correct?Or should I just use another Linux toolchain under windows to get a Linux ELF executable? What toolchains come to your mind which would give me what I want?
Many thanks
Setareh
You will want to look here: cmake-toolchains(7) if you do cross compiling. However, I would suggest that you install a Linux VM like virtual box on your windows machine and build naively on Linux. It will compile much faster and you will not have to worry about cross compiling. You can mount the windows disk from the linux VM so you can share the same source tree. The linux VM will compile much faster than gcc running under windows.
Your understanding of CMake is correct... it will determine how to create the build system you request (or is default for the platform you are currently on) based on rules in your CMakeLists.txt file. However, this won't necessarily help you compile for linux on a windows machine if you don't have something installed that can target linux.
To compile targeting linux, you will need to use a linux compiler. The link posted by #stjin tells you how to install one on cygwin. Then, to set up your CMake build, do this in the terminal:
CC=gcc-linux CXX=g++-linux cmake . [options]
This will tell CMake to locate the special linux targeted compilers. Hopefuly, after compiling with these compilers you will be able to run on linux.

linux, freepascal, fp-ide: No debugger support availble. How to enable debugger?

How to enable debugger in fp-ide? I read somewhere that I should compile fp-ide from sources, but I don't know how to do this. Can someone help me?
Get the generic linux tar installer (fpc-2.6.0.x86_64-linux.tar) for FPC from http://www.freepascal.org/down/x86_64/linux-hungary.var It comes with a precompiled IDE with integrated debugger support and it works fine at least on 12.04 LTS.
I wasn't able to find a PPA for fp-ide, but I can describe how the CLI IDE is compiled on Arch Linux as documented in the repository. Do note that compiling will not enable the debugger in the CLI, as it seems to be an incompatibility between gdb and fp (fp-ide) according to e.g. this bug report in Debian. On Arch Linux, the fpc package also doesn't support the debugger in fp by design (it is explicitly disabled using the NOGDB flag).
Anyhow, here goes the compilation process:
Make sure you have FreePascal installed already, as you need it to compile the IDE
Download the source tarball
Extract the tarball to a location of your convenience and cd into that directory
Execute the following code from within your shell:
pushd fpcsrc/compiler
fpcmake -Tall
popd
make build
make -j1 install
# in Arch, the switch "NOGDB=1" is present in both make lines
That should compile the IDE and install it (you can even try to integrate it in dpkg by using checkinstall instead of make install, but take a look at the Arch PKGBUILD to see an example of what might be needed).
But why do you use the command line IDE fp instead of lazarus? With lazarus you can also make console applications and it offers much more features (e.g. working debug support).

Resources