Build Transmission on Windows

Ask for help and report issues with the Windows version of Transmission
roelof92
Posts: 4
Joined: Tue May 12, 2009 1:58 pm

Build Transmission on Windows

Postby roelof92 » Tue May 12, 2009 2:01 pm

Is it possible/easy to build Transmission on Windows by using the sources, especially now that there's a Qt beta?

rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Build Transmission on Windows

Postby rb07 » Tue May 12, 2009 4:17 pm

Yes and no.

Yes you can build it with the usual ./configure; make; make install under Cygwin.

No for the Qt part, that one is not easy (Qt and Cygwin don't mix easily, and don't confuse the Qt package included in Cygwin, that's for Cygwin/X, not native Windows). But if you are a MingW/MSYS expert you may pull out the whole enchilada ;-)

It would be interesting if someone reports that its been done, and how of course. I haven't tried but I will, and report if there's any success.

roelof92
Posts: 4
Joined: Tue May 12, 2009 1:58 pm

Re: Build Transmission on Windows

Postby roelof92 » Tue May 12, 2009 4:28 pm

Cool, taht would be awesome. I'm not that experienced. I'm at Chapter Four of C++ Primer Plus :D

rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Build Transmission on Windows

Postby rb07 » Thu May 14, 2009 2:07 pm

rb07 wrote:Yes you can build it with the usual ./configure; make; make install under Cygwin.

Lies, all lies... I was wrong about building under Cygwin, it's not that easy.

The first problem under Cygwin are those third-party libraries, libnatpmp and miniupnp only build under MingW, libevent builds fine but I haven't tested if it really works. That means we have to mix native and Cygwin libraries, which is not easy and sometimes doesn't work. The same goes for the Qt stuff which only comes as native libraries. I'll keep trying Cygwin since as development environment is more complete.

It looks like building with MingW/MSYS should be a better (easier) way.
----
UPDATE It does build under Cygwin, no patches necessary with recent Transmission versions.
Last edited by rb07 on Tue Feb 16, 2010 6:04 pm, edited 1 time in total.

guilherme
Posts: 51
Joined: Thu Jan 22, 2009 6:04 pm

Re: Build Transmission on Windows

Postby guilherme » Thu May 14, 2009 10:26 pm

Has anybody tried cross-building it on Fedora?

rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Build Transmission on Windows

Postby rb07 » Fri May 15, 2009 11:07 pm

Partial success under Cygwin: I have transmission-1.61 built, daemon and cli. Have only tested transmission-remote and it works fine... so now on to Qt.

If anybody wants to experiment I can show you my patches, nothing major, just configure and third-party/libnatpmp/getgateway.c need to be changed.

roelof92
Posts: 4
Joined: Tue May 12, 2009 1:58 pm

Re: Build Transmission on Windows

Postby roelof92 » Sat May 16, 2009 12:59 pm

I would like to experiment and test stuff on my Windows partition. Could you send me a small explanation, maybe a little tutorial. I would like to report the results to you by PM.

rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Build Transmission on Windows

Postby rb07 » Sat May 16, 2009 5:00 pm

UPDATE:The procedure below is mostly correct, but the patch is not needed since recent versions of Transmission build out-of-the-box under Cygwin.
------
roelof92 wrote:I would like to experiment and test stuff on my Windows partition. Could you send me a small explanation, maybe a little tutorial. I would like to report the results to you by PM.

Let's see if I don't miss any step:
  • Install base Cygwin, I'm using version 1.7 which is in beta, version 1.5 should work the same. Just download http://cygwin.com/setup-1.7.exe and run through the installation once (without choosing anything), you can read the Cygwin instructions (at their site) to understand why;
  • Install make, gcc, openssl-devel, zlib-devel, diffutils. That's with a second pass with the installer, I also recommend installing and using rxvt instead of the ugly Windows Command prompt terminal;
  • Download transmission's source code;
  • Expand it somewhere, 'tar xvf transmission-1.61.tar.bz2';
  • Download curl's source code (yes Cygwin has curl, but its version 7.16.3 and T's configure complains) http://curl.haxx.se/download.html;
  • Build curl: 'cd curl-7.19.4/; ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-optimize; make; make install' (if you do 'make check' you'll see that 2 (out of 525 or so tests) fail, not important, I didn't check but they where about IPv6 servers;
  • Build transmission with the patch I'll add below: 'cd transmission-1.61/; patch < cygwin.patch; ./configure --enable-daemon --disable-nls; make; make install';
    NOTE: actually I edited Makefile since building under the daemon sub directory was disabled.
That's it, you now have transmission-remote, transmission-daemon, and transmissioncli installed in /usr/local/bin (which should be already on your PATH).

I have only tested transmission-remote, I use it for instance with T running on my NAS:

Code: Select all

transmission-remote 192.168.10.8:9091 -n a:p -l | grep -v Stopped
transmission-remote 192.168.10.8:9091 -n a:p -t 57 -S -t 56 -s -u 15
transmission-remote 192.168.10.8:9091 -n a:p -a /cygdrive/c/tmp/example.torrent


NOTE: the patch below changes also the MingW build, probably disabling it, is not intended to use with MingW or any other Windows build environment.

The file cygwin.patch :

Code: Select all

--- configure.orig      2009-05-14 20:37:47.031250000 -0500
+++ configure   2009-05-15 15:21:13.265625000 -0500
@@ -27564,10 +27564,10 @@
 case $host_os in
 
    *cygwin|*mingw32*)
