Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-3816] [SwiftPM] Missing Link declaration in modulemap on importing C package #5119

Closed
norio-nomura opened this issue Feb 1, 2017 · 5 comments
Labels

Comments

@norio-nomura
Copy link
Contributor

Previous ID SR-3816
Radar None
Original Reporter @norio-nomura
Type Bug
Status Resolved
Resolution Done
Environment

swift-3.1-DEVELOPMENT-SNAPSHOT-2017-01-31-a

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: b4c3c563949bdbba4657e4db1204035d

Issue Description:

That causes undefined reference error on linking test package.

Reproducing step:

21:31:13  git clone https://github.com/jpsim/Yams.git -b nn-swift3.1-on-linux
Cloning into 'Yams'...
remote: Counting objects: 690, done.
remote: Compressing objects: 100% (209/209), done.
remote: Total 690 (delta 148), reused 34 (delta 34), pack-reused 447
Receiving objects: 100% (690/690), 750.86 KiB | 460.00 KiB/s, done.
Resolving deltas: 100% (374/374), done.
➜  21:31:18  cd Yams21:31:21 git:(nn-swift3.1-on-linux) docker run --privileged -it -v `pwd`:`pwd` -w `pwd` --rm norionomura/swift:3120170131a swift test
Compile CYaml src/writer.c
Compile CYaml src/scanner.c
Compile CYaml src/reader.c
Compile CYaml src/parser.c
Compile CYaml src/loader.c
Compile CYaml src/emitter.c
Compile CYaml src/dumper.c
Compile CYaml src/api.c
Linking CYaml
Compile Swift Module 'Yams' (9 sources)
Compile Swift Module 'YamsTests' (10 sources)
Linking ./.build/debug/YamsPackageTests.xctest
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:245: error: undefined reference to 'yaml_stream_start_event_initialize'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:288: error: undefined reference to 'yaml_document_start_event_initialize'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:291: error: undefined reference to 'yaml_document_end_event_initialize'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:262: error: undefined reference to 'yaml_stream_end_event_initialize'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:208: error: undefined reference to 'yaml_emitter_initialize'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:215: error: undefined reference to 'yaml_emitter_set_output'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:217: error: undefined reference to 'yaml_emitter_set_canonical'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:218: error: undefined reference to 'yaml_emitter_set_indent'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:219: error: undefined reference to 'yaml_emitter_set_width'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:220: error: undefined reference to 'yaml_emitter_set_unicode'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:222: error: undefined reference to 'yaml_emitter_set_break'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:223: error: undefined reference to 'yaml_emitter_set_break'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:224: error: undefined reference to 'yaml_emitter_set_break'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:230: error: undefined reference to 'yaml_emitter_set_encoding'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:235: error: undefined reference to 'yaml_emitter_delete'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:305: error: undefined reference to 'yaml_emitter_emit'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:356: error: undefined reference to 'yaml_sequence_end_event_initialize'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:380: error: undefined reference to 'yaml_mapping_end_event_initialize'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:334: error: undefined reference to 'yaml_scalar_event_initialize'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:352: error: undefined reference to 'yaml_sequence_start_event_initialize'
/Users/norio/github/Yams/Sources/Yams/Emitter.swift:373: error: undefined reference to 'yaml_mapping_start_event_initialize'
/Users/norio/github/Yams/Sources/Yams/Parser.swift:120: error: undefined reference to 'yaml_parser_initialize'
/Users/norio/github/Yams/Sources/Yams/Parser.swift:128: error: undefined reference to 'yaml_parser_set_encoding'
/Users/norio/github/Yams/Sources/Yams/Parser.swift:132: error: undefined reference to 'yaml_parser_set_input_string'
/Users/norio/github/Yams/Sources/Yams/Parser.swift:139: error: undefined reference to 'yaml_parser_delete'
/Users/norio/github/Yams/Sources/Yams/Parser.swift:209: error: undefined reference to 'yaml_parser_parse'
/Users/norio/github/Yams/Sources/Yams/Parser.swift:273: error: undefined reference to 'yaml_event_delete'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
error: exit(1): /usr/bin/swift-build-tool -f /Users/norio/github/Yams/.build/debug.yaml test21:31:40 git:(nn-swift3.1-on-linux) cat .build/debug/CYaml.build/module.modulemap
module CYaml {
    umbrella header "/Users/norio/github/Yams/Sources/CYaml/include/CYaml.h"
    export *
}

modulemap generated on Swift 3.0.2 contains link declaration:

21:32:01 git:(nn-swift3.1-on-linux) docker run --privileged -it -v `pwd`:`pwd` -w `pwd` --rm norionomura/sourcekit:302 swift test
Compile CYaml src/writer.c
Compile CYaml src/scanner.c
Compile CYaml src/reader.c
Compile CYaml src/parser.c
Compile CYaml src/loader.c
Compile CYaml src/emitter.c
Compile CYaml src/dumper.c
Compile CYaml src/api.c
Linking CYaml
Compile Swift Module 'Yams' (9 sources)
Compile Swift Module 'YamsTests' (10 sources)
Linking ./.build/debug/YamsPackageTests.xctest
Test Suite 'All tests' started at 12:35:21.035Test Suite 'All tests' passed at 12:35:21.751
     Executed 64 tests, with 0 failures (0 unexpected) in 0.692 (0.692) seconds21:35:21 git:(nn-swift3.1-on-linux) cat .build/debug/CYaml.build/module.modulemap
module CYaml {
    umbrella header "/Users/norio/github/Yams/Sources/CYaml/include/CYaml.h"
    link "CYaml"
    export *
}
@norio-nomura
Copy link
Contributor Author

same on macOS

@ankitspd
Copy link
Member

ankitspd commented Feb 1, 2017

This was an intentional change because we wanted to control how to link, the actual bug here is that test product is not linking with C libraries.
Thank you so much for reporting! Fix here: #927

@norio-nomura
Copy link
Contributor Author

I see. 👍
I will confirm it when the next snapshot comes out.

@ankitspd
Copy link
Member

ankitspd commented Feb 1, 2017

Thanks

@norio-nomura
Copy link
Contributor Author

I confirmed on `swift-3.1-DEVELOPMENT-SNAPSHOT-2017-02-05-a`. Thanks! 😃

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants