Skip to content

Do not call timespec_get on android #3044

Closed
@yagnasrinath

Description

@yagnasrinath

Read the FAQ first: https://github.com/edenhill/librdkafka/wiki/FAQ

Description

Android libc(bionic) does not have timespec_get until recently. So, it is better to exclude using it just like how mac build is configured to be.

[ 40%] Linking C executable producer
../src/librdkafka.a(rdkafka.c.o): In function `rd_timeout_init_timespec':
/home/srinath/native/native/scripts/build-third-party-libs/librdkafka-v1.5.0/src/rdtime.h:234: undefined reference to `timespec_get'
../src/librdkafka.a(rdkafka_queue.c.o): In function `rd_timeout_init_timespec_us':
/home/srinath/native/native/scripts/build-third-party-libs/librdkafka-v1.5.0/src/rdtime.h:203: undefined reference to `timespec_get'
../src/librdkafka.a(rdkafka_queue.c.o): In function `rd_timeout_init_timespec':
/home/srinath/native/native/scripts/build-third-party-libs/librdkafka-v1.5.0/src/rdtime.h:234: undefined reference to `timespec_get'
clang70: error: linker command failed with exit code 1 (use -v to see invocation)

How to reproduce

A simple build on android using ndk, reproduces this issue. I could fix it using this:
sed -i 's/#ifdef __APPLE__/#if defined(__APPLE__) \|\| (defined(__ANDROID__) \&\& __API_LEVEL__ < 29)/g' src/rdtime.h

IMPORTANT: Always try to reproduce the issue on the latest released version (see https://github.com/edenhill/librdkafka/releases), if it can't be reproduced on the latest version the issue has been fixed.

Checklist

IMPORTANT: We will close issues where the checklist has not been completed.

Please provide the following information:

  • librdkafka version (release number or git tag): 1.5.0
  • Apache Kafka version: NA
  • librdkafka client configuration: NA
  • Operating system: android
  • Provide logs (with debug=.. as necessary) from librdkafka
  • Provide broker log excerpts
  • Critical issue

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