On Gentoo/FreeBSD, GNU patch is installed as `gpatch` but Portage executes `patch` with GNU-specific options. I have confirmed with sys-apps/portage-2.2.28 and 2.3.0_rc1-r1. For instance, here are error messages when emerging dev-libs/libxml2: >>> Verifying ebuild manifests >>> Emerging (1 of 1) dev-libs/libxml2-2.9.4::gentoo * libxml2-2.9.4.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ... [ ok ] >>> Unpacking source... >>> Unpacking libxml2-2.9.4.tar.gz to /var/tmp/portage/dev-libs/libxml2-2.9.4/work >>> Source unpacked in /var/tmp/portage/dev-libs/libxml2-2.9.4/work >>> Preparing source in /var/tmp/portage/dev-libs/libxml2-2.9.4/work/libxml2-2.9.4 ... * Applying libxml2-2.7.1-catalog_path.patch ... patch: invalid option -- g usage: patch [-bCcEeflNnRstuv] [-B backup-prefix] [-D symbol] [-d directory] [-F max-fuzz] [-i patchfile] [-o out-file] [-p strip-count] [-r rej-name] [-V t | nil | never] [-x number] [-z backup-ext] [--posix] [origfile [patchfile]] patch <patchfile [ !! ] * ERROR: dev-libs/libxml2-2.9.4::gentoo failed (prepare phase): * patch -p1 failed with /usr/portage/dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch * * Call stack: * ebuild.sh, line 133: Called src_prepare * environment, line 4676: Called eapply '/usr/portage/dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch' * environment, line 1204: Called _eapply_patch '/usr/portage/dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch' * environment, line 1142: Called __helpers_die 'patch -p1 failed with /usr/portage/dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch' * isolated-functions.sh, line 117: Called die * The specific snippet of code: * die "$@" * * If you need support, post the output of `emerge --info '=dev-libs/libxml2-2.9.4::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-libs/libxml2-2.9.4::gentoo'`. * The complete build log is located at '/var/tmp/portage/dev-libs/libxml2-2.9.4/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-libs/libxml2-2.9.4/temp/environment'. * Working directory: '/var/tmp/portage/dev-libs/libxml2-2.9.4/work/libxml2-2.9.4' * S: '/var/tmp/portage/dev-libs/libxml2-2.9.4/work/libxml2-2.9.4' The output of `emerge --info` is: Portage 2.3.0_rc1 (python 2.7.11-final-0, default/bsd/fbsd/amd64/10.3, gcc-5.3.0, freebsd-lib-10.3-r1, 10.3-r3-Gentoo amd64) ================================================================= System uname: FreeBSD-10.3-r3-Gentoo-amd64-64bit-ELF KiB Mem: 2062372 total KiB Swap: 4750324 total Timestamp of repository gentoo: Mon, 13 Jun 2016 07:02:05 +0000 sh sh ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1 app-shells/bash: 4.3_p42-r2::gentoo dev-lang/perl: 5.24.0-r1::gentoo dev-lang/python: 2.7.11-r2::gentoo, 3.4.4::gentoo dev-util/pkgconfig: 0.29.1::gentoo sys-apps/baselayout: 2.2::gentoo sys-apps/openrc: 0.21::gentoo sys-devel/autoconf: 2.69-r2::gentoo sys-devel/automake: 1.14.1-r1::gentoo, 1.15-r2::gentoo sys-devel/binutils: 2.25.1-r1::gentoo sys-devel/gcc: 5.3.0::gentoo sys-devel/gcc-config: 1.8-r1::gentoo sys-devel/libtool: 2.4.6-r2::gentoo sys-devel/make: 4.2.1::gentoo sys-freebsd/freebsd-lib: 10.3-r1::gentoo (virtual/os-headers) Repositories: gentoo location: /usr/portage sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo.git priority: -1000 ACCEPT_KEYWORDS="amd64-fbsd ~amd64-fbsd" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-gentoo-freebsd10.3" CFLAGS="-O2 -pipe -mtune=generic" CHOST="x86_64-gentoo-freebsd10.3" CONFIG_PROTECT="/boot/device.hints /etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/terminfo" CXXFLAGS="-O2 -pipe -mtune=generic" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs chflags config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersync" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://ftp.iij.ad.jp/pub/linux/gentoo/ http://ftp.jaist.ac.jp/pub/Linux/Gentoo/" INSTALL_MASK="/usr/lib/systemd" LDFLAGS="" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" USE="acl amd64-fbsd berkdb cracklib crypt cxx dri gdbm iconv ipv6 mmx mmxext modules multilib ncurses nls oss pam pcre python2 readline sse sse2 ssl tcpd unicode xattr zlib" ABI_X86="64" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3" ELIBC="FreeBSD" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse" KERNEL="FreeBSD" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="BSD" VIDEO_CARDS="apm ark chips cirrus cyrix dummy i128 intel mach64 mga nv r128 radeon rendition s3 s3virge savage siliconmotion sis tga trident tseng fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Well, it seems that the problem may not be in Portage, since sys-devel/libtool can be emerged without `ln -s /usr/bin/gpatch /usr/local/bin/patch` trick whereas dev-libs/libxml2 needs the trick.
This a bug of portage's eapply. ebuilds using eutil's epatch are not affected since bug 404447 and bug 461568. Probably eapply should get the same fix.
*** This bug has been marked as a duplicate of bug 574626 ***