Created attachment 521550 [details]
Portage 2.3.24 (python 2.7.14-final-0, default/bsd/fbsd/amd64/11.1, gcc-6.4.0, freebsd-lib-11.1-r1, 11.1_p2-Gentoo amd64)
System uname: FreeBSD-11.1_p2-Gentoo-amd64-64bit-ELF
KiB Mem: 20815984 total
KiB Swap: 0 total
Timestamp of repository gentoo: Thu, 01 Mar 2018 10:30:01 +0000
Head commit of repository gentoo: 86d798b17ab1c74f1255184e269867dcfecc9798
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
sys-devel/binutils: 2.29.1-r1::gentoo, 9999::gentoo
sys-freebsd/freebsd-lib: 11.1-r1::gentoo (virtual/os-headers)
CFLAGS="-O2 -pipe -mtune=generic"
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"
FEATURES="assume-digests binpkg-logs chflags config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news nodoc noinfo parallel-fetch preserve-libs protect-owned sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersync"
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"
USE="acl amd64-fbsd berkdb crypt cxx dri gdbm iconv ipv6 modules multilib ncurses nls oss pam pcre readline 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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="FreeBSD" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse" KERNEL="FreeBSD" L10N="de en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7" RUBY_TARGETS="ruby22 ruby23" USERLAND="BSD" VIDEO_CARDS="dummy 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, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
FreeBSD requires to define _WITH_GETLINE before including stdio.h. Something like this should work:
#if defined(__FreeBSD__) && !defined(_WITH_GETLINE)
The following commit should fix this and will be in OpenRC 0.35.1.
The fix doesn't work. Problem is that somehow _POSIX_C_SOURCE=200112L and _XOPEN_SOURCE=600 added to gcc's command-line. However, both are not defined (and build succeeds) if I call gmake ... directly within openrc's build directory.
The defines are set by mk/termcap.mk via pkg-config --cflags ncurses. A workaround could be to remove the include of termcap.mk within src/rc/Makefile, since nothing inside rc uses ncurses.
Created attachment 522228 [details, diff]
Please test with this patch and let me know if it resolves the issue.
The best fix would be to fix the ncurses.pc file to not include the
I could remove them in OpenRC's build system, but that is a hack;
ncurses should be fixed.
Which versions of ncurses add the inappropriate flags?
According to my research, (the getline man page in FreeBSD), the way to
access the getline function is to add -D_WITH_GETLINE to the command
line. This is done.
Please provide a build log that shows any failures when trying to build
(In reply to William Hubbs from comment #7)
> According to my research, (the getline man page in FreeBSD), the way to
> access the getline function is to add -D_WITH_GETLINE to the command
> line. This is done.
Then I would suggest you continue your research past the first snippet because this is just a hack to work-around broken _POSIX_C_SOURCE:
Applications that wish to use the getline() function described herein
should either request a strict IEEE Std 1003.1-2008 (``POSIX.1'')
environment by defining the macro _POSIX_C_SOURCE to the value 200809 or
greater, or by defining the macro _WITH_GETLINE, prior to the inclusion
I did see that, and it seems to imply that I can define either macro.
It looks like _BSD_SOURCE is probably a good way to go for this.
Otherwise I'll end up rewriting at least vsyslog and strsep.
Please test with 0.35.4 and report back. It turned out that I need
_BSD_SOURCE because we use vsyslog and strsep which are not posix c.
0.35.5 has been in the tree for several days now, so I need to know
whether it builds on FreeBSD.
Could someone test and let me know?
(In reply to William Hubbs from comment #12)
> 0.35.5 has been in the tree for several days now, so I need to know
> whether it builds on FreeBSD.
> Could someone test and let me know?
Still doesn't work.
Created attachment 530390 [details, diff]
Please test with this patch against 0.35.5 and let me know if it builds.
I am adding base-system to this bug since the issue is in ncurses.
Well, the patch either fixes it or triggers another error before it:
x86_64-gentoo-freebsd11.1-gcc -fPIC -DPIC -I../includes -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -O2 -pipe -march=native -std=c99 -Wall -Wextra -Wimplicit -Wshadow -Wformat=2 -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wnested-externs -Winline -Wwrite-strings -Wcast-align -Wcast-qual -Wpointer-arith -Wdeclaration-after-statement -Wsequence-point -Werror=implicit-function-declaration -c librc.c -o librc.So
In file included from /usr/include/machine/pcb.h:7:0,
/usr/include/machine/amd64_fbsd/pcb.h:79:2: error: unknown type name ‘u_int’
In file included from /usr/include/sys/user.h:44:0,
/usr/include/sys/ucred.h:84:2: error: unknown type name ‘u_int’
Created attachment 530642 [details, diff]
Ok, try this patch.
Let me know if it works.
Fails the same as previous.
I was just advised on the #freebsd-ports channel that
OpenRC 0.35.5 and HEAD build successfully on
native FreeBSD version 11-stable a couple of months old.
So, does anyone have any suggestions?
This keeps happening with sys-apps/openrc-0.36
As I stated above, I was advised that OpenRC builds fine on native
It seems like this might be because of a custom patch we carry which has
not been upstreamed in FreeBSD.
OK I've tried something silly which is to comment out the current src_compile() function and define another one which looks like this:
Now, compilation works out fine. I think something is up in some of the args given to make/gcc throug emake. Could someone else confirm?
Created attachment 536742 [details]
This is ncurses.pc from a native FreeBSD system.
Created attachment 536744 [details]
This is the ncurses.pc from a Gentoo/FreeBSD system.
This is how upstream ncurses writes their *.pc files. However, this is
incorrect as shown in the discussion linked in the see also section of
This is definitely a ncurses bug rather than an OpenRC bug.