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-5986] swift test induces an error "undefined reference to 'objc_retainAutoreleasedReturnValue'" when calls CFStringConvertEncodingToIANACharSetName(_: ) on Linux #367

YOCKOW opened this issue Sep 26, 2017 · 0 comments


Copy link

@YOCKOW YOCKOW commented Sep 26, 2017

Previous ID SR-5986
Radar None
Original Reporter @YOCKOW
Type Bug
Status Resolved
Resolution Done
  • OS: Ubuntu 16.04

  • Swift 4.0

Additional Detail from JIRA
Votes 1
Component/s Compiler, XCTest
Labels Bug, CoreFoundation
Assignee None
Priority Medium

md5: 60bfed75965db16b3167706f3c79fc42

relates to:

  • SR-5271 Don't emit objc_retainAutoreleasedReturnValue() on non-ObjC targets

Issue Description:

[How to reproduce the error] (shell on Linux)

$ mkdir cf-swift
$ cd cf-swift
$ swift package init --type library
$ cat <<EOF >> Sources/cf-swift/cf_swift.swift
> import CoreFoundation
> import Foundation
> struct Dummy {
>   static let string: String? = {
>     let cfEncoding : CFStringEncoding = CFStringConvertNSStringEncodingToEncoding(String.Encoding.utf8.rawValue)
>     guard let _ = CFStringConvertEncodingToIANACharSetName(cfEncoding) else { return nil }
>     return nil
>   }()
> }
$ swift build
$ swift test

`swift build` ends without any trouble.
`swift test` views error messages below:

Compile Swift Module 'cf_swiftTests' (1 sources)
Compile Swift Module 'cf_swiftPackageTests' (1 sources)
Linking ./.build/x86_64-unknown-linux/debug/cf-swiftPackageTests.xctest
/*/*/cf-swift/Sources/cf-swift/cf_swift.swift:9: error: undefined reference to 'objc_retainAutoreleasedReturnValue'
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)
error: terminated(1): /opt/Swift-4.0/bin/swift-build-tool -f /*/*/cf-swift/.build/debug.yaml test
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

1 participant