Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using SwiftKafka for watchOS #9

Open
MFabi23 opened this issue Feb 28, 2020 · 2 comments
Open

Using SwiftKafka for watchOS #9

MFabi23 opened this issue Feb 28, 2020 · 2 comments

Comments

@MFabi23
Copy link

MFabi23 commented Feb 28, 2020

I am developing a watchOS app, that uses data coming from a Kafkastream and I want to use this library for this purpose, but it keeps ignoring my local "librdkafka" library.

Detailed error description:

  • Warnings:
  1. ignoring file /usr/local/Cellar/librdkafka/1.3.0/lib/librdkafka.dylib, building for watchOS-arm64_32 but attempting to link with file built for macOS-x86_64
  • Errors:
    Undefined symbol: _rd_kafka_produce
    Undefined symbol: _rd_kafka_poll
    Undefined symbol: _rd_kafka_conf_dump
    Undefined symbol: _rd_kafka_topic_name
    Undefined symbol: _rd_kafka_consumer_close
    Undefined symbol: _rd_kafka_consumer_poll
    Undefined symbol: _rd_kafka_flush
    Undefined symbol: _rd_kafka_brokers_add
    Undefined symbol: _rd_kafka_commit
    Undefined symbol: _rd_kafka_topic_partition_list_new
    Undefined symbol: _rd_kafka_topic_partition_list_destroy
    Undefined symbol: _rd_kafka_message_destroy
    Undefined symbol: _rd_kafka_topic_new
    Undefined symbol: _rd_kafka_topic_partition_list_add
    Undefined symbol: _rd_kafka_subscribe
    Undefined symbol: _rd_kafka_conf_set_dr_msg_cb
    Undefined symbol: _rd_kafka_conf_set
    Undefined symbol: _rd_kafka_conf_dup
    Undefined symbol: _rd_kafka_conf_new
    Undefined symbol: _rd_kafka_conf_destroy
    Undefined symbol: _rd_kafka_conf_dump_free
    Undefined symbol: _rd_kafka_poll_set_consumer
    Undefined symbol: _rd_kafka_topic_destroy
    Undefined symbol: _rd_kafka_assign
    Undefined symbol: _rd_kafka_new
    Undefined symbol: _rd_kafka_destroy

What I did:

  1. Installed librdkafka
  • brew install librdkafka
  1. Created app
  • Created a new watchOS standalone app in Xcode
  • Added a new SwiftPackage with the built-in SPM from Xcode using the URL from your GitHub SwiftKafka project
  • Added SwiftKafka to "Link Binary With Libraries" in my WatchKit Extension
  1. Build the App -> Build failed with above errors
@MFabi23
Copy link
Author

MFabi23 commented Feb 28, 2020

I tried with the AppleWatch simulators and a real AppleWatch Series 4 as target device.

@winsmith
Copy link

winsmith commented Feb 3, 2022

To compile librdkafka with Xcode, do these two things:

  1. brew install librdkafka
  2. add this to the target section of your Package.swift:
linkerSettings: [
    .unsafeFlags(["-Xlinker", "-L/usr/local/lib"], .when(platforms: [.macOS]))
]

I know this comment is old but I just finally figured this out and I'm overjoyed to share!

source: #11 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants