Prefix/Cygwin

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

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

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

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. However the old project may give some solutions where matters get difficult.

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?
By running Prefix on Cygwin you get the same runtime environment on Windows that you can also have on Linux or Mac. It brings much more options than a Java runtime environment and it requires less resources than a virtual machine. Additionally you can compile any program yourself by using Gentoos mature emerge installer. Finally all this happens in the userspace and makes you independent from the admin. 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 istalled.

* Assure your windows editor files are all set to unix format. * close open files while emerging * source ~/bootstrap.rc * env-update && source ~/gentoo/etc/profile * hash -r * Cygwin: rebaseall

Cygwin instablilites
Sometimes compiling a package breaks and you can't figure out the reason. Emerge it a second time to see if it again breaks in the same point. If it goes through or breaks in a different point it was an instability. If it always breaks in the same point look for a different reason.

Rebasing Cygwin packages
Windows/Cygwin have often troubles with memory addresses of freshly installed DLL, especially with those of Perl and Python. Strange errors of cryptic addresses would occur when you do the first emerge, because emerge uses Python. The solution is to "rebase" all DLL. The "rebaseall" script writes new addresses into all installed DLL incremently, so that conflicts are avoided in future.

Close all terminals and open a windows command shell (cmd):

P:/cygwin/bin/ash /bin/rebaseall exit exit

This only rebases DLL installed with "setup.exe". It uses lists of installed DLL to know what to rebase.

It's also sensible to 'rebase' one DLL, to avoid closing all Cygwin windows, especially if it's outside Cygwin's rebaseall path.

/tmp/build $ rebase -s somewhere/one.dll

Even if it complains about not being able to rebase some DLLs in /bin, simply ignore it and continue.

Checking DLL
Example how to check DLL of a program:

ldd bin/bash.exe ntdll.dll => /cygdrive/c/Windows/system32/ntdll.dll (0x76ed0000) kernel32.dll => /cygdrive/c/Windows/system32/kernel32.dll (0x75fe0000) cygncurses5.dll => /home/prefix/gentoo/usr/bin/cygncurses5.dll (0x69400000) cygwin1.dll => /usr/bin/cygwin1.dll (0x61000000) [...]

Addresses below  are suspicious. You likely need to run rebase or reemerge.

There is also a GUI program to dislplay DLL dependencies: Dendency Walker.

Creating user list of DLL
Create a script to generate.

MRL='/home/prefix/makerebaselist.sh' touch $MRL && chmod +x $MRL

echo '#/bin/bash' >> $MRL echo 'BASE=/home/prefix' >> $MRL echo 'rm $BASE/rebase.lst' >> $MRL echo 'find $BASE/gentoo/bin/ -name *.dll -o -name *.so >> $BASE/rebase.lst' >> $MRL echo 'find $BASE/gentoo/lib/ -name *.dll -o -name *.so >> $BASE/rebase.lst' >> $MRL echo 'find $BASE/gentoo/usr/bin -name *.dll -o -name *.so >> $BASE/rebase.lst' >> $MRL echo 'find $BASE/gentoo/usr/lib -name *.dll -o -name *.so >> $BASE/rebase.lst' >> $MRL

Running the script:

~/makerebaselist.sh

Result:

~/rebase.lst

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

P:/cygwin/bin/ash /bin/rebaseall -T /home/prefix/rebase.lst

General troubleshouting
If a Cygwin package makes trouble, reinstall it and run "rebaseall".

Strategies to debug

 * Emerge packages one-by-one:
 * Execute single emerge steps:
 * Go to work directory and try:  followed by   and.

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
 * 1) does the shebang start with ${EPREFIX}, and does it exist?

Solution: Fabian Groffen writes: Ok, I see,  is probably the right thing to use here. Same for, should be.

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 ${EPREFIX} 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:

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

QA complaints of missing gen_usr_ldscript
* QA Notice: Missing gen_usr_ldscript for libbz2.so [...] *      ${abort} == "yes"  && die "add those ldscripts"

