[swift-users] SwiftProtobuf unable to link on Ubuntu

Alex Blewitt alblue at apple.com
Mon Oct 16 03:42:17 CDT 2017

> On 14 Oct 2017, at 21:41, Geordie J via swift-users <swift-users at swift.org> wrote:
>> swift build -Xswiftc -I/home/ed/swift-protobuf/.build/release -Xlinker -L/home/ed/swift-protobuf/.build/release
> Have you considered using Swift Package Manager to add protobuf as a project dependency? Then you wouldn’t have to mess around with command line arguments at all. I haven’t used protobuf yet so can’t help with specifics.

I'd strongly recommend using Swift Package Manager to help you here. You need to compile and build protobuf and have that linked into your product at the same time. Since this is what Swift PM works well for that's probably the longer-term supported way forward.

If you're still trying to do this via the command line, I recommend finding where you're compiling the .so for the swift-protobuf code, then using nm and grep to look through that library to confirm whether or not it contains the symbols that your code thinks is missing.

If you have acquired a swift-protobuf binary library from somewhere else, it may not have the Swift code you're looking for, or it may be compiled with a different version of Swift, both of which can affect the names of the symbols being linked. Generally speaking, any _T* symbols are Swift symbols, and that's usually a clue that either they are not present in the libraries you have specified in the command line, or the library you're linking against doesn't have them. Follow the rabbit down the hole and find out which if you are against using Swift PM.


More information about the swift-users mailing list