Undefined symbols for architecture x86_64


(Ryan Lovelett) #1

When linking a Cocoa framework using the release configuration I am
getting the error below. Oddly compiling in the debug configuration
works fine.

The code looks like this:

let _ = URLComponents(url: track.request.url, resolvingAgainstBaseURL:
true)? .queryItems?.sorted(isOrderedBefore: { $0.name < $1.name })

Weirder still, if I make a fresh project that contains just this single
line of code then it also compiles fine (debug and release). Not sure
how to resolve the linker error. Also not sure how to get it to a small
isolated test. Xcode Version 8.0 beta 3 (8S174q)

Suggestions?

···

Ld /Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Products/Release/VHS.framework/Versions/A/VHS normal x86_64
   cd /Users/ryan/Source/VHS
   export MACOSX_DEPLOYMENT_TARGET=10.12
   /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -L/Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Products/Release -F/Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Products/Release -F/Users/ryan/Source/VHS/Carthage/Build/Mac -filelist /Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Intermediates/VHS.build/Release/VHS.build/Objects-normal/x86_64/VHS.LinkFileList -install_name @rpath/VHS.framework/Versions/A/VHS -Xlinker -rpath -Xlinker @executable_path/../Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -mmacosx-version-min=10.12 -fobjc-link-runtime -L/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -Xlinker -add_ast_path -Xlinker /Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Intermediates/VHS.build/Release/VHS.build/Objects-normal/x86_64/VHS.swiftmodule -framework Argo -framework Curry -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Intermediates/VHS.build/Release/VHS.build/Objects-normal/x86_64/VHS_dependency_info.dat -o /Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Products/Release/VHS.framework/Versions/A/VHS
Undefined symbols for architecture x86_64:
  "Swift.UnsafeMutableBufferPointer.(subscript.materializeForSet : (Swift.Int) -> A).(closure #1)", referenced from:
      function signature specialization <Arg[2] = Exploded> of generic specialization <Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> with Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.MutableCollection in Swift and Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.RandomAccessCollection in Swift> of Swift._siftDown <A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection> (inout A, index : A.Index, subRange : Swift.Range<A.Index>, isOrderedBefore : inout (A.Iterator.Element, A.Iterator.Element) -> Swift.Bool) -> () in VCR.o
      function signature specialization <Arg[1] = Exploded> of generic specialization <Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> with Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.MutableCollection in Swift and Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.RandomAccessCollection in Swift> of Swift._heapSort <A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection> (inout A, subRange : Swift.Range<A.Index>, isOrderedBefore : inout (A.Iterator.Element, A.Iterator.Element) -> Swift.Bool) -> () in VCR.o
      function signature specialization <Arg[1] = Exploded> of generic specialization <Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> with Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.MutableCollection in Swift and Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.RandomAccessCollection in Swift> of Swift._partition <A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection> (inout A, subRange : Swift.Range<A.Index>, isOrderedBefore : inout (A.Iterator.Element, A.Iterator.Element) -> Swift.Bool) -> A.Index in VCR.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


(Saagar Jha) #2

I’m guessing a framework you’ve added wasn’t built for x86. Try switching your build target to an iOS device.

Saagar Jha

···

On Jul 24, 2016, at 18:25, Ryan Lovelett via swift-users <swift-users@swift.org> wrote:

When linking a Cocoa framework using the release configuration I am
getting the error below. Oddly compiling in the debug configuration
works fine.

The code looks like this:

let _ = URLComponents(url: track.request.url, resolvingAgainstBaseURL:
true)? .queryItems?.sorted(isOrderedBefore: { $0.name < $1.name })

Weirder still, if I make a fresh project that contains just this single
line of code then it also compiles fine (debug and release). Not sure
how to resolve the linker error. Also not sure how to get it to a small
isolated test. Xcode Version 8.0 beta 3 (8S174q)

Suggestions?

Ld /Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Products/Release/VHS.framework/Versions/A/VHS normal x86_64
  cd /Users/ryan/Source/VHS
  export MACOSX_DEPLOYMENT_TARGET=10.12
  /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -L/Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Products/Release -F/Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Products/Release -F/Users/ryan/Source/VHS/Carthage/Build/Mac -filelist /Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Intermediates/VHS.build/Release/VHS.build/Objects-normal/x86_64/VHS.LinkFileList -install_name @rpath/VHS.framework/Versions/A/VHS -Xlinker -rpath -Xlinker @executable_path/../Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -mmacosx-version-min=10.12 -fobjc-link-runtime -L/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -Xlinker -add_ast_path -Xlinker /Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Intermediates/VHS.build/Release/VHS.build/Objects-normal/x86_64/VHS.swiftmodule -framework Argo -framework Curry -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Intermediates/VHS.build/Release/VHS.build/Objects-normal/x86_64/VHS_dependency_info.dat -o /Users/ryan/Library/Developer/Xcode/DerivedData/VHS-dosminuksbrtjudnsmhzbgzhsbib/Build/Products/Release/VHS.framework/Versions/A/VHS
Undefined symbols for architecture x86_64:
"Swift.UnsafeMutableBufferPointer.(subscript.materializeForSet : (Swift.Int) -> A).(closure #1)", referenced from:
     function signature specialization <Arg[2] = Exploded> of generic specialization <Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> with Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.MutableCollection in Swift and Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.RandomAccessCollection in Swift> of Swift._siftDown <A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection> (inout A, index : A.Index, subRange : Swift.Range<A.Index>, isOrderedBefore : inout (A.Iterator.Element, A.Iterator.Element) -> Swift.Bool) -> () in VCR.o
     function signature specialization <Arg[1] = Exploded> of generic specialization <Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> with Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.MutableCollection in Swift and Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.RandomAccessCollection in Swift> of Swift._heapSort <A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection> (inout A, subRange : Swift.Range<A.Index>, isOrderedBefore : inout (A.Iterator.Element, A.Iterator.Element) -> Swift.Bool) -> () in VCR.o
     function signature specialization <Arg[1] = Exploded> of generic specialization <Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> with Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.MutableCollection in Swift and Swift.UnsafeMutableBufferPointer<Foundation.URLQueryItem> : Swift.RandomAccessCollection in Swift> of Swift._partition <A where A: Swift.MutableCollection, A: Swift.RandomAccessCollection> (inout A, subRange : Swift.Range<A.Index>, isOrderedBefore : inout (A.Iterator.Element, A.Iterator.Element) -> Swift.Bool) -> A.Index in VCR.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users