I am working through the example in the docs at https://github.com/apple/swift-collections-benchmark/blob/main/Documentation/01%20Getting%20Started.md, and having some trouble reproducing the example that @lorenty included there. I realized there was some Package.swift machinations that were needed to try it all out, so I created a basic one, and am running into some linking issues that are confusing me.
I made a project Kalimba (just in the Docs directory) with just the extension on Sequence within it, added the dependencies, and was trying to compile it - but
swift run -c release kalimba-benchmark run --cycles 3 results returned the error:
/Users/heckj/src/swift-collections-benchmark/Documentation/.build/x86_64-apple-macosx/release/Kalimba.build/module.modulemap:2:12: error: header '/Users/heckj/src/swift-collections-benchmark/Documentation/.build/x86_64-apple-macosx/release/Kalimba.build/Kalimba-Swift.h' not found header "/Users/heckj/src/swift-collections-benchmark/Documentation/.build/x86_64-apple-macosx/release/Kalimba.build/Kalimba-Swift.h" ^ /Users/heckj/src/swift-collections-benchmark/Documentation/Sources/kalimba-benchmark/main.swift:2:8: error: could not build Objective-C module 'Kalimba' import Kalimba
I assumed it was due to interlinking with Foundation in some fashion since the example is an extension on Sequence, so I added a nearly-do-nothing Kalimba.h file into the Sources.
Then trying the same command (
swift run -c release kalimba-benchmark run --cycles 3 results) resulted in a linking error:
Undefined symbols for architecture x86_64: "_$sST7KalimbaE14kalimbaOrderedSay7ElementQzGyF", referenced from: _$s17kalimba_benchmarkySaySiGcfU_ in main.swift.o ld: symbol(s) not found for architecture x86_64 [0/1] Linking kalimba-benchmark
I demangled that to:
(extension in Kalimba):Swift.Sequence.kalimbaOrdered() -> [A.Element]
But I'm a bit lost on what the underlying issue is. Is this ringing a bell with anyone?
I have the code in a branch on Github (GitHub - heckj/swift-collections-benchmark at docExample). Can anyone a bit more familiar here explain what I'm hitting with the linking errors, or possibly have some suggestions for how to get the example working?