我创建了一个使用Swift library Kitura-Net的CHTTPParser。
现在我正在尝试在使用Vapor的CHTTP应用程序中使用我的库。
我的库构建完美,我的Vapor应用程序没有我的库构建也很好。
但是当我将我的库添加为依赖项时,所以它在Vapor应用程序中编译,我得到重复符号错误。
似乎CHTTP和CHTTPParser都实现了相同的类: http_parser
这是干净构建后的日志:
Compile CHTTP http_parser.c
Compile CSQLite sqlite3.c
Compile CHTTPParser utils.c
Compile CHTTPParser http_parser.c
Compile Swift Module 'libc' (1 sources)
Compile Swift Module 'Debugging' (1 sources)
Compile Swift Module 'Bits' (19 sources)
Compile Swift Module 'PathIndexable' (2 sources)
Compile Swift Module 'SwiftyJSON' (2 sources)
Compile Swift Module 'Socket' (3 sources)
Compile Swift Module 'LoggerAPI' (1 sources)
Compile Swift Module 'Core' (23 sources)
Compile Swift Module 'Random' (6 sources)
Compile Swift Module 'Transport' (10 sources)
Compile Swift Module 'Node' (38 sources)
Compile Swift Module 'Console' (35 sources)
Compile Swift Module 'Crypto' (13 sources)
Compile Swift Module 'BCrypt' (9 sources)
Compile Swift Module 'URI' (6 sources)
Compile Swift Module 'Sockets' (22 sources)
Compile Swift Module 'Cache' (2 sources)
Compile Swift Module 'Branches' (3 sources)
Compile Swift Module 'JSON' (9 sources)
Compile Swift Module 'SQLite' (4 sources)
Compile Swift Module 'TLS' (12 sources)
Compile Swift Module 'SMTP' (21 sources)
Compile Swift Module 'Configs' (13 sources)
Compile Swift Module 'Fluent' (70 sources)
Compile Swift Module 'SSLService' (1 sources)
Compile Swift Module 'HTTP' (45 sources)
Compile Swift Module 'KituraNet' (36 sources)
Compile Swift Module 'Cookies' (11 sources)
Compile Swift Module 'WebSockets' (14 sources)
Compile Swift Module 'Multipart' (6 sources)
Compile Swift Module 'Sessions' (7 sources)
Compile Swift Module 'Routing' (10 sources)
Compile Swift Module 'Quack' (4 sources)
Compile Swift Module 'FormData' (4 sources)
Compile Swift Module 'Vapor' (97 sources)
Compile Swift Module 'ConsulSwift' (17 sources)
Compile Swift Module 'Testing' (6 sources)
Compile Swift Module 'FluentProvider' (19 sources)
Compile Swift Module 'CVServiceRegistry' (2 sources)
Compile Swift Module 'App' (5 sources)
Compile Swift Module 'Run' (1 sources)
Linking ./.build/x86_64-apple-macosx10.10/debug/Run
duplicate symbol _http_parser_settings_init in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_parser_init in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_parser_url_init in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_method_str in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_errno_description in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_parser_version in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_parser_parse_url in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_body_is_final in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_message_needs_eof in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_should_keep_alive in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_parser_execute in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_parser_pause in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
duplicate symbol _http_errno_name in:
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/http_parser.c.o
/path_on_my_mac/.build/x86_64-apple-macosx10.10/debug/CHTTPParser.build/http_parser.c.o
ld: 13 duplicate symbols for architecture x86_64
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /path_on_my_mac/.build/debug.yaml main
有没有人能帮我解决这个问题?
有趣的信息:当我使用Xcode构建和运行Vapor应用程序时,一切正常。