Skip to content
This repository has been archived by the owner on Mar 29, 2018. It is now read-only.

Impossible to use ExSwift.framework: architecture x86_64 error #23

Open
rizal72 opened this issue Jul 28, 2014 · 8 comments
Open

Impossible to use ExSwift.framework: architecture x86_64 error #23

rizal72 opened this issue Jul 28, 2014 · 8 comments

Comments

@rizal72
Copy link

rizal72 commented Jul 28, 2014

I've tried everything and more to include your wonderful library, as a single .framework file, in a project of mine, but all I get is a Mach-O Linjer Error: symbol(s) not found for architecture x86_64.
All my other custom libraries included in my project compile correctly...

If I import the sources into my project everything compiles correctly. But i'd like to use the library feature instead...

Really I don't know if it's my issue or an XCode bug.

Thanks for any advice!

@pNre
Copy link
Owner

pNre commented Jul 28, 2014

Yes, it's Xcode:
Xcode does not support building static libraries that include Swift code. (17181019)

@rizal72
Copy link
Author

rizal72 commented Jul 28, 2014

But I've succeded in building a custom library and then exported it as a .framework bundle.
Than I've included it in my project and it compiles correctly... using XCode_6 beta 4.
The issue happens only with your sources: if I include them in my custom library it stops compiling. If I delete them it starts compiling again. (?!)

@pNre
Copy link
Owner

pNre commented Jul 28, 2014

A Swift library?

@rizal72
Copy link
Author

rizal72 commented Jul 28, 2014

Yes. It's a kind of test library containing only a few classes, with some public class methods. And It works...
Create a new project then, under "iOS/Frameworks & Library", chose "Cocoa Touch Framework" as a template. Then add a Swift Class with a public class method and compile the library.
Import this library in another project, under "Embedded Binaries", and it works as charme. Just be careful to copy the correct version of the library (Simulator, iOS, etc..) according to the kind of compilation you need.

@pNre
Copy link
Owner

pNre commented Jul 29, 2014

I followed your instructions and created a test framework, with a simple extension, just like this:

public extension Array {
    public func test () -> Element? {
        return nil
    }
}

this way the linker outputs symbol(s) not found.

Changing the function's return type:

public extension Array {
    public func test () -> Int? {
        return nil
    }
}

compiles fine.

Looks like a bug in the compiler when using the generic type Element or T defined in Array.

I know it's ugly but if you need to use ExSwift in your project compile the sources with the rest of the project.

@rizal72
Copy link
Author

rizal72 commented Jul 29, 2014

Yes! You found it! Probably the compiler does not include all the Types still.
Thanks

@kostiakoval
Copy link

This is Xcode bug. It's not possible to make Frameworks with extension to generic classes
https://devforums.apple.com/message/983747#983747

And it doesn't work to install this project with cocoa pods as well (because of linking error).
Probably the best solution would be use submodules and copy all source files to your target

@kostiakoval
Copy link

1.Add ExSwift as a submodule
2.Open the ExSwift project folder, and drag ExSwift sub folder with source code into the file navigator of your Xcode project. Make sure you select add to target
3.Use it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants