Build in wine with my program - c++

I have developed an application designed for commercial use. Application is based on Qt. But I have to use Themida, the anti-cracking software. So I need to compile this software for Linux/MacOS as well, but there is not any obfuscation software like themida. I have an idea.. Is it possible to embed wine to application? As google picasa for example... If yes then how to do that? Are there any examples...

Is it possible to embed wine to application?
You can't "embed" it, because it is a huge collection of dlls. Another problem is that wine is LGPL, so "embedding it" (static link with LGPL) is "no go" for proprietary/closed-source app.
I think you should be able to link with it dynamically.
2 years ago it was possible to make application link with winelib and get access to wine facilities this way. Haven't tried that myself.
It will be probably easier to simply compile application for windows, and then ensure it works under wine - less hassle. However, if I were you, I'd attempt to find different protection scheme - any scheme that doesn't rely on windows-specific technology. Relying on wine to make your app work isn't a very good idea (IMO).

You do not "embed" Wine. Wine is a set of libraries installed on linux that act as a middle-tier between a windows program and the linux system.
Simply compile your app on Windows, preferably wrap it into an installer with all your dependent .dll's like "themida" and possibly the Qt .dll's.
Then install wine on your linux system, try to install your app and cross fingers ;)

Related

How can i make a portable C++ program for Windows with GUI, independent from .NET or other Libs?

I want to make a C++ program with Graphical User Interface, to be running on Windows platforms.
I want it to be independent from any libraries like .NET.
The reason I want this is because I want this program to be able to run everywhere, in every version of Windows (XP, VISTA, 7 - 32 & 64bit) without the user to be bound to have already installed a library like .NET.
Also, I want it to be portable: the whole program to consist from only one exe file.
So to summarize:
How can I make an one-exe-file GUI C++ program, able to run on all versions of Windows, without the need of pre-installed libraries on Windows from the user that uses it?
I have already MS Visual C++ 2010 Express and Eclipse with Cygwin's G++ compiler installed on my system.
Notice: I don't mind to use any libraries for windows GUI design if there is a way to embed them inside the executable file of the program.
You can either use a library that can be statically linked (MFC, WTL) or use Win32 API directly.
WxWidgets have static linking capability, never tried it myself.
If you want portabiliy, and yet don't want to depend on 3rd party libraries... well you'll have to provide portability yourself! Don't do it! As adviced by OneOfOne, use Qt and be impressed how simple yet powerful it is. Good luck!
You can also use Qt5, works great on windows and when you figure out that windows isn't the only OS out there, you can easily port it to everything else.
License issues : Proprietary Source code + LGPL Source code

How to use a windows .lib on linux using WINE

I have been using Qt (uses c++ code + Qt libraries) on the windows platform and am in the process of porting my project onto the Linux platform.
Using Qt this has been a very simple process and my project works on the Linux platform with barely any changes required.
However, we need to use a 3rd party windows compiled .lib with an associated header file. Clearly this file cannot work under Linux, but I have been reading posts that suggest I could use Wine to do this.
So in general my project will work as a normal Linux (Ubuntu) project, but I would like to include this .lib file using Wine. I have not been able to find a definitive answer "how to do this". I am not sure if you use Wine to translate the .lib into a .so file or if you have to statically link it in with some "Wine-like" convention...
Can anyone help point me in the right direction?
Thanks :)
AFAIK, you can't make hybrid applications with Wine (i.e. link C++ Linux executable with some Linux static libraries and Windows static libraries).
One of the solution I suggest is to encapsulate you Windows library in a Windows program that act as some network service, then you make your Linux application talk to your Windows library through the network.
However, it adds complexity to your software, requires you know how to do some network programing (however, these days it is quite easy to do) and is not suitable to every kind of library, especially if your library has some kind of GUI.
Have you tried compiling under Windows and running the entire program under Wine?
I'm not sure you can splice Wine and Linux programs.
I cannot imagine that a hybrid approach would work. In any case, running part of your program as a native application and the other part inside WINE will not give you much advantage over the complete program running in WINE. In either case, WINE is needed.
The main disadvantage of running the complete program in WINE is the look and feel of the GUI which might look a little alien to the system. However, using a proper setup for WINE will minimize the problem. And as a side note, most Linux users are used to different GUI concepts due to the different desktop environments available. Personally I have a lot of GNOME applications running in my KDE desktop.
I would personally try running your program in WINE. It makes development much easier. A circuit simulation tool that is quite famous with electrical engineers uses this approach. It is called LTSpice. While only Windows binaries are available, the developers test it with WINE to ensure that it runs on Linux. Admitted, it is a tool offered for free but the community accepts this approach.

Advantage of winelib?