-     have_msw="yes"
-     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
-     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
-     LIBS="$LIBS -lshell32 -lws2_32"
+#    have_msw="yes"
+#    CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
+#    CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
+#    LIBS="$LIBS -lshell32 -lws2_32"
      transmissionlocaledir="locale"
      if test -z "$host_alias"; then
        hostaliaswindres=
--- third-party/libnatpmp/getgateway.c.orig     2009-05-14 20:32:39.796875000 -0500
+++ third-party/libnatpmp/getgateway.c  2009-05-15 14:13:01.906250000 -0500
@@ -56,6 +56,17 @@
 #define USE_WIN32_CODE
 #endif
 
+#ifdef __CYGWIN__
+#undef USE_PROC_NET_ROUTE
+#undef USE_SOCKET_ROUTE
+#undef USE_SYSCTL_NET_ROUTE
+#define USE_WIN32_CODE
+#include <stdarg.h>
+#include <w32api/windef.h>
+#include <w32api/winbase.h>
+#include <w32api/winreg.h>
+#endif
+
 #ifdef USE_SYSCTL_NET_ROUTE
 #include <stdlib.h>
 #include <sys/sysctl.h>
Last edited by rb07 on Tue Feb 16, 2010 6:06 pm, edited 1 time in total.

rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Build Transmission on Windows

Postby rb07 » Tue May 26, 2009 1:43 am

More progress on the Windows Qt build:

Using the Fedora cross-build tools mentioned by guilherme I managed to do a complete build, forcing it a little (OK, it was a mess ;-)

The result almost works. The application opens, and I can see the torrents on my daemon, but can't open the details (app crashes). Haven't tested much, its no wonder it crashed since the parts I forced to compile have to do with catching exceptions (Qt is all C++ so that part has to work)... my guess is the biggest problem comes from using different versions of the compiler: Qt is built with gcc 3.4.2, the Fedora tools use gcc 4.4.0; there's also a lot of nonsense about the %z formats used all over, that makes transmission-remote useless.

Looks promising nevertheless.

