pcb-rnd knowledge pool


How to cross-compile pcb-rnd 2.1.4 to windows on *nix

win32-cross-2.1.4 by Tibor 'Igor2' Palinkas on 2019-10-25

Tags: howto, cross-compile, win32, windows, exe

node source



Abstract: This howto is about compiling stable release 2.1.4. It was the first release with official windows support, before the infrastrcuture for cross compiling became mature enough in pcb-rnd, thus a lot of manual patching and tweaking is involved.

  The below manual process is the temporary solution for cross-compiling pcb-rnd to windows. The steps marked with * are due to bugs that will eventually be fixed. (There is another node about cross-compiling more recent versions )

  1. download the binary development pack of hidlib.w32 (alternatively: cross-compile it)
  2. install the hidlib.w32 pack; this document assumes it is installed under ~/w32-rnd, but it can be placed anywhere
  3. make an svn checkout of pcb-rnd from svn://repo.hu/pcb-rnd/trunk
  4. copy configure.w in trunk/scconfig/configure.w and make it executable (chmod 775 configure.w)
  5. copy crossw32.conf in trunk/scconfig/crossw32.conf
  6. * edit crossw32.conf: replace any ~/w32-rnd/ with the path where hidlib.w32 got copied to. Note: do not use ~ in the path, replace it with full path, e.g. /home/... or /usr/lib or /tmp; ~ or shell variables like $HOME will not work.
  7. * cd trunk/scconfig; apply this patch
  8. * cd trunk/src_3rd/puplug; apply this patch
  9. * cd trunk/src_3rd/libfungw; apply this patch
  10. * cd trunk/src; apply this patch
  11. * cd trunk/src_plugins; apply this patch
  12. cd trunk/scconfig; ./configure.w
  13. * edit trunk/config.h: path separator "\" and '\' should be "\\" and '\\'
  14. * edit trunk/config.h, replace original paths with:
    #define PCB_PREFIX pcb_w32_root
    #define PCBSHAREDIR pcb_w32_sharedir
    #define PCBLIBDIR pcb_w32_libdir
    #define BINDIR pcb_w32_bindir
  15. * edit src/Makefile and remove -Dinline= from any CFLAG* variable
  16. cd trunk/src ; make all_exe

This will probably fail at some stage because of two bugs that need to be manually fixed up:

  1. * cd trunk/src_3rd/puplug; recursively delete every *.o and *.a file then: CC=i686-w64-mingw32-gcc make; make sure util/puplug remains a host-executable elf
  2. * cd trunk/src_3rd/libminuid ; CC=i686-w64-mingw32-gcc make

Once these are done:

  1. * rm trunk/src/buildin.h
  2. * cd trunk/src ; make all_exe

This should produce trunk/src/pcb-rnd.exe.

The whole, zippable pack is produced by pcb-rnd.w32.pack.sh : it should be copied to trunk/ and ran from there. It contains configuration at the top of the script (paths should be changed).