User:Maffblaster/Drafts/Prefix Cygwin

This article provides Article description::instructions for any poor soul attempting to bootstrap Gentoo Prefix on Cygwin.

Windows, and the fork system call
Unix/Linux based package managers usually do require the fork system call, which is not available in Windows in general. Nevertheless, Cygwin implements the fork system call using the CreateProcess and LoadLibrary Windows calls, combined with sophisticated duplication of process memory, loaded libraries and open handles into the child process.

But this requires CreateProcess and LoadLibrary to locate the very same binaries (executable and dlls) as loaded in the parent process. Now imagine what happens when the package manager has replaced these binaries, while existing processes (including the package manager itself) still want to fork.

Requirements
Fortunately, Cygwin 3.0 (not released yet -- April 2017) or newer provides an improved implementation of the fork system call, which is able to deal with removed or updated binaries. As this implementation uses hardlinks, the binaries are required to reside on the very same file system as the /var/run/cygfork/ Cygwin directory, and this file system to be of type NTFS, as other Windows file systems do not support hardlinks.

However, this fork feature is disabled by default.

So this is what you need to provide for Gentoo Prefix: bash$ mkdir --mode=a=rwxt /var/run/cygfork
 * An NTFS file system for the Cygwin installation to install into.
 * This very same NTFS file system for Gentoo Prefix to install into.
 * Cygwin 3.0 (or higher), or a cygwin1.dll with the "forkables" patches applied.
 * The /var/run/cygfork/ Cygwin directory, as Cygwin setup does not create that for you:
 * Reboot your Windows, to make sure the initial Cygwin process started already finds the /var/run/cygfork/ directory in place, to actually activate the fork handler for removed or replaced binaries for this Cygwin instance.

Install Gentoo Prefix
Simply follow the general bootstrap process.

= Old Instructions, to be removed =

Preface: Prefix on Cygwin
How to bootstrap Gentoo Prefix on Cygwin?

Overview
At the beginning you find some general advice and how to set up Cygwin. Those chapters that cover the bootstrapping process are divided into a "Walkthrough" followed by "Issue" handling in case if something goes wrong.

As recommended by the Prefix team follow the manual bootstrap process. Be advised to follow that document in parallel in a second browser view. This wiki page is kind of an overlay to that guide.

Sadly as of 2014 unless you are running Windows [version] Ultimate, Windows [server edition version], or < Windows 7 Interix or SFU(Services for UNIX) is not available for your environment.

What is this?
For the beginning this is rather a log of a single users efforts to install Gentoo Prefix on Cygwin. There is no report that anybody has done that successfully before, but Nimish Pachapurkar got quite far. Maybe he did it, we don't know.

There was also a project "Gentoo on Cygwin" which is unmaintained as of 2008. Note the difference to "Gentoo Prefix on Cygwin". "Gentoo Prefix on Cygwin" is not a project itself but simply a try to run the well maintained "Gentoo Prefix" sources on Cygwin.

So this is a work of progress by nature. If the little pioneer gives up half the way, his experiences should not fully be lost. Hence, here they go in the hope that they may be of use for others that follow his trail.

Why do this?
Running Prefix on Cygwin provides the same runtime environment on Windows as possible on Linux or Mac. It brings much more options than a Java runtime environment and it requires less resources than a virtual machine. Additionally, any program can be compiled by using Gentoo's package manager. Finally, all this happens in the userspace which provides independence from the administrator acocunt. Nothing compares to this.

General issue handling
Before you start with bootstrapping have a look a this general strategies when you run into trouble. Having this strategies in mind will save you a lot of time.

First aid
Try this as far as the directories or files are already installed:


 * Assure the Windows editor files are all set to Unix format.
 * Close open files while emerging.
 * Cygwin: rebaseall
 * Cygwin: rebaseall
 * Cygwin: rebaseall
 * Cygwin: rebaseall

Rebasing packages
If you know how to use great! it has been said that DLLs referencing memory lower than about 0x60000000 need to be rebased.

If you start not seeing your files or things start acting funny, close all your Cygwin terminals and do these commands. Try what you were doing again. Then, ask for help.

Open a windows command shell :

This only rebases DLL installed with but, it is good enough to get you started again if you happen to need to wipe your prefix and start over.