Are there any advantages to compiling my Windows application with winelib for Linux users? Why not just give them the .exe and let them run it with Wine? Seems just like extra work for no gain.
You might want to read on Advantages and Disadvantages of using Winelib.
Quoting Chapter 1. Winelib Introduction - 1.1. What is Winelib? :
What you gain by recompiling your
application with Winelib is the
ability to make calls to Unix APIs,
directly from your Windows source
code. This allows for a better
integration with the Unix environment
than is allowed by running an
unmodified Windows application running
in Wine. Another benefit is that
a Winelib application can relatively
easily be recompiled on a non-Intel
architecture and run there without the
need for a slow software emulation of
the processor.
See this
Anon: I take it that means all winelib-ported apps are NOT true linux binaries - but some >half-breed between win32 binaries and Linux binaries? What is then the advantage of porting >(using winelib)as opposed to running win32 binaries under wine?
Dimi Paun: They are true Linux binaries (ELF format) but they need a bit of setup (for >Windows compat) before they start. But yes, running the Win32 (PE) executables instead is >a true possibility, same speed, etc. But having a Winelib port allows you to better >integrate with the Unix env, which may be what you want for a 'true' Linux app.
One good reason is that it might provide some insurance against regressions in Wine. If you test your code with version A of Winelib and statically link that version with your program, then regressions in a newer version of Wine can't break you.
Googling a bit on the topic seems to show that compiling against winelib is a way to improve wine by putting in evidence issues at compilation which shouldn't arise if wine (hence winelib) was a perfect win32 api implementation replacement.
For your application in itself, it's a way of checking compatibility with wine.
I think there is a point in dividing application into OS-independent .exe and several OS-specific .dll, .dll.so and .dll.dylib libraries. These dynamic libraries will make it possible to access Mac OS X and Linux APIs from a single exe.

Which install system to pick when deploying to Windows and Linux?

My company is thinking of dumping InstallShield and move to something else, mainly because of the poor experience it had with it, mostly on Linux.
Our product is a C++ application (binaries, shared libraries) targeted at Windows and Linux (Red Hat).
The installer itself isn't required to do anything special, just dump some binaries and shared libraries and sometime execute an external process. Things like version upgrading through the installer isn't necessary, this is handled after the installer finishes.
I thought of suggesting using NSIS on Windows and RPM on Linux.
What are the recommended installer systems to use when deploying to Windows/Linux? Something that is cross platform to prevent maintaining two installers is a definite plus.
For Windows I would definitively use NSIS. It's very lightweight, easy to code and very simple to understand. Using msis would just be a killer - it generates guid for every file so you can get upgrades for free and stuff but truth being said, you never end up using any of these.
Regarding Linux I would go for RPM and Deb. They're probably the two biggest packaging system so you'll be targeting most of the Linux users. I've never tried RPM but creating a Deb package is fairly straightforward.
See also:
What to use for creating a quick and light setup file?
Packaging to use to deploy cross-platform?
And even:
Creating installers for complex cross-platform programs
There's a tool called BitRock Installer which can create installers for Windows, Linux and OS X.
However, I think that if you target RedHat it would be better to provide native packages for that platform (that is .rpm).
For C++ projects, I'd go with cmake/cpack, if you are also willing to change your build system. Great support, strongly cross-platform. cpack has various generators, NSIS is one..
Take a look at InstallJammer. It will handle both platforms from the same build project, and you can have the installer register the package with the RPM database as well if that's your requirement.
You may want to consider our tool BitRock InstallBuilder , it can generate installers for Windows and Linux from a single project file and also RPMs. Is your application based on Qt? Our clients include the makers of Qt, Nokia (previously Trolltech) and they use it to package their Qt Creator product. We encourage to give InstallBuilder a try and contact our support with any questions or suggestions you may have.

C++ development for Linux on Windows

I am trying to setup a development environment for Linux C++ application. Because I'm limited to my laptop (vista) which provides essential office applications, I want to program and access email, word at the same time.
I'd prefer a local Windows IDE. SSH to a company linux server and using VI doesn't seem productive to me. Even using some IDE installed on the linux server doesn't seem good to me, because I can't do the work at home.
So does Eclipse CDT + MinGW work for me, or is there any other choice?
Thanks.
ZXH
Why not install a Linux virtual machine on your laptop, in VMware or similar? That way you can test while you're developing too.
You can also try http://cygwin.com/
Is it a GUI app? And do you have to target Linux specifically? If not, Qt (http://trolltech.com/) may be something that you can use. It would allow you to more or less develop your whole application on Windows, and then spend a few hours on a linux machine getting the whole thing ported...
Qt is the best choice. I develop with tis tool for a long time. And you can develop with the same ide : QtCreator and the same framework : Qt on MacOS, Linux based or Windows plateform...
Moreover, specifically on Linux, Qt is well integrated with Kdevelop !
If you have Visual Studio, which I feel is an excellent IDE, you can try to set it up to use GCC/G++. I've done this before, back in the Visual Studio 6 days. As long as you aren't using any Windows-specific libraries and write portable C++, you can compile and test on Windows, then periodically ensure that the code also compiles properly for Linux.
Another approach, one that I actually prefer, is to host your source and make files on the Linux box, share the files through Samba, then use your Windows IDE/text editor to edit those files. Then, you can do the compiling through an SSH terminal. Sure, you'd lose the convenience of being able to compile through your IDE, but at least you wouldn't have to muck around getting the compiler set up on Windows.
If you have a linux server available to you, you could also use NX to log in graphically, and use a Linux IDE there like Code::Blocks, or shudder Eclipse. Of course, there's nothing unproductive about shelling in and using VIM. I find it's a good way to shake out the IDE-induced cobwebs every now and again. Happy coding however you end up doing so!
I use (and recommend) Netbeans for C/C++ Development together with Cygwin to develop POSIX applications on Windows that will run on Linux/Solaris later on.
It is pretty easy to setup as long as you stick to the stable version of Cygwin.
I was in a similar position 2-3 years ago and tried several approaches, but the only one that really worked wor me was vim+ssh (+gdb, make, svn, etc). But again, I use vim even for Windows development.
This slideshow (PDF) walks through how to set up a cross compiler from Windows to Linux.