Workaround: Disable this quality check. We don't need gen_usr_ldscript at all on windows.

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 pathes
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  (mnemo for Prefix Cygwin).

Windows perspective: Cygwin perspective:

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.

Basical packages
gcc4, wget, make, patch, python

For fast edits from the shell install an editor of your choice:

vim, nano, pico, ...

Install a terminal that supports copy&paste:

mintty

$BASE, $EPREFIX and $OVERLAY
Define directories:

export BASE=${HOME} export EPREFIX=${HOME}/gentoo export OVERLAY=${HOME}/overlay You can play with this.

.bashrc setup
To set up your environment write this variables to.

echo " alias ls='ls -hF --color=tty'" >> ${HOME}/.bashrc echo " alias ll='ls -al'" >> ${HOME}/.bashrc echo "BASE='${BASE}'" >> ${HOME}/.bashrc echo "EPREFIX='${EPREFIX}'" >> ${HOME}/.bashrc echo "OVERLAY='${OVERLAY}'" >> ${HOME}/.bashrc echo 'export PATH="${EPREFIX}/lib:${EPREFIX}/usr/lib:${EPREFIX}/usr/bin:${EPREFIX}/bin:${EPREFIX}/tmp/usr/bin:${EPREFIX}/tmp/bin:/usr/bin:/bin"' >> ${HOME}/.bashrc source ${HOME}/.bashrc

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

cd ${BASE} && wget http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/bootstrap-prefix.sh?format=txt mv ${BASE}/bootstrap-prefix.sh* ${BASE}/bootstrap-prefix.sh chmod +x ${BASE}/bootstrap-prefix.sh

Tree setup
${BASE}/bootstrap-prefix.sh ${EPREFIX} tree

Check that the portage tree has been sucessfully unpacked to. A lot of directories in there?

Skip tmp dir setup
Use the Cygwin binaries and skip steps that install binaries in.


 * 1) ${BASE}/bootstrap-prefix.sh ${EPREFIX} tmp [...]

Portage setup
${BASE}/bootstrap-prefix.sh ${EPREFIX} portage







Profile setup
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  line 518:

gen_usr_ldscript { return 0; } XXXgen_usr_ldscript {

emerge sed
emerge --oneshot sed

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
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  when entering a shell. echo "source ${EPREFIX}/etc/profile" >> ${HOME}/.bashrc source ${HOME}/.bashrc

extend PATH for shared libries
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  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   (8.5-2) 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}" # apply the cygwin patch epatch /usr/src/coreutils-8.5-2.src.patch einfo "Running autoreconf:" autoreconf [... patches go here ... ] # disable this interix patch as it conflicts: # epatch "${FILESDIR}"/${PN}-8.5-interix-warn-mount.patch [... 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 }

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 deletet 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 reproducable. Tested with wget. 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 [...]   # Disable this interix patch as it conflicts: # epatch "${FILESDIR}"/${PN}-8.5-interix-warn-mount.patch }

Rebuild the ebuild manifest:

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

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 ebuild.


 * 1) cp -r "${FILESDIR}"/filefuncs "${SFFS}" || die "cp failed"

Mind to update the digest manifest.

Emerging portage
This part you find in the Solaris Process as

env FEATURES="-collision-protect" emerge --oneshot --ask portage

We do it step by step to address different issues.

fix eselect
sed -i 's/${ROOT}${EPREFIX}/${ROOT%\/}${EPREFIX}/' ~/gentoo/usr/bin/eselect

emerge zlib
emerge --oneshot sys-libs/zlib

results:

usr/include/zconf.h usr/include/zlib.h usr/lib/libz.a usr/lib/libz.so usr/lib/libz.so.1 usr/lib/libz.so.1.2.5

emerge bzip2
emerge --oneshot bzip2

results:

