Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 650908 - sys-apps/openrc-0.35.5: librc-daemon.c:620:9: error: implicit declaration of function 'kill' (uclibc-ng)
Summary: sys-apps/openrc-0.35.5: librc-daemon.c:620:9: error: implicit declaration of ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: uclibc-porting
  Show dependency tree
 
Reported: 2018-03-19 15:58 UTC by Joshua Kinard
Modified: 2018-05-07 00:14 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
test case that fails with gcc -ansi -Wall -Werror, except with -D_POSIX_SOURCE (posix_source.c,464 bytes, text/x-csrc)
2018-04-26 00:09 UTC, Zac Medico
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Kinard gentoo-dev 2018-03-19 15:58:35 UTC
Trying to update a MIPS/uclibc-ng chroot on my SGI build machine, current OpenRC is refusing to compile due to a missing declaration of 'kill'.  I suspect the root issue is in uclibc-ng itself in a header somewhere.

mips-unknown-linux-uclibc-gcc -fPIC -DPIC  -I../includes -D_DEFAULT_SOURCE  -Os -pipe -march=mips2 -mtune=mips2 -mplt -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-daemon.c -o librc-daemon.So
librc-daemon.c: In function 'rc_service_daemons_crashed':
librc-daemon.c:620:9: error: implicit declaration of function 'kill'; did you mean 'killpg'? [-Werror=implicit-function-declaration]
     if (kill(pid, 0) == -1 && errno == ESRCH)
         ^~~~
         killpg
