swift-server / swift-kafka-client

Apache License 2.0
81 stars 20 forks source link

Undeclared function 'RAND_priv_bytes' after switch to BoringSSL #138

Open axelandersson opened 11 months ago

axelandersson commented 11 months ago
$ sw_vers 
ProductName:            macOS
ProductVersion:         14.0
BuildVersion:           23A344
$ swift -v
Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)

Checked out main:

commit 5dbf2fadd2ae30d4a90a1df0b8a02083727ba36a (HEAD -> main, origin/main, origin/HEAD)
Author: Felix Schlegel <fefefe152@gmail.com>
Date:   Thu Oct 5 10:16:41 2023 +0200

    Ship with BoringSSL (#135)

Pulled librdkafka:

$ git submodule update --remote
Cloning into '/Users/axel/swift-kafka-client/Sources/Crdkafka/librdkafka'...
Submodule path 'Sources/Crdkafka/librdkafka': checked out 'be353be5f6ceaa11a95e21472e981d871ab1aaee'

Ran swift test:

/Users/axel/swift-kafka-client/Sources/Crdkafka/librdkafka/src/rdkafka_admin.c:5481:21: error: call to undeclared function 'RAND_priv_bytes'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                if (RAND_priv_bytes(random_salt, sizeof(random_salt)) == 1) {
FranzBusch commented 11 months ago

Thanks for reporting this. @axelandersson what OS are you trying to build this library on?

axelandersson commented 11 months ago

Thanks for reporting this. @axelandersson what OS are you trying to build this library on?

This is on Sonoma 14.0 with Xcode 15 toolchain. Swift version:

Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)

FranzBusch commented 11 months ago

Ah you updated the librdkafka version. If you don't do git submodule update --remote then it should build fine. @felixschlegel we gotta check why it fails on the latest librdkafka version though.

hassila commented 10 months ago

@FranzBusch anything we can do to help out here?

FranzBusch commented 10 months ago

@FranzBusch anything we can do to help out here?

Would appreciate a PR for it. I think the solution should be as easy as doing something like this #define RAND_priv_bytes(x,sz) RAND_bytes((x),(sz)) in a C file where we shim boringssl to openssl.

hassila commented 10 months ago

https://github.com/swift-server/swift-kafka-client/pull/148

:-)