Building Under Cygwin

From Sharpfin
Revision as of 20:52, 4 January 2012 by Philipp (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

I wanted to try building under Cygwin for convenience as opposed to using my Linux box. Here are the problems I encountered using an virgin checkout of the source tree from Git. I had already installed the cross compiler for Cygwin with no problems so I'll preume you have too.


[1] "Can't execute binary file" error message during build

I think this first happened trying to run fixdep.exe from [root]srcipksharpfin-base-ipkusyboxscriptsasic This file should be build to run on the host system, but I had and old ELF32 there when I downloaded the source tree from git. Whenever you get this message, go to the relevant folder and delete any intermediate and target files (.o .exe ELF32) to force a tidy rebuild. This should take care of it.


[2] _libintl_gettext library not being found

This library doesn't seem to be included in the Cygwin build. There are a few Makefiles you will need to edit here. As an example, here is the patch for my [root]srcipksharpfin-base-ipkusyboxscriptskconfigMakefile I found this patch on the web somewhere but unfortunately didn't note the URL to give the originator proper credit. My bad.

The lines to add begin with >>>

   HOSTLOADLIBES_gconf	= `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
   HOSTCFLAGS_gconf.o	= `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
                             -D LKC_DIRECT_LINK
   
   >>> HOST_OS := $(shell uname -o)
   >>> ifeq ($(HOST_OS),Cygwin)
   >>> HOSTLOADLIBES_mconf = -lintl
   >>> HOSTLOADLIBES_conf = -lintl
   >>> endif
   
   $(obj)/qconf.o: $(obj)/.tmp_qtcheck


[4] "Invalid owner" message

Somewhere in the build output you have an error message like this:

   chmod -R 755 files
   ../../../devtools/bin/ipkg-build -o root -g root files
   tar: root: Invalid owner
   tar: Error is not recoverable: exiting now
   tar: root: Invalid owner
   tar: Error is not recoverable: exiting now
   ar: ./data.tar.gz: No such file or directory

This is because there is no root user in Cygwin. I'm not sure if the way I solved this is the correct way to do it. I think it may leave files with the wrong owner or group in the output image, so which may me a problem if you flash the image into the radio - I'm not planning to do this and only needed the toolchain to build. Anyway, this owner is set in the following five makefiles and you will need to change it in each one. It's the argument to the -o option.

   sharpfin-base-ipk
   sharpfin-ftpd-ipk
   sharpfin-httpd-ipk
   sharpfin-telnetd-ipk
   sharpfin-www-ipk


[5] zip command not found

Make sure you have a zip installed in the PATH for Cygwin. I didn't have one in mine and this will cause the build to fall. I got mine from here: http://mirror.calvin.edu/cygwin/release/zip/


That's it. I hope this helps.