Skip to content

clock_gettime(): not found during config due to including the wrong sched.h header instead of the correct time.h #1566

@BalkanMadman

Description

@BalkanMadman

Hello! We, at Gentoo, work on improving the state of NGINX ecosystem. As part of our efforts, I have been working on better supporting your module.

Getting straight to the point. Your config check checks whether clock_gettime() is available, additionally including the sched.h header.

nginx-vod-module/config

Lines 125 to 145 in 26f0687

# clock_gettime
#
ngx_feature="clock_gettime()"
ngx_feature_name="NGX_HAVE_CLOCK_GETTIME"
ngx_feature_run=no
ngx_feature_incs="#include <sched.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="clock_gettime()"
. auto/feature
if [ $ngx_found != yes ]; then
ngx_feature="clock_gettime() in librt"
ngx_feature_libs="-lrt"
. auto/feature
if [ $ngx_found = yes ]; then
ngx_module_libs="$ngx_module_libs $ngx_feature_libs"
fi
fi

This fails, because, according to POSIX and GNU, the clock_gettime() function is provided by time.h, not sched.h.

Thus, the line

ngx_feature_incs="#include <sched.h>"

should be changed to

ngx_feature_incs="#include <time.h>"

to check for clock_gettime() properly. I will follow this issue with a PR fixing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions