0

I developed a program in Linux because of the libcurl library and a few other libraries that I needed for the project.

I have now finished the project but I need to send it to my client that uses a Windows 10 system. What is the best method of getting the program to them without sending the code over to be recompiled?

jaxdre
  • 36
  • 2
  • 3
    If it is using Linux-specific libraries, such as libcurl, then it cannot be even recompiled for Windows, unless there is some kind of linux-like environment such as MinGw or Cygwin. – Eugene Sh. Apr 01 '20 at 20:20
  • 5
    For future projects it would be advisable to take into account critical considerations such as cross platform support at the start of the project and not at the end. It's much harder to retro-fit compared to designing it in from the beginning. – kaylum Apr 01 '20 at 20:27
  • 3
    libcurl is available for Windows. Get yourself a Windows development environment and a copy of cygwin and start fixing the errors and unexpected results that cygwin doesn't deal with in exactly the same way as (your particular version of) Linux and glibc. – Ben Voigt Apr 01 '20 at 20:50
  • 1
    @EugeneSh.: He may be using Linux-specific libraries, but libcurl isn't one of them. ["libcurl is highly portable, it builds and works identically on numerous platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HPUX, IRIX, AIX, Tru64, Linux, UnixWare, HURD, Windows, Amiga, OS/2, BeOs, Mac OS X, Ultrix, QNX, OpenVMS, RISC OS, Novell NetWare, DOS and more..."](https://curl.haxx.se/libcurl/) – Ben Voigt Apr 01 '20 at 20:51
  • Based on your comments I might be able to do the fix. The only other library I am using is JSON-C – jaxdre Apr 01 '20 at 21:04

2 Answers2

4

What is the best method of getting the program to them without sending the code over to be recompiled?

I see two solutions for this:

  1. Download Windows trial/preview and compile it here
  2. Download mingw and cross-compile with it for Windows.

Probably you're not a fan of first solution, me neither. I found another answer [1] where is stated how to do it (with link to tutorial on Code::Blocks forum [2])

[1] How to compile for Windows on Linux with gcc/g++?

[2] http://forums.codeblocks.org/index.php?topic=3343.0

Please follow answer at [1].

halfer
  • 19,824
  • 17
  • 99
  • 186
elwin013
  • 519
  • 10
  • 19
  • The client is the least capable of recompiling that code. It won’t be a mere recompilation. There will be touch ups to the code, and you’ll spend most time setting up continuous integration. As the first step, get the code onto a private GitHub repo, then link a CO system such as Travis to it, to get the Linux build done automatically on each commit. Then start pulling packages with Windows version of curl etc, and get the build to work. On Windows, for native packages, chocolatey can be treated as a defecto standard package manager. I bet curl already exists there. So it may be easy. – Kuba hasn't forgotten Monica Apr 01 '20 at 23:45
  • Yes. CI in that case is great solution (commit/push, build, allow download built artifact to customer). But if author doesn't want ot set up it this way then both compiling on local W10 or cross-compiling and sending binary is OK solution. :-) – elwin013 Apr 02 '20 at 20:08
  • In any case, you'd need build scripts that do that. So I suggest a chocolatey package install for curl and go from there. – Kuba hasn't forgotten Monica Apr 02 '20 at 20:30
1

If your client has Windows 10, I strongly suggest you to look at WSL: Windows Services for Linux. You can install a Linux distro from the Windows Store, for example Ubuntu.

The Linux running with WSL is not inside a virtual machine, but it is tightly coupled with Windows.

Examples:

  • from Windows task manager, I can see the Linux running processes

  • inside Ubuntu, I can work with my personal files under %appdata% without network (don't need Samba)

  • from the Windows shell you can execute any Linux command, just prepend them with wsl

There are many features, you can play and discover them in half a day. You can discover your program, without recompiling, will work in windows with WSL.

Actually the official windows 10 has wsl 1.

The next windows 10 upgrade will deploy wsl 2, that can run - parallel to windows - a full Linux kernel.

Microsoft sees the uprising of Linux and Android, and the loss of market share. They came up with a ingenious idea: buy Windows and you have both Windows and Linux, cooperating together as easy as possible.

Massimo
  • 3,171
  • 3
  • 28
  • 41