Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 898662 - net-libs/libmicrohttpd-0.9.76 has implicit function declarations in configure logs
Summary: net-libs/libmicrohttpd-0.9.76 has implicit function declarations in configure...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Karlson2k
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: 906027
  Show dependency tree
 
Reported: 2023-03-02 07:53 UTC by Agostino Sarubbo
Modified: 2023-05-10 19:42 UTC (History)
3 users (show)

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


Attachments
build.log (build.log,101.99 KB, text/plain)
2023-03-02 07:53 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2023-03-02 07:53:53 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: net-libs/libmicrohttpd-0.9.75 has implicit function declarations in configure logs.
Discovered on: amd64 (internal ref: ci)

NOTE:
See also: https://bugs.gentoo.org/898488#c4.
Comment 1 Agostino Sarubbo gentoo-dev 2023-03-02 07:53:55 UTC
Created attachment 855512 [details]
build.log

build log and emerge --info
Comment 2 Karlson2k 2023-03-02 08:14:17 UTC
These implicit declarations and few other detection issues related to new compiler settings were partially fixed already in git master.
Others will be fixed soon and included in the next release.
Comment 3 Karlson2k 2023-03-03 12:37:49 UTC
All these three possible problems reported by QA are false positives.
See:
* for 'gethrtime' - https://git.gnunet.org/libmicrohttpd.git/tree/configure.ac?h=v0.9.75#n1825
* for 'sysctl' - https://git.gnunet.org/libmicrohttpd.git/tree/configure.ac?h=v0.9.75#n1934
*for 'sysctlbyname' - https://git.gnunet.org/libmicrohttpd.git/tree/configure.ac?h=v0.9.75#n1947
and https://git.gnunet.org/libmicrohttpd.git/tree/m4/mhd_check_func.m4

The configure script does not rely on implicit declarations for these functions, while "implicit declaration" is a natural warning for functions not declared in headers.

This bug should be closed as INVALID.
Comment 4 Karlson2k 2023-03-03 12:42:35 UTC
I'll QA_CONFIG_IMPL_DECL_SKIP to libmicrohttpd ebuild.