Windows/Cygwin have often troubles with memory addresses of moved DLL See PE. Especially with those of Perl and Python. As you may know emerge uses Python to do its grunt work and will fail if one or more of its libraries have moved without every involved DLL knowing.

The "rebaseall" script was made just for this purpose. It hides the (most) gory details of non-global-offset-style executable.

For more information view README file:

Creating a DLL list for the rebase program
Create a script to generate :

Alternatively, open a new file and put this in it (assuming you have a BASE variable} already set in the env):

Running the script:

Result is a file called.

Rebase all with user list
Use the  option to set the user list. Open a windows command shell (cmd):

Or make a with the above plus PAUSE on the next line.

Strategies to debug

 * Emerge packages one-by-one:


 * Execute single emerge steps:


 * Go to work directory and try:
 * followed by {{c|make and {{c|make install}}

QA complaints: explicit EPREFIX but target not found
Symptom: QA Notice: the following files use invalid (possible non-prefixed) shebangs: some/path:/shebang/path (explicit EPREFIX but target not found)

Reason: This was a meanwhile fixed bug. Reason is  in function  : if ${line[0]} == ${EPREFIX}/*  ; then if ! -e ${ROOT}${line[0]} && ! -e ${D}${line[0]}  ; then                   ## < This line. ##   # hmm, refers explicitly to $EPREFIX, but doesn't exist, # if it's in PATH that's wrong in any case Solution: Fabian Groffen writes: Ok, I see,  is probably the right thing to use here. Same for, should be.
 * 1) does the shebang start with ${EPREFIX}, and does it exist?

QA complaints: in PATH but target not found
Symptom:

QA Notice: the following files use invalid (possible non-prefixed) shebangs: some/path:/shebang/path (in PATH but target not found) ...

Reason: A package has missing  in the first line of some bash scripts.

Workaround: Disable death penalty for shebang issues. Interpreters are usually found in PATH.

End of  function  :

install_qa_check_prefix { [...]   fi }
 * 1)           die "Aborting due to QA concerns: invalid shebangs found"

QA complaints of missing gen_usr_ldscript
[...] Workaround: Disable this quality check. We don't need gen_usr_ldscript at all on windows.
 * QA Notice: Missing gen_usr_ldscript for libbz2.so

Lines 438 of :
 * 1)  ${abort} == "yes"  && die "add those ldscripts"

unable to read SONAME
Symptom:

gen_usr_ldscript: unable to read SONAME from libiconv.so

Reason:  doesn't cover cygwin and the default case doesn't work.

Solution: Don't use this for Cygwin. Simply return for now. Edit  line 518:

gen_usr_ldscript { return 0 } XXXgen_usr_ldscript {

Collisions
Sympton: Collisions while installing a package.

Reason: Often a previous installation did break.

Solution: env FEATURES="-collision-protect" CHOST="i686-pc-cygwin" emerge --oneshot --nodeps libiconv

Cannot find *.so or *.dll
Symptom: a package can't find it's library

Reason: On windows shared libraries have to be in PATH.

Solution: Extend the PATH. See and.

Warnings you can ignore

 * QA Notice: Package has poor programming practices which may compile
 * fine but exhibit random runtime failures.
 * src/pch.c:116: warning: implicit declaration of function "setmode"

/home/prefix/gentoo/usr/lib/portage/bin/ebuild-helpers/prepstrip: line 98: scanelf: command not found /home/prefix/gentoo/usr/lib/portage/bin/ebuild-helpers/prepstrip: line 186: scanelf: command not found

gcc: unrecognized option '-R/home/prefix/gentoo/usr/lib' gcc: unrecognized option '-R/home/prefix/gentoo/lib'

[something] seems to ignore the --datarootdir setting

Installing Cygwin
Cygwin comes with a full featured installer that explains itself. http://www.cygwin.org/setup.exe

Space and paths
Before installing Cygwin consider the pathname. Create a windows user account without whitespace in the username. Not all scripts can handle whitespace in pathes. Have enough free space, minimum 4 GB, take 10 GB if available.

Let's assume you choose "prefix" as username and you install Cygwin on P:\cygwin (mnemo for Prefix Cygwin).

Windows perspective: P:\cygwin\home\prefix Cygwin perspective: /home/prefix

User and permissions
Install Cygwin from the same windows account that you will use to run it. This way you avoid some trouble with user permissions and administration.

Basic packages
gcc4, wget, make, patch, python

For fast edits from the shell install an editor of choice: vim, nano, pico, ...

Install a terminal that supports copy and paste: mintty

BASE, EPREFIX, and OVERLAY variables
Define directories:

You can play with this.

.bashrc setup
Append the following code to the bottom of file:

Then source the newly edited file:

Download bootstrap-prefix.sh
The initial bootstrapping is done by. Fetch it and make it executable.

Easy mode
Run the script without any options and it goes into interactive mode doing the hard work for you. If you would like to do it on your own ignore this step:

Main Gentoo repository
Setup the main Gentoo repository:

Portage
Download and install Portage:

After this completes, the command will be available for use in the  directory. First set the PYTHONPATH variable so that the python interpreter will be able to find the Portage modules:

It should be possible to run the command now:

Be sure to sync to get the latest updates:

Build customization

 * ${EPREFIX}/tmp/etc/make.globals
 * Prepare this file for bootstraping.


 * ${EPREFIX}/tmp/etc/
 * Make a symlink named make.profile here to


 * ${OVERLAY}/profiles/prefix/cygwin/make.defaults
 * Some values have automatically been added for: CPPFLAGS, LDFLAGS , USE , and FEATURES variables.

Overlay setup
To customize some ebuilds create an overlay.

Issues
There are never not issues =)

Cygwin installations
Run to install following packages:


 * automake (autoconf and perl will be included)
 * sources of coreutils
 * libiconv

Fix QA complaints
See:, , file=${EPREFIX}/usr/lib/portage/bin/misc-functions.sh

sed -i 's/${ROOT}${line/${ROOT%\/}${line/' $file sed -i 's/${D}${line/${D%\/}${line/' $file

sed -i 's/\(.*die.*invalid shebangs.*\)/#\1/' $file

sed -i 's/\(.*add those ldscripts.*\)/#\1/' $file

Disable gen_usr_ldscript
Edit the file (line 518):

{{FileBox|filename=${EPREFIX}/usr/portage/eclass/toolchain-funcs.eclass|lang=bash|1= gen_usr_ldscript { return 0; } XXXgen_usr_ldscript { }}

emerge sed
The magic sauce needed to get emerge to run without bootstrap-prefix.sh is without this you will be left high and dry when you do your emerge. if you would like to keep your configs out of the ${EPREFIX}/tmp dir then you should set PORTAGE_CONFIGROOT=${EPREFIX}

Here is where you begin filtering your ebuild blockages

You should have done rebaseall after you have installed python. If not do it now to be able to run emerge. results:

bin/sed.exe

emerge ncurses
the program cmp is needed for ether this build or the previous it is avalable through cygwin as diff-tools? this particular build also requires a pid command for the ${EPREFIX}/tmp/usr/lib/portage/bin/helper-functions.sh script.

emerge --oneshot ncurses

results:

usr/lib/libform.a usr/lib/libform.dll.a usr/lib/libmenu.a usr/lib/libmenu.dll.a usr/lib/libncurses++.a usr/lib/libncurses.a usr/lib/libncurses.dll.a usr/lib/libpanel.a usr/lib/libpanel.dll.a usr/bin/captoinfo.exe -> tic.exe* usr/bin/clear.exe* usr/bin/cygform5.dll* usr/bin/cygmenu5.dll* usr/bin/cygncurses5.dll* usr/bin/cygpanel5.dll* usr/bin/infocmp.exe* usr/bin/infotocap.exe -> tic.exe* usr/bin/ncurses5-config* usr/bin/reset.exe -> tset.exe* usr/bin/tic.exe* usr/bin/toe.exe* usr/bin/tput.exe* usr/bin/tset.exe*

emerge bash
emerge --oneshot bash

results:

bin/bash.exe

emerge wget
emerge --oneshot wget

results:

usr/bin/wget.exe

emerge baselayout-prefix
emerge --oneshot --nodeps baselayout-prefix

results:

sbin/depscan.sh sbin/env-update.sh  sbin/functions.sh  sbin/runscript.sh

etc/env.d/00basic etc/env.d/99basic etc/profile

update ~/.bashrc
Now we source ${EPREFIX}/etc/profile when entering a shell.

echo "source ${EPREFIX}/etc/profile" >> ${HOME}/.bashrc source ${HOME}/.bashrc

extend PATH for shared libraries
In windows shared libraries are searched in PATH.

echo "PATH=\"${EPREFIX}/usr/lib:${EPREFIX}/lib:${EPREFIX}/opt/bin:${EPREFIX}/usr/sbin:${EPREFIX}/sbin\"" >> ${EPREFIX}/etc/env.d/00basic env-update && source ${EPREFIX}/etc/profile echo "PATH: $PATH"

The DEFAULT_PATH has already been set in

emerge xz-utils
emerge --oneshot xz-utils

results:

usr/lib/liblzma.dll.a usr/lib/liblzma.la usr/bin/cyglzma-0.dll usr/bin/lz* usr/bin/xz*

Note: Only few installed programs have an .exe suffix.

emerge m4
emerge --oneshot m4

results:

/usr/bin/m4.exe

emerge flex
emerge --oneshot flex

results:

usr/bin/flex.exe usr/bin/lex usr/lib/libfl.a usr/lib/libfl_pic.a usr/include/FlexLexer.h

emerge bison
emerge --oneshot bison

results:

usr/bin/bison.exe usr/bin/yacc usr/bin/yacc.bison

emerge gnuconfig
emerge --oneshot gnuconfig

results:

usr/share/gnuconfig/config.guess usr/share/gnuconfig/config.sub

emerge binutils-config
emerge --oneshot --nodeps binutils-config

results:

usr/bin/binutils-config usr/lib/misc/binutils-config/binutils-config.h usr/lib/misc/binutils-config/create-ldwrapper usr/lib/misc/binutils-config/libbinutils-config.a

emerge binutils
Check Cygwins libiconv is already installed.

ls /usr/lib/libiconv.la && emerge --oneshot binutils

results:

usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/addr2line.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/ar.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/as.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/c++filt.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/dlltool.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/dllwrap.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/elfedit.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/gprof.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/ld.bfd.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/ld.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/nm.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/objcopy.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/objdump.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/ranlib.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/readelf.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/size.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/strings.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/strip.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/windmc.exe usr/i686-pc-cygwin1.7/binutils-bin/2.20.51.0.8/windres.exe usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/include/ansidecl.h usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/include/bfd.h usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/include/bfdlink.h usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/include/dis-asm.h usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/include/libiberty.h usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/include/symcat.h usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/ldscripts/i386pe.x usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/ldscripts/i386pe.xa usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/ldscripts/i386pe.xbn usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/ldscripts/i386pe.xn usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/ldscripts/i386pe.xr usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/ldscripts/i386pe.xu usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/libbfd.a usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/libbfd.la usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/libiberty.a usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/libopcodes.a usr/lib/binutils/i686-pc-cygwin1.7/2.20.51.0.8/libopcodes.la

emerge gmp
emerge --oneshot gmp

results:

usr/include/gmp.h usr/include/gmpxx.h usr/lib/libgmp.a usr/lib/libgmp.la usr/lib/libgmpxx.a usr/lib/libgmpxx.la

emerge mpfr
emerge --oneshot mpfr

results:

usr/include/mpf2mpfr.h usr/include/mpfr.h usr/lib/libmpfr.a usr/lib/libmpfr.la

emerge gcc-config
emerge --oneshot gcc-config

results:

usr/bin/gcc-config usr/lib/misc/gcc-config.exe

emerge gcc
If GCC doesn't emerge here use Cygwins for now and wait for a new version of GCC.

emerge coreutils
Check Cygwins,  ,   and the sources of   are already installed.

ls /usr/bin/ | grep automake ls /usr/bin/ | grep autoconf ls /usr/bin/ | grep perl

Create overlay first:

mkdir -p ${OVERLAY}/sys-apps/coreutils/ cp ${EPREFIX}/usr/portage/sys-apps/coreutils/coreutils-8.5.ebuild ${OVERLAY}/sys-apps/coreutils/ ln -s ${EPREFIX}/usr/portage/sys-apps/coreutils/files/ ${OVERLAY}/sys-apps/coreutils/files

Adapt.

src_unpack { unpack ${A} cd "${S}" epatch /usr/src/coreutils-8.5-2.src.patch einfo "Running autoreconf:" autoreconf [... patches go here ... ] [... patches go here ... ] mkdir -p man/install.td/ cp /bin/install.exe.manifest man/install.td/install.exe.manifest mkdir src cp /bin/install.exe.manifest src/ginstall.exe.manifest cp /bin/install.exe.manifest ${EPREFIX}/usr/bin/install.exe.manifest }
 * 1) apply the cygwin patch
 * 1) disable this interix patch as it conflicts:
 * 2) epatch "${FILESDIR}"/${PN}-8.5-interix-warn-mount.patch

Alternative use sed expressions for this.

file=${OVERLAY}/sys-apps/coreutils/coreutils-8.5.ebuild sed -i '/cd "${S}"/a\\n\tepatch /usr/src/coreutils-8.5-2.src.patch\n\tautoreconf\n' $file sed -i 's/\(.*interix-warn-mount.patch.*\)/#\1/' $file sed -i '/cross-compiler && touch/a\\tcp /bin/install.exe.manifest ${EPREFIX}/usr/bin/install.exe.manifest' $file sed -i '/cross-compiler && touch/a\\tcp /bin/install.exe.manifest man/install.td/install.exe.manifest' $file sed -i '/cross-compiler && touch/a\\tcp /bin/install.exe.manifest src/ginstall.exe.manifest' $file sed -i '/cross-compiler && touch/a\\tmkdir -p man\/install.td/' $file sed -i '/cross-compiler && touch/a\\n\tmkdir src' $file
 * 1) apply the cygwin patch
 * 1) disable interix patch as it conflicts
 * 1) install exe.minifests (yes, sed is in reverse order here with intent)

Rebuild the ebuild manifest before emerging:

ebuild ${OVERLAY}/sys-apps/coreutils/coreutils-8.5.ebuild digest emerge --oneshot coreutils

Make sure you run  in your active shells when done.

results:

bin/basename.exe bin/cat.exe bin/chgrp.exe bin/chmod.exe bin/chown.exe bin/chroot.exe bin/cp.exe bin/cut.exe bin/date.exe bin/dd.exe bin/df.exe bin/dir.exe bin/dirname.exe bin/du.exe bin/echo.exe bin/env.exe bin/expr.exe bin/false.exe bin/head.exe bin/ln.exe bin/ls.exe bin/mkdir.exe bin/mkfifo.exe bin/mknod.exe bin/mktemp.exe bin/mv.exe bin/pwd.exe bin/readlink.exe bin/rm.exe bin/rmdir.exe bin/seq.exe bin/sleep.exe bin/sort.exe bin/stty.exe bin/sync.exe bin/tail.exe bin/touch.exe bin/tr.exe bin/true.exe bin/tty.exe bin/uname.exe bin/vdir.exe bin/wc.exe bin/yes.exe usr/bin/arch.exe usr/bin/base64.exe usr/bin/basename usr/bin/chcon.exe usr/bin/chroot usr/bin/cksum.exe usr/bin/comm.exe usr/bin/csplit.exe usr/bin/cut usr/bin/dir usr/bin/dircolors.exe usr/bin/dirname usr/bin/du usr/bin/env usr/bin/expand.exe usr/bin/expr usr/bin/factor.exe usr/bin/fmt.exe usr/bin/fold.exe usr/bin/head usr/bin/hostid.exe usr/bin/id.exe usr/bin/install.exe usr/bin/join.exe usr/bin/link.exe usr/bin/logname.exe usr/bin/md5sum.exe usr/bin/mkfifo usr/bin/mktemp usr/bin/nice.exe usr/bin/nl.exe usr/bin/nohup.exe usr/bin/nproc.exe usr/bin/od.exe usr/bin/paste.exe usr/bin/pathchk.exe usr/bin/pinky.exe usr/bin/pr.exe usr/bin/printenv.exe usr/bin/printf.exe usr/bin/ptx.exe usr/bin/readlink usr/bin/runcon.exe usr/bin/seq usr/bin/sha1sum.exe usr/bin/sha224sum.exe usr/bin/sha256sum.exe usr/bin/sha384sum.exe usr/bin/sha512sum.exe usr/bin/shred.exe usr/bin/shuf.exe usr/bin/sleep usr/bin/sort usr/bin/split.exe usr/bin/stat.exe usr/bin/sum.exe usr/bin/tac.exe usr/bin/tail usr/bin/tee.exe usr/bin/test.exe usr/bin/timeout.exe usr/bin/touch usr/bin/tr usr/bin/truncate.exe usr/bin/tsort.exe usr/bin/tty usr/bin/uname usr/bin/unexpand.exe usr/bin/uniq.exe usr/bin/unlink.exe usr/bin/users.exe usr/bin/vdir usr/bin/wc usr/bin/who.exe usr/bin/whoami.exe usr/bin/yes usr/bin/[.exe

emerge findutils
emerge --oneshot findutils

results:

usr/bin/find.exe usr/bin/oldfind.exe usr/bin/xargs.exe

emerge tar
emerge --oneshot tar

results:

bin/tar.exe usr/bin/gtar usr/sbin/backup-tar usr/sbin/backup.sh usr/sbin/dump-remind usr/sbin/restore-tar usr/sbin/rmt.exe

emerge grep
emerge --oneshot grep

results:

bin/egrep.exe bin/fgrep.exe bin/grep.exe

emerge patch
cp /bin/patch.exe.manifest /home/prefix/gentoo/usr/bin/ emerge --oneshot patch

results:

usr/bin/patch.exe usr/bin/patch.exe.manifest

emerge gawk
Create overlay first:

mkdir -p ${OVERLAY}/sys-apps/gawk/ cp ${EPREFIX}/usr/portage/sys-apps/gawk/gawk-3.1.7.ebuild ${OVERLAY}/sys-apps/gawk/ ln -s ${EPREFIX}/usr/portage/sys-apps/gawk/files/ ${OVERLAY}/sys-apps/gawk/files Comment out filefuncs in.
 * 1) cp -r "${FILESDIR}"/filefuncs "${SFFS}" || die "cp failed"

Rebuild the manifest before emerging:

ebuild ${OVERLAY}/sys-apps/gawk/gawk-3.1.7.ebuild digest env FEATURES="-collision-protect" emerge --oneshot gawk

results: bin/awk -> bin/gawk -> bin/igawk -> bin/pgawk -> bin/gawk-3.1.7.exe bin/pgawk-3.1.7.exe usr/bin/awk -> usr/bin/gawk -> usr/bin/igawk -> usr/bin/pgawk -> usr/bin/igawk-3.1.7 usr/bin/pgawk-3.1.7.exe usr/include/awk/awk.h usr/include/awk/config.h usr/include/awk/custom.h usr/include/awk/dfa.h usr/include/awk/floatmagic.h usr/include/awk/getopt.h usr/include/awk/getopt_int.h usr/include/awk/gettext.h usr/include/awk/hard-locale.h usr/include/awk/mbsupport.h usr/include/awk/protos.h usr/include/awk/random.h usr/include/awk/regex.h usr/include/awk/regex_internal.h usr/lib/misc/awk/grcat.exe usr/lib/misc/awk/pwcat.exe

emerge make
emerge --oneshot make

results:

usr/bin/gmake.exe usr/bin/make ->

emerge file
emerge --oneshot --nodeps file

results:

usr/bin/cygmagic-1.dll usr/bin/file.exe usr/include/magic.h usr/lib/libmagic.a usr/lib/libmagic.dll.a usr/lib/libmagic.la

emerge eselect
emerge --oneshot eselect

results:

usr/bin/bashcomp-config usr/bin/eselect usr/bin/kernel-config usr/bin/profile-config usr/bin/rc-config usr/share/eselect/libs/*.bash usr/share/eselect/modules/*.eselect

emerge pax-utils
emerge --oneshot pax-utils

results:

usr/bin/dumpelf.exe usr/bin/lddtree usr/bin/pspax.exe usr/bin/scanelf.exe usr/bin/scanmacho.exe usr/bin/symtree

bash: missing curses
Symptom: When calling  emerge dies.

Reason: Missing curses.

Solution 1: install with dependencies

emerge --oneshot --ask bash

This will emerge ncurses first.

Solution 2: Install Cygwins.

binutils: missing libiconv.la
When calling  emerge dies:

libtool: link: '/usr/lib/libiconv.la' is not a valid libtool archive

Reason: Only the runtime of  is installed.

Solution: Install Cygwins.

gcc: missing gmp and mpfr
Symptom: When calling  emerge dies:

GCC requires GMP 4.1+ and MPFR 2.3.2+

Reason: Only the runtimes are installed.

Solution: Install Cygwins  and.

Solution 2: Emerge libraries before. emerge --oneshot --ask mpfr

gcc: libstdc++-v3 breaks
Symptom: It always breaks during compilation of libstdc++-v3.

Reason: Unknown. This bug solved in later versions.

Solution: Simply use Cygwins GCC for initial bootstrapping.

coreutils: Permission denied
Symptom: When calling  emerge dies:

./ginstall ginstall.exe '/home/prefix/gentoo/var/tmp/portage/sys-apps/coreutils-8.5/image//home/prefix/gentoo/usr/bin/./install.exe' /usr/bin/bash: line 18: ./ginstall: Permission denied

Dies with a similar message, when creating installs manpage.

Reason: This is due to windows user account control (UAC) on newer machines.

Solution: The solution is to put a manifest into the directory of the install binary.

       

You can copy it from. But how to get it into the directory when  is delete at the beginning of emerge? Adapt function.

All in all you have to copy the manifest into three places:

src_upack { unpack ${A} cd "${S}" [... patches go here ... ] mkdir -p man/install.td/ cp /usr/bin/install.exe.manifest man/install.td/install.exe.manifest mkdir src cp /usr/bin/install.exe.manifest src/ginstall.exe.manifest cp /usr/bin/install.exe.manifest /home/prefix/gentoo/usr/bin/install.exe.manifest [...] }

Mind the "g" of.

Rebuild the ebuild manifest:

ebuild ~/gentoo/usr/portage/sys-apps/coreutils/coreutils-8.5.ebuild digest

coreutils: missing perl
Symptom: When calling  emerge dies:

perl is needed and is missing at your system

Solution: Install Cygwins perl

coreutils: breaks following emergings
Symptom: After emerging of coreutils succeeding emergings break. The files  get corrupted during generation.

This is reproducible. Tested with wget. config.status is partly truncated and partly out of order. The file is always broken in exactly the same way.

Reason: unknown Solution: Attach the cygwin patch. 1.) install Cygwins sources of coreutils 2.) install Cygwins autoconf 3.) install Cygwins automake 4.) adapt the ebuild 5.) rebuild the manifest Adapt  function  . src_unpack { unpack ${A} cd "${S}" epatch /usr/src/coreutils-8.5-2.src.patch einfo "Running autoreconf:" autoreconf [...]  } Rebuild the ebuild manifest: ebuild ~/gentoo/usr/portage/sys-apps/coreutils/coreutils-8.5.ebuild digest
 * 1) Disable this interix patch as it conflicts:
 * 2) epatch "${FILESDIR}"/${PN}-8.5-interix-warn-mount.patch

patch: Permission denied
Symptom: After compiling patch with  you can't emerge any more because patching doesn't work.

Reason: This is due to windows user account control (UAC) on newer machines.

Solution: Put a manifest into the directory of the patch binary. cp /bin/patch.exe.manifest /home/prefix/gentoo/tmp/usr/bin/ cp /bin/patch.exe.manifest /home/prefix/gentoo/usr/bin/ See coreutils for how to put it to the ebuild.

gawk-3.1.7: [filefuncs.so.0.0.1] Error 1
Symptom: While  emerge dies: i686-pc-cygwin-gcc -L/home/prefix/gentoo/usr/lib -R/home/prefix/gentoo/usr/lib -L/home/prefix/gentoo/lib -R/home/prefix/gentoo/lib -o filefuncs.so.0.0.1 -shared -Wl,-soname -Wl,filefuncs.so.0 filefuncs.o filefuncs.o:filefuncs.c:(.text+0x1e): undefined reference to `_make_builtin' [...] filefuncs.o:filefuncs.c:(.text+0x10f1): undefined reference to `_update_ERRNO' collect2: ld returned 1 exit status make: *** [filefuncs.so.0.0.1] Error 1 Reason: Gentoos filefuncs handling Understanding the details

Workaround: Comment out filefuncs in.
 * 1) cp -r "${FILESDIR}"/filefuncs "${SFFS}" || die "cp failed"

Mind to update the digest manifest.