librc-daemon.c:620:9: warning: nested extern declaration of 'kill' [-Wnested-externs]
cc1: some warnings being treated as errors
make[2]: *** [../../mk/lib.mk:34: librc-daemon.So] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/var/tmp/portage/sys-apps/openrc-0.35.5/work/openrc-0.35.5/src/librc'
make[1]: *** [../mk/subdir.mk:26: all] Error 2
make[1]: Leaving directory '/var/tmp/portage/sys-apps/openrc-0.35.5/work/openrc-0.35.5/src'
make: *** [/var/tmp/portage/sys-apps/openrc-0.35.5/work/openrc-0.35.5//mk/subdir.mk:26: all] Error 2
 * ERROR: sys-apps/openrc-0.35.5::gentoo failed (compile phase):
 *   emake failed
 *
Comment 1 Joshua Kinard gentoo-dev 2018-03-19 15:59:54 UTC
Portage 2.3.24 (python 3.6.4-final-0, default/linux/uclibc/mips, gcc-7.3.0, uclibc-ng-1.0.29, 4.15.7-mipsgit-20180204 mips64)
=================================================================
System uname: Linux-4.15.7-mipsgit-20180204-mips64-R14000_V2.4_FPU_V0.0-with-gentoo-2.4.1
KiB Mem:     2080128 total,    283072 free
KiB Swap:    3145536 total,   3136960 free
Timestamp of repository gentoo: Sat, 17 Mar 2018 23:15:01 +0000
Head commit of repository gentoo: 8d9802f10404e661b9ff37d732cc4d307442082c
sh bash 4.4_p19
ld GNU ld (Gentoo 2.30 p1) 2.30.0
app-shells/bash:          4.4_p19::gentoo
dev-lang/perl:            5.26.1-r2::gentoo

sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r3::gentoo
sys-kernel/linux-headers: 4.15::gentoo (virtual/os-headers)
sys-libs/uclibc-ng:       1.0.29::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts:
    sync-rsync-verify-metamanifest: no

ACCEPT_KEYWORDS="mips ~mips"
ACCEPT_LICENSE="* -@EULA"
CBUILD="mips-unknown-linux-uclibc"
CFLAGS="-Os -pipe -march=mips2 -mtune=mips2 -mplt"
CHOST="mips-unknown-linux-uclibc"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-Os -pipe -march=mips2 -mtune=mips2 -mplt"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
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="bindist cli crypt cxx dri fortran iconv ipv6 mips modules ncurses nptl openmp pcre readline seccomp ssl tcpd uclibc unicode xattr zlib" ABI_MIPS="o32" 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" ELIBC="uclibc" 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="libinput keyboard mouse" KERNEL="linux" 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="python3_5" PYTHON_TARGETS="python2_7 python3_5 python3_4 python3_6" RUBY_TARGETS="ruby22 ruby23" USERLAND="GNU" VIDEO_CARDS="dummy fbdev v4l" 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, INSTALL_MASK, LANG, LC_ALL, LINGUAS, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 William Hubbs gentoo-dev 2018-03-19 17:42:04 UTC
I agree, this definitely looks like a uclibc-ng issue since I am
including the correct header files for kill on glibc and musl.
Comment 3 William Hubbs gentoo-dev 2018-03-19 22:35:28 UTC
Looking at this further, I found in uclibc-ng's git sources, that the
kill prototype is in include/signal.h, surrounded by a __USE_POSIX
guard, identical to the way it is set up in glibc.

So I'm still missing where __USE_POSIX is actually defined. It seems
like the issue might be a difference in the definition of __USE_POSIX
for uclibc-ng.
Comment 4 Joshua Kinard gentoo-dev 2018-03-20 04:35:49 UTC
(In reply to William Hubbs from comment #3)
> Looking at this further, I found in uclibc-ng's git sources, that the
> kill prototype is in include/signal.h, surrounded by a __USE_POSIX
> guard, identical to the way it is set up in glibc.
> 
> So I'm still missing where __USE_POSIX is actually defined. It seems
> like the issue might be a difference in the definition of __USE_POSIX
> for uclibc-ng.

The lead uclibc-ng dev had indicated in the past they copy some code straight out of glibc.  Could be this is one such case and they forgot to copy the definition of __USE_POSIX.
Comment 5 Zac Medico gentoo-dev 2018-04-26 00:09:41 UTC
Created attachment 528528 [details]
test case that fails with gcc -ansi -Wall -Werror, except with -D_POSIX_SOURCE

I've reproduced with the attached test case, and it looks like the same issue as described here:

https://stackoverflow.com/questions/9994530/warning-implicit-declaration-of-function-kill
Comment 6 Zac Medico gentoo-dev 2018-04-26 00:14:10 UTC
My test case also fails with glibc-2.25-r9 and gcc-7.3.0.
Comment 7 William Hubbs gentoo-dev 2018-04-26 21:21:14 UTC
According to man feature_test_macros, _POSIX_SOURCE should not be used.
Also, we use -std=c99 for openrc.
Comment 8 William Hubbs gentoo-dev 2018-04-26 21:26:27 UTC
Also, we use _DEFAULT_SOURCE, which should cover what _POSIX_SOURCE did.
Comment 9 Zac Medico gentoo-dev 2018-04-26 22:07:31 UTC
CFLAGS="-D_XOPEN_SOURCE=700" suppresses the issue, so maybe this commit triggered the problem:

https://github.com/OpenRC/openrc/commit/6dc0d0af333592203fabd4746279bb15d2801c0b
Comment 10 Zac Medico gentoo-dev 2018-04-26 22:47:35 UTC
This is the key condition from the uclibc-ng features.h:

> #if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE
> # define __USE_POSIX    1
> #endif
Comment 11 Larry the Git Cow gentoo-dev 2018-05-01 21:19:46 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e4afc1bb6afddad8601a5f88d71a23d31bb06570

commit e4afc1bb6afddad8601a5f88d71a23d31bb06570
Author:     William Hubbs <williamh@gentoo.org>
AuthorDate: 2018-05-01 21:18:27 +0000
Commit:     William Hubbs <williamh@gentoo.org>
CommitDate: 2018-05-01 21:19:07 +0000

    sys-apps/openrc: Fix build on uclibc-ng
    
    Bug: https://bugs.gentoo.org/show_bug.cgi?id=650908
    Package-Manager: Portage-2.3.24, Repoman-2.3.6

 ..._POSIX_C_SOURCE-definition-to-Linux-build.patch | 29 ++++++++++++++++++++++
 sys-apps/openrc/openrc-0.35.5.ebuild               |  4 +++
 2 files changed, 33 insertions(+)
Comment 12 William Hubbs gentoo-dev 2018-05-02 15:45:49 UTC
The patch I added above should fix the build for OpenRC 0.35.5.
Can you verify that you can build it now with uclibc-ng?

Thanks,

William
Comment 13 Joshua Kinard gentoo-dev 2018-05-03 05:33:29 UTC
(In reply to William Hubbs from comment #12)
> The patch I added above should fix the build for OpenRC 0.35.5.
> Can you verify that you can build it now with uclibc-ng?
> 
> Thanks,
> 
> William

I won't have time to fire my Octane back up until at least the weekend, so I'll try then.
Comment 14 Zac Medico gentoo-dev 2018-05-03 05:54:21 UTC
The patch works for me, tested with uclibc-ng-1.0.29 and uclibc-ng-1.0.30-r1.