bin/bunzip2 bin/bzcat bin/bzip2.exe lib/libbz2.so lib/libbz2.so.1 lib/libbz2.so.1.0 lib/libbz2.so.1.0.5 usr/bin/bzcmp usr/bin/bzdiff usr/bin/bzegrep usr/bin/bzfgrep usr/bin/bzgrep usr/bin/bzip2recover.exe usr/bin/bzless usr/bin/bzmore usr/include/bzlib.h usr/lib/libbz2.a usr/lib/libz.so usr/lib/libz.so.1

emerge perl
Make  and   perl friendly and go single threaded.

cd ${EPREFIX}/usr/bin/ ln -s tr tr.exe ln -s uname uname.exe cd ${BASE} env MAKEOPTS="-j1" emerge --oneshot --ask perl

this installs:


 * sys-devel/libperl
 * dev-lang/perl
 * app-admin/perl-cleaner

results:

usr/bin/cpan* usr/bin/perl* usr/bin/p* usr/bin/* usr/lib/libperl.so.5.10.1 usr/lib/perl5/5.10.1/*.pm|.pl|.pod usr/lib/perl5/site_perl/*.ph usr/sbin/perl-cleaner

emerge libtool
emerge --oneshot --ask libtool

this installs:


 * sys-devel/autoconf-wrapper
 * sys-devel/automake-wrapper
 * sys-apps/help2man
 * sys-apps/texinfo
 * sys-devel/autoconf
 * sys-devel/automake
 * sys-devel/libtool

The program install-info requires a manifest for permissions:

cp /bin/install-info.exe.manifest ${EPREFIX}/usr/bin/install-info.exe.manifest

emerge readline
Create overlay first:

file=${OVERLAY}/sys-libs/readline/readline-6.1_p2.ebuild mkdir -p ${OVERLAY}/sys-libs/readline cp ${EPREFIX}/usr/portage/sys-libs/readline/readline-6.1_p2.ebuild $file ln -s ${EPREFIX}/usr/portage/sys-libs/readline/files/ ${OVERLAY}/sys-libs/readline/files

Edit. Disable the rlfe example in  and src_compile { append-cppflags -D_GNU_SOURCE

econf --with-curses || die emake || die return 0; src_install { emake DESTDIR="${D}" install || die gen_usr_ldscript -a readline history #4411


 * 1)       if ! tc-is-cross-compiler; then
 * 2)               dobin examples/rlfe/rlfe || die
 * 3)       fi

Alternativly disable the rlfe example by sed:

sed -i 's/if.*!.*tc-is-cross-compiler/if 1 == 0 /' $file

Build the Manifest and emerge.

ebuild $file digest emerge --oneshot --ask readline

results:

usr/include/readline/*.h usr/lib/cyghistory6.dll usr/lib/cygreadline6.dll usr/lib/libhistory.a usr/lib/libhistory.dll.a usr/lib/libreadline.a usr/lib/libreadline.dll.a

emerge libiconv
It doesn't like our CHOST.

env CHOST="i686-pc-cygwin" emerge --oneshot --ask libiconv

results:

./usr/bin/cygcharset-1.dll ./usr/bin/cygiconv-2.dll ./usr/bin/iconv.exe ./usr/include/iconv.h ./usr/include/libcharset.h ./usr/include/localcharset.h ./usr/lib/charset.alias ./usr/lib/libcharset.a ./usr/lib/libcharset.dll.a ./usr/lib/libcharset.la ./usr/lib/libiconv.a ./usr/lib/libiconv.dll.a ./usr/lib/libiconv.la

emerge gettext
It seems this used to be simpler, but recent Cygwins have developed a number of thorny little problems here.

I was able to get it to work by aping as much as possible from the cygports build in the ebuild, including applying all the cygports patches. Specifically, I did the following:

 got all prerequisite packages installed (a bit of a project in and of itself): used cygwin setup.exe to install the sources for gettext-0.18.1.1-2 (they end up in /usr/src) added gettext to the prefix overlay: copied the cygport patches into ${OVERLAY}/sys-devel/gettext/files: </li> There are some problems with the "woe32 dll" stuff in gettext: I created the following patch to fix both problems: Note that the last line contains a single space -- don't miss it or the patch will surely fail!</li> finally, I hacked up the ebuild more-or-less exactly aping what happens in the cygport. Some of this may be unnecessary but it works. The ebuild also solves an additional problem which was documented here: something wonky happens in configure if your is, it needs to be just. The following code should do the trick, although cutting-and-pasting it directly into a dos-box may be problematic: </li> Now just do the standard rigamarole: It takes a while but does the trick for me. Note that the above is linking to cygwin's libncursesw. I later figured out this isn't neccesary at all, just add unicode to the readline useflags and drop the lines: append-cppflags -I/usr/include/ncursesw append-ldflags -L/usr/lib/ncursesw from the ebuild, and it uses the ncursesw from prefix instead. Also, unfortunately, although this builds and almost works, I think there is still something subtly wrong with it. For example, I can't get pkgconfig to link correctly against the generated libintl-8.dll... but that is an ongoing investigation and could have some other root cause.</li> </ul>
 * the gnulib routines, and  are exported from it, but in very recent cygwins (I have 1.7.10) the same have now been integrated into cygwin itself, and, I presume, exported from cygwin1.dll which is  a lot like having them in glibc.  The result is a spooky emerge failure.
 * woe32-dll.m4 adds to .  I'm not too clueful about that linker flag, but it somehow causes the final link to fail, unable to find the  symbol.

results:

./usr/bin/cygexpat-1.dll ./usr/bin/python-wrapper.exe ./usr/bin/xmlwf.exe ./usr/include/expat.h ./usr/include/expat_external.h ./usr/lib/libexpat.a ./usr/lib/libexpat.dll.a ./usr/lib/libexpat.la ./usr/bin/cygxml2-2.dll ./usr/bin/xml2-config ./usr/bin/xmlcatalog.exe ./usr/bin/xmllint.exe ./usr/include/libxml2/libxml/*.h ./usr/lib/libxml2.a ./usr/lib/libxml2.dll.a ./usr/lib/libxml2.la ./usr/lib/pkgconfig/libxml-2.0.pc ./usr/lib/xml2Conf.sh ./usr/bin/autopoint ./usr/bin/cygasprintf-0.dll ./usr/bin/cyggettextlib-0-17.dll ./usr/bin/cyggettextpo-0.dll ./usr/bin/cyggettextsrc-0-17.dll ./usr/bin/cygintl-8.dll ./usr/bin/envsubst.exe ./usr/bin/gettext.exe ./usr/bin/gettext.sh ./usr/bin/gettextize ./usr/bin/gmsgfmt ./usr/bin/msgattrib.exe ./usr/bin/msgcat.exe ./usr/bin/msgcmp.exe ./usr/bin/msgcomm.exe ./usr/bin/msgconv.exe ./usr/bin/msgen.exe ./usr/bin/msgexec.exe ./usr/bin/msgfilter.exe ./usr/bin/msgfmt.exe ./usr/bin/msggrep.exe ./usr/bin/msginit.exe ./usr/bin/msgmerge.exe ./usr/bin/msgunfmt.exe ./usr/bin/msguniq.exe ./usr/bin/ngettext.exe ./usr/bin/recode-sr-latin.exe ./usr/bin/xgettext.exe ./usr/include/autosprintf.h ./usr/include/gettext-po.h ./usr/include/libintl.h ./usr/lib/gettext/hostname.exe ./usr/lib/gettext/project-id ./usr/lib/gettext/urlget.exe ./usr/lib/gettext/user-email ./usr/lib/libasprintf.a ./usr/lib/libasprintf.dll.a ./usr/lib/libasprintf.la ./usr/lib/libgettextlib.a ./usr/lib/libgettextlib.dll.a ./usr/lib/libgettextlib.la ./usr/lib/libgettextpo.a ./usr/lib/libgettextpo.dll.a ./usr/lib/libgettextpo.la ./usr/lib/libgettextsrc.a ./usr/lib/libgettextsrc.dll.a ./usr/lib/libgettextsrc.la ./usr/lib/libintl.a ./usr/lib/libintl.dll.a ./usr/lib/libintl.la

emerge popt
Create overlay first:

file=${OVERLAY}/dev-libs/popt/popt-1.16.ebuild mkdir -p ${OVERLAY}/dev-libs/popt/files cp ${EPREFIX}/usr/portage/dev-libs/popt/popt-1.16.ebuild ${OVERLAY}/dev-libs/popt/ cp ${EPREFIX}/usr/portage/dev-libs/popt/files/popt-1.13-no-wchar-hack.patch ${OVERLAY}/dev-libs/popt/files/ cp ${EPREFIX}/usr/portage/dev-libs/popt/files/popt-1.15-mint.patch ${OVERLAY}/dev-libs/popt/files/popt-1.16-cygwin.patch

Adapt the patch. Replace  with.

+#if !defined(__GLIBC__) && !defined(__CYGWIN__)

Alternative:

sed -i 's/__MINTLIB__/__CYGWIN__/' ${OVERLAY}/dev-libs/popt/files/popt-1.16-cygwin.patch

Adapt the ebuild

src_prepare { epatch "/usr/src/       epatch "${FILESDIR}"/${PN}-1.16-cygwin.patch        epatch "${FILESDIR}"/${PN}-1.13-no-wchar-hack.patch # for Interix and MiNT, Cygwin        elibtoolize # for FreeMiNT }
 * 1)       epatch "${FILESDIR}"/${PN}-1.15-mint.patch

Alternative:

sed -i 's/-1.15-mint.patch/-1.16-cygwin.patch/' $file

Build the Manifest and emerge.

ebuild $file digest emerge --oneshot --ask popt

results: ./usr/bin/cygpopt-0.dll ./usr/include/popt.h ./usr/lib/libpopt.a ./usr/lib/libpopt.dll.a ./usr/lib/libpopt.la

emerge mime-types, rsync, pkgconfig, libffi
emerge --oneshot --ask rsync mime-types pkgconfig virtual/libffi

this installs:


 * dev-libs/libffi
 * app-misc/mime-types
 * dev-util/pkgconfig
 * net-misc/rsync
 * virtual/libffi

results:

./usr/bin/cygffi-5.dll ./usr/lib/libffi-3.0.9/include/ffi.h ./usr/lib/libffi-3.0.9/include/ffitarget.h ./usr/lib/libffi.dll.a ./usr/lib/libffi.la ./etc/mime.types ./etc/env.d/99pkgconfig ./usr/bin/pkg-config.exe ./etc/logrotate.d/rsyncd ./etc/rsyncd.conf ./etc/xinetd.d/rsyncd ./usr/bin/rsync.exe

fix python.eselect
Make shell expressions match the .exe suffix.

file=~/gentoo/usr/share/eselect/modules/python.eselect sed -i '14 a ${CHOST} == *-cygwin* && EXE_SUFFIX=".exe"' $file sed -i 's/"\(python[23?][.][?]\)"/"\1${EXE_SUFFIX}"/' $file

emerge python and portage
Create python overlay.

file=${OVERLAY}/dev-lang/python/python-2.6.5-r2.ebuild mkdir -p ${OVERLAY}/dev-lang/python cp ${EPREFIX}/usr/portage/dev-lang/python/python-2.6.5-r2.ebuild ${OVERLAY}/dev-lang/python/ ln -s ${EPREFIX}/usr/portage/dev-lang/python/files/ ${OVERLAY}/dev-lang/python/files

Edit the ebuild:.

There are too many patches. It breaks on Cygwin and is difficult to debug. For now we trust in Pythons own sources and disable all patching.

XXXsrc_prepare {

[...]

XXXsrc_configure {

There is a bug with "--root=//home": Bug 337303

src_install { -z "${ED}" && ED="${D%/}${EPREFIX}/" # Fix bug #337303: --root=//home/... sed -i 's/--root=\/$(/--root=$(/' "${S}/Makefile" || die "Cygwin Makefile fix failed"

Alternatively with sed:

sed -i 's/src_prepare/XXXsrc_prepare/' $file sed -i 's/src_configure/XXXsrc_configure/' $file sed -i '/src_install/a\\tsed -i "s/--root=\\/\\$(/--root=\\$(/" "${S}/Makefile" || die "Cygwin Makefile fix failed"' $file

Build Manifest and emerge.

ebuild $file digest emerge --oneshot --ask portage


 * virtual/libintl
 * dev-lang/python
 * sys-apps/portage
 * app-admin/python-updater

Rebase Python
It's likely that you need to rebase after emerging of Python. See:

fix QA complaints again
The  has been overwritten by portage. again.

zlib: missing destination
This issue doesn't happen always. Still unclear what are the preconditions. First try if it works before applying the patch.

Symptom: Installation fails

cp /home/prefix/gentoo/var/tmp/portage/sys-libs/zlib-1.2.5-r2/image//home/prefix/gentoo/usr/lib cp: missing destination file operand after `/home/prefix/gentoo/var/tmp/portage/sys-libs/zlib-1.2.5-r2/image//home/prefix/gentoo/usr/lib' Try `cp --help' for more information.

Reason:

1.) "configure" line 123: No LDSHARED is set for Cygwin.

2.) Unconditioned copy from an empty shared library path in Makefile.in (line 171).

cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)
 * 1) where $(SHAREDLIBV) is ""

Workaround: Copy that line from linux.

LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"}

Alternatively: Set a condition for the critical line in Makefile.in and stay with the static lib.

if test "$(SHAREDLIBV)"; then cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); fi

Patch: --- Makefile.in.orig	2010-09-03 23:16:13.852000000 +0200 +++ Makefile.in	2010-09-03 23:17:22.580000000 +0200 @@ -168,7 +168,7 @@ 	-@if [ ! -d $(DESTDIR)$(man3dir)     ]; then mkdir -p $(DESTDIR)$(man3dir); fi -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi 	cp $(STATICLIB) $(DESTDIR)$(libdir) -	cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir) +	if test "$(SHAREDLIBV)"; then cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); fi 	cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB) -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 -@cd $(DESTDIR)$(sharedlibdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \

app-arch/bzip2: cannot open shared object file
Symptom: Postinstallation missing shared library. This happens at least if you still use Cygwins GCC at this point.

/home/prefix/gentoo/bin/bzip2.exe: error while loading shared libraries: libbz2.so.1.0.5: cannot open shared object file: No such file or directory

Reason: libbz2.so.1.0.5 has been installed to ~/gentoo/lib. On windows shared libraries have to be in PATH.

Solution 1: Compile as static library. env USE="static" emerge --oneshot --ask bzip2http://en.gentoo-wiki.com/w/index.php?title=Prefix/Cygwin&action=submit

Solution 2: Extend the PATH. See and.

dev-lang/perl: Unable to configure
Symptom: Unable to configure:

Configure: line 2609: /home/prefix/gentoo/usr/bin/touch.exe: No such file or directory [...] I don't know how to translate letters from upper to lower case. Your tr is not acting any way I know of. �[31;01m*�[0m ERROR: dev-lang/perl-5.10.1 failed: �[31;01m*�[0m  Unable to configure

Reason:

Perls Configure script calls exactly: /home/prefix/gentoo/usr/bin/tr.exe

There exists: /home/prefix/gentoo/bin/tr.exe /home/prefix/gentoo/usr/bin/tr -> /home/prefix/gentoo.bin/tr.exe

Cygwins .exe magic is one way. It does not find from an  call to. There is a similar problem with uname.

Solution: Until we find a more general solution, add a second symbolic link for any link in question:

cd /home/prefix/gentoo/usr/bin/ ln -s tr tr.exe ln -s uname uname.exe

Ideas for a more general solution:


 * Make  and   the same directory by a hardlink. That seems to be the case of Cygwins   and  . (How to verify that?)
 * Use a script that searches symbolic links to "prorgams" in different directories and create both versions of the link.

dev-lang/perl: No rule to make target miniperl
Symptom: Dies with:

make: *** No rule to make target `miniperl', needed by `all'. Stop.

Reason: The target all in the Makefile has two "miniperl" dependencies. That breaks parallel builds.

all: $(FIRSTMAKEFILE) miniperl$(EXE_EXT) miniperl $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make

Solution:

env MAKEOPTS="" emerge --oneshot --ask perl

sys-libs/readline-6.1_p2: sgtty.h: No such file or directory
Symptom:

gcc -c -I. -I. -I/home/prefix/gentoo/usr/include -D_GNU_SOURCE   -O2 -pipe pty.c In file included from screen.h:2, from pty.c:32: os.h:212:23: sgtty.h: No such file or directory pty.c: In function `OpenPTY': pty.c:277: warning: assignment from incompatible pointer type

Reason: readline/example/rlfe is buggy

Solution: Disable the rlfe example in  and. See.

libiconv: unknown CHOST i686-pc-cygwin1.7
Symptom:

/bin/sh: i686-pc-cygwin1.7-gcc: command not found

Reason: Seems it doesn't like CHOST="i686-pc-cygwin1.7" and expands it to a nonexisting gcc path.

Workaround:

env CHOST="i686-pc-cygwin" emerge --oneshot --ask libiconv

sys-devel/gettext-0.17-r1: gcc not found
Symptom:

/bin/sh: i686-pc-cygwin1.7-gcc: command not found

Reason: Seems it doesn't like CHOST="i686-pc-cygwin1.7" and expands it to a nonexisting gcc path.

Workaround:

env CHOST="i686-pc-cygwin" emerge --oneshot --ask gettext

dev-libs/popt: redeclaration of a function
Symptom: Dies because a function has already been defined. (which one?)

Reason: It only checks for the  preprocesser variable. As  is not defined on Cygwin, it want's to redeclare the function.

Solution: Add  to the test. See.

python: python.eslect //home/*: No such file or directory
Symptom:

/home/prefix/gentoo/usr/share/eselect/modules/python.eselect: line 395: cd: //home/prefix/gentoo/usr/bin/: No such file or directory

Reason: http://bugs.gentoo.org/show_bug.cgi?id=337370

Solution:

python: ls: cannot access python2.?
Symptom:

ls: cannot access python2.?: No such file or directory

Reason: Shell expressions in  don't match the .exe suffix.

Bug http://bugs.gentoo.org/show_bug.cgi?id=337601

Solution: Fix expressions. 

Emerging system
This part you find in the Solaris Process as

emerge --sync emerge -u system

Again we do it step by step to address different issues.

synchronize the portage tree
emerge --sync

overwrite make.defaults by make.conf
Sync of the portage tree now has a "make.defaults" for cygwin, but we can't use it (see issues). Overwrite it with the olds setting into make.conf.

file=~/gentoo/etc/make.conf echo 'EPREFIX="/home/prefix/gentoo"' >> $file echo 'DEFAULT_PATH="${DEFAULT_PATH}:${EPREFIX}/lib:${EPREFIX}/usr/lib"' >> $file echo 'ARCH="x86"'                        >> $file echo 'CHOST="i686-pc-cygwin1.7"'         >> $file echo 'ACCEPT_KEYWORDS="-x86 ~x86-linux -~x86-cygwin"' >> $file echo 'CPPFLAGS="-I/home/prefix/gentoo/usr/include"' >> $file echo 'LDFLAGS="-L/home/prefix/gentoo/usr/lib -L/home/prefix/gentoo/lib"' >> $file echo 'USE="-berkdb -fortran -gdbm -git -nls -pcre -ssl -python bootstrap"' >> $file
 * 1) Extend PATH to find libraries on Windows
 * 1) The base profile sets ACCEPT_KEYWORDS=x86 and we don't have that in prefix.

update portage
A new version of portage is available. Emerge recommends to update that first.

emerge --ask portage

fix QA complaints again
The  has been updated by portage. again and reemerge portage.

emerge --ask portage

emerge ncurses
emerge --oneshot ncurses

TODO: This breaks in the moment the new ncurses.dll comes into the game. Bash depends on it and addresses are changing at runtime.

emerge diffutils
emerge --oneshot diffutils

emerge gawk
Update overlay:

file=${OVERLAY}/sys-apps/gawk/gawk-3.1.8.ebuild mkdir ${OVERLAY}/sys-apps/gawk/ cp ${EPREFIX}/usr/portage/sys-apps/gawk/gawk-3.1.8.ebuild $file ln -s ${EPREFIX}/usr/portage/sys-apps/gawk/files/ ${OVERLAY}/sys-apps/gawk/files

Exclude  from ebuild.

sed -i 's/\(.*SFFS.*\)/#\1/' $file sed -i '/SFFS/aPLACEHOLDER=nonsense' $file

Rebuild the manifest before emerging:

ebuild $file digest env FEATURES="-collision-protect" emerge --oneshot gawk

emerge tar
emerge --oneshot tar

emerge cpio
emerge --oneshot cpio

emerge which
emerge --oneshot which

emerge coreutils
Update overlay:

cp ~/gentoo/usr/portage/sys-apps/coreutils/coreutils-8.5-r1.ebuild ~/overlay/sys-apps/coreutils/

Edit  function.

src_unpack { unpack ${A} cd "${S}" epatch /usr/src/coreutils-8.5-2.src.patch einfo "Running autoreconf:" autoreconf [... patches go here ... ] # Disable this interix patch as it conflicts: # epatch "${FILESDIR}"/${PN}-8.5-interix-warn-mount.patch [... 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 }

Rebuild the ebuild manifest before emerging:

ebuild ~/overlay/sys-apps/coreutils/coreutils-8.5-r1.ebuild digest emerge --oneshot coreutils

Make sure you run 'hash -r' in your active shells when done.

emerge groff
cp /usr/bin/install-info.exe.manifest /home/prefix/gentoo/usr/bin/install-info.exe.manifest cp /usr/bin/install-info.exe /home/prefix/gentoo/usr/bin/install-info.exe emerge --oneshot groff

emerge nano
emerge --oneshot nano

emerge findutils
emerge --oneshot findutils

emerge pager
emerge --oneshot pager

emerge bash
emerge --oneshot bash

emerge man
emerge --oneshot man

emerge editor
emerge --oneshot editor

emerge gcc
emerge --oneshot gcc

emerge debianutils
emerge --oneshot debianutils

emerge openssl
emerge --oneshot --nodeps openssl

emerge ca-certificates
emerge --oneshot ca-certificates

emerge openssh
emerge --oneshot openssh

invalid keyword ~x86-cygwin
Symtom: After the synchronization of the tree you get the error when you try the first emerge.

!!! INVALID ACCEPT_KEYWORDS: ~x86-cygwin

Reason: The updated prefix overlay contains a new file :

ARCH="x86-cygwin" CHOST="i686-pc-cygwin1.7" ACCEPT_KEYWORDS="~x86-cygwin"

Solution: See

groff: missing install-info.manifest
Symptom:

/home/prefix/gentoo/bin/bash: /home/prefix/gentoo/usr/bin/install-info: Permission denied

Solutiion: See

cp /usr/bin/install-info.exe.manifest /home/prefix/gentoo/usr/bin/install-info.exe.manifest

groff: install-info.manifest does not work
Symptom:

/home/prefix/gentoo/bin/bash: /home/prefix/gentoo/usr/bin/install-info: Permission denied

The install-info.manifest does not work for the install-info.exe we have compiled.

Reason: Unknown

Workaround: Cheat! Steal working install-info.exe from Cygwin.

cp /usr/bin/install-info.exe /home/prefix/gentoo/usr/bin/install-info.exe

Reemerging the system
This part you find in the Solaris Process as

emerge -e system

Again we do it step by step to address different issues.