[swift-users] SwiftProtobuf unable to link on Ubuntu

Geordie J geojay at gmail.com
Sat Oct 14 15:41:47 CDT 2017


Hi Edward,

> Am 14.10.2017 um 22:35 schrieb Edward Connell <ewconnell at gmail.com>:
> 
> Hi Geordie,
> That is actually a capital "I" eye for import
> This font make an eye and elle look the same. This is the build line I am trying to use.

My apologies.

> 
> 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.

Cheers,
Geordie

> 
> On Sat, Oct 14, 2017 at 1:00 PM, Geordie J <geojay at gmail.com <mailto:geojay at gmail.com>> wrote:
> Hi
> 
>> Am 14.10.2017 um 21:55 schrieb Edward Connell via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>>:
>> 
>> Has anyone used the SwiftProtobuf module on Linux?
>> https://github.com/apple/swift-protobuf <https://github.com/apple/swift-protobuf>
>> 
>> I am able to successfully generate swift classes from my proto file.
>> However when building, the code compiles but I get a ton of undefined link references.
>> 
>> I included -Xswiftc -I/home/ed/swift-protobuf/.build/release so the module is found, but still….
> 
> This should be "-Xlinker” rather than “-Xswiftc”, and also “-l” is for specifying system library names (e.g. "-latomic”). I’m pretty new to this but I think the correct flag is “-L”.
> So in the past I have used “-Xlinker -L/path/to/libs”, but I’ve recently read you can actually leave off “-Xlinker” and just have the “-L” bit.
> 
> Hope that helps.
> 
> - Geordie
> 
>> 
>> ------------------------
>> /home/ed/Documents/prototest/Sources/DataModel.pb.swift:31: error: undefined reference to '_T013SwiftProtobuf14UnknownStorageVACycfC'
>> /home/ed/Documents/prototest/Sources/DataModel.pb.swift:31: error: undefined reference to '_T013SwiftProtobuf14UnknownStorageVACycfC'
>> /home/ed/Documents/prototest/Sources/DataModel.pb.swift:64: error: undefined reference to '_T013SwiftProtobuf14UnknownStorageV8traverseyxz7visitor_tKAA7VisitorRzlF'
>> /home/ed/Documents/prototest/Sources/DataModel.pb.swift:0: error: undefined reference to '_T013SwiftProtobuf7MessagePAAE13isInitializedSbfg'
>> 
>> etc...
>> 
>> Does anyone have a simple working example on Ubuntu?
>> 
>> Ubuntu 16.04
>> Swift 4.0 release
>> 
>> Thanks, Ed
>> _______________________________________________
>> swift-users mailing list
>> swift-users at swift.org <mailto:swift-users at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-users <https://lists.swift.org/mailman/listinfo/swift-users>
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20171014/5fd88623/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: Message signed with OpenPGP
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20171014/5fd88623/attachment.sig>


More information about the swift-users mailing list