However there are many functions checked by configure. Some of them may be not available on specific platforms, while other functions may be not available on other platforms. 
Should I add all functions correctly checked by 'configure' to the exclusion list? I could be very large list.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-03-03 12:44:46 UTC
(In reply to Karlson2k from comment #3)
> The configure script does not rely on implicit declarations for these
> functions, while "implicit declaration" is a natural warning for functions
> not declared in headers.

Are you sure that configure yields correct results with clang-16?  Even if they're irrelevant to the check at hand, make sure that these declarations don't cause the check to flip the result.
Comment 6 Karlson2k 2023-03-03 13:03:26 UTC
This configure script does not rely on implicit declarations.

Any simple code like

int main(void)
{
  non_exisiting_function();
  return 0;
}

will emit the warning about implicit declaration of non_exisiting_function.
This will fail on compile or link stage, depending on build flags. And the warning or error for implicit declaration should be fine as this is the way to correctly check for function presence on the platform.

libmicrohttpd configure script uses right headers. For example for gethrtime() check includes <sys/time.h> and <time.h> which must declare this function if it is present on system. 
See https://git.gnunet.org/libmicrohttpd.git/tree/configure.ac?h=v0.9.75#n1825

I would prefer to not spoil ebuild files with *all* functions correctly checked by configure, but which could be potentially absent on some particular system.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-03-03 13:09:50 UTC
The sysctl() check looks suspicious.
Comment 8 Karlson2k 2023-03-03 13:18:22 UTC
It is a syscall, not utility.

This is correct, see https://linux.die.net/man/2/sysctl

libmicrohttpd uses it on FreeBSD and other *BSD platforms.
Comment 9 Agostino Sarubbo gentoo-dev 2023-04-10 12:52:42 UTC
ci has reproduced this issue with version 0.9.76 - Updating summary.
Comment 10 Karlson2k 2023-04-10 12:56:35 UTC
QA reports are false positives.

libmicrohttpd detects all functions correctly with clang-16, clang-17 (current development version), gcc-12 -Werror=implicit-function-declaration,implicit-int
There is no problem with libmicrohttpd to fix.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-04-10 13:02:33 UTC
(In reply to Karlson2k from comment #10)
> QA reports are false positives.
> 
> libmicrohttpd detects all functions correctly with clang-16, clang-17
> (current development version), gcc-12
> -Werror=implicit-function-declaration,implicit-int
> There is no problem with libmicrohttpd to fix.

Then add them to the whitelist?
Comment 12 Karlson2k 2023-04-10 13:08:28 UTC
Three functions "detected" are not the complete list. With other settings or environment configure may detect more missing function.
Add to whitelist all functions detected by configure? Then what's the reason to have this kind of such "problem" detection?
It would make more sense to just whitelist this configure.
Comment 13 Karlson2k 2023-05-09 13:32:48 UTC
This is false positive warnings.
libmicrohttpd always uses correct headers when checking for functions in configure.
If function is not declared then compiler warns on implicit declaration and then linker fail or (depending on compiler and flags) compiler stops with error. In any case the check fails.
libmicrohttpd does not rely on any implicit declaration, neither in configure nor in building process.

libmicrohttpd uses a lot of correct checks for functions presence on the platform. To workarounds false positive warnings it is required to add all checks to QA exclude list, but in such case exclude list makes no sense (if everything that is checked needs to be excluded from check).

libmicrohttpd detects all functions correctly with any gcc version (checked from 3.4 up to the latest), including versions 10.4, 11.3, 12.3 and 13.1.
clang works fine for any versions from 3.3 up to 16.0.2.
All checks work correctly with -Werror=implicit-function-declaration,implicit-int and without it.

There is nothing to fix in libmicrohttpd.
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-09 13:36:39 UTC
(In reply to Karlson2k from comment #13)
> There is nothing to fix in libmicrohttpd.

You've made that clear. So please set the exclude list to avoid noise.
Comment 15 Karlson2k 2023-05-09 14:08:08 UTC
OK, I'm giving up. :)
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-09 14:12:04 UTC
If you're asserting it's fine, set the thing to silence it? I don't get how that's controversial.

Note that you can use .* if you insist.
Comment 17 Karlson2k 2023-05-09 14:13:22 UTC
I've added all custom checks that may potentially trigger QA warnings.
Comment 18 Karlson2k 2023-05-09 14:18:30 UTC
I wasn't aware about wildcard masking capability, so I used specific checks masking, which is more future-proof.
Anyway, in next version configure will use double checks for every function: first check for declaration only and then check whether linker succeed. Configure works longer, but it should not generate any false positive warnings and probably it may improve configure results debugging.
Comment 19 Larry the Git Cow gentoo-dev 2023-05-10 19:42:55 UTC
The bug has been closed via the following commit(s):

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

commit a566d1a5c7f9d722369d0b511f8a881b7804e2ef
Author:     Karlson2k (Evgeny Grin) <k2k@narod.ru>
AuthorDate: 2023-05-09 14:06:11 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-05-10 19:42:33 +0000

    net-libs/libmicrohttpd: fixed false positive QA warnings
    
    Closes: https://bugs.gentoo.org/898662
    
    Signed-off-by: Karlson2k (Evgeny Grin) <k2k@narod.ru>
    Closes: https://github.com/gentoo/gentoo/pull/30954
    Signed-off-by: Sam James <sam@gentoo.org>

 net-libs/libmicrohttpd/libmicrohttpd-0.9.75.ebuild | 38 ++++++++++++++++++++++
 net-libs/libmicrohttpd/libmicrohttpd-0.9.76.ebuild | 38 ++++++++++++++++++++++
 2 files changed, 76 insertions(+)