It is much more work than building under Cygwin (and I'm gonna try using the generated Makefile to see if I can get away with it under Cygwin). Its probably better to start with MingW under Windows, still a lot of work since you have to install all the requisites, and the requisites of the requisites, and so on.

rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Build Transmission on Windows

Postby rb07 » Wed May 27, 2009 9:04 pm

Success!!

It turns out that the problems I was running into where Qt problems, not Transmission. And they are well known, also the workaround is well known: make the release version (by default, only the debug version is made).

As an aside, with the Fedora cross-build environment it is very easy to build the Gtk application. I have both now working under Windows XP... and the Qt application only "remembered" the size I set the window after I ran the Gtk application; seems that the first reads something in my user prefs but doesn't write them.

The Qt app has more functionality than the Gtk app, all the latest features. I haven't really tested the Gtk app.

Anyway I think now its time for some people to start testing.

Here's some "eye candy" (Transmission Gtk back / Qt front)
Image

roelof92
Posts: 4
Joined: Tue May 12, 2009 1:58 pm

Re: Build Transmission on Windows

Postby roelof92 » Thu May 28, 2009 2:56 am

Oh! Awesome dude!

susanspy
Posts: 1
Joined: Thu May 28, 2009 6:34 pm

Re: Build Transmission on Windows

Postby susanspy » Thu May 28, 2009 6:48 pm

hello all,


i am susan here, i am confused about Build Transmission on Windows so anyone please explain about this


thanks a lot.


cheers!!!!!!!!!!!!!!!!!!!!

rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Build Transmission on Windows

Postby rb07 » Thu May 28, 2009 7:30 pm

susanspy wrote:i am susan here, i am confused about Build Transmission on Windows so anyone please explain about this

Hi Susan,

The short answer is: you can build Transmission using the MingW tools under Windows. You can also build some of Transmission using Cygwin tools under Windows.

What I showed above is QTr which is the new GUI that came with version 1.61. It uses Trolltech's Qt, it has all the new functionality, and it can be a replacement for the Web Client... which is the way I'm using it: I have transmission-daemon running all day long on a NAS, and I connect to that daemon using QTr (also using the Web Client through Firefox but there are many advantages using Qtr).

The long answer: the build process is long a mildly hard depending on how well you know the MingW tools. I first build it under Cygwin, which is easy for me as I know Cygwin very well... but you don't get the GUI unless you build for XWindows (which also is easy to set up under Cygwin but I didn't want that). Then I built for MingW, which has the advantage that you don't need anything else to run the result under Windows (just application and libraries), but I did it the way its easier for me, thanks to guilherme I used the Fedora cross-build environment, there are many things that need small changes, some of the build I did by hand (since the Makefile had things wrong), but in the end its not difficult.

With a little more time we can put all the changes in Transmission's tickets so they can be incorporated with the main code base and make building under Windows as easy as building everywhere else. Another option is for hosting the Windows installer (which is the end result of the Fedora cross-build effort) somewhere, so there's no need for people to install MingW or any other tools.

Jordan
Transmission Developer
Posts: 2311
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: Build Transmission on Windows

Postby Jordan » Thu May 28, 2009 8:46 pm

rb07: exciting stuff. did you have to make any changes to the code that need to be folded back into svn?

also, if you haven't had your quota of pain yet, would it be possible for you to write up a HOWTO on building the qt client on mingw?

rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Build Transmission on Windows

Postby rb07 » Thu May 28, 2009 9:27 pm

Jordan wrote:rb07: exciting stuff. did you have to make any changes to the code that need to be folded back into svn?

Yes a few, nothing big, most problems are in thirdparty libs.

I didn't make a lot of cleaning, configure needs changes, some Makefile.am also, I just hammered at those parts that were wrong (directly on the Makefile), didn't stop to leave a proper patched version (and probably left my garbage when one thing didn't work and I tried another).
also, if you haven't had your quota of pain yet, would it be possible for you to write up a HOWTO on building the qt client on mingw?

What I did is a Fedora cross-mingw build, those guys have an excellent toolset plus a few needed packages already ported (curl and openssl for example).

My plan is to separate the instructions in 3 parts. For a pure MingW environment only the second part is needed (probably). So the instructions would be:
  • Setting up the Fedora cross-mingw build environment;
  • Building Transmission + QTransmission;
  • Finishing up: the Windows intaller (which is part of the Fedora toolset, but I had to patch and make a few tricks)
I can put a draft on the Wiki.


Return to “Windows Support”