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

Using Realm from RubyMotion throws "framework not found for architecture i386" error #981

Closed
jpsim opened this issue Oct 6, 2014 · 10 comments · Fixed by #1041
Closed

Using Realm from RubyMotion throws "framework not found for architecture i386" error #981

jpsim opened this issue Oct 6, 2014 · 10 comments · Fixed by #1041
Labels

Comments

@jpsim
Copy link
Contributor

jpsim commented Oct 6, 2014

More details in #964 /cc @alloy

@nickdaniels
Copy link

Hi guys, sorry to bump but has there been any progress on this? We'd really love to get started with Realm+RubyMotion :)

Happy to help out and have a dig so let me know if I can be of any help.

@JasonFelix
Copy link

I've also encountered this bug while trying to use Realm with RubyMotion. Any help would be appreciated, thanks.

@alloy
Copy link

alloy commented Oct 16, 2014

I am personally swamped at the moment. I have asked a co-worker to look into it if he has time today, but I can’t make any promises.

@nickdaniels
Copy link

Thanks @alloy, really appreciate it, and again let me know if I can do some digging for you.
Nick

@jpsim
Copy link
Contributor Author

jpsim commented Oct 16, 2014

Thanks @alloy.

@nickdaniels if you're willing to help, you'll find more details about this issue in #964. The crux of the issue is that the RubyMotion linker can't find the i386 architecture in the Realm binary, even though lipo confirms it's there.

alloy added a commit to alloy/realm-cocoa that referenced this issue Oct 17, 2014
Fixes realm#981.

This will still link the objects in the static archive (the fake
framework) into the application binary, but it will also setup the
frameworks search path during the application linking phase so that
`Realm.framework` can be found.

This last part is important, because the `models` static library, which
is built with clang modules enabled (the default), will contain a linker
load flag that tells the linker to also load `Realm.framework` when
linking the `models` static library and if at that time (the application
linking phase) `Realm.framework` cannot be found in any frameworks
search paths, an unhelpful error like the following will be raised:

    ld: framework not found Realm for architecture i386

The linker load flag (`LC_LINKER_OPTION`) that gets added to the
`models` static library and that triggers the loading of
`Realm.framework` is the following:

    otool -l models/build-iPhoneSimulator/libmodels.a
    …
    Load command 10
         cmd LC_LINKER_OPTION
     cmdsize 32
       count 2
      string realm#1 -framework
      string realm#2 Realm
    …
@alloy
Copy link

alloy commented Oct 17, 2014

@jpsim Pushed a PR at #1037.

@nickdaniels
Copy link

Great stuff, thank you @alloy that works perfectly and saved me a lot of potential digging! Really appreciate your fantastic support with RubyMotion in general.

@alloy
Copy link

alloy commented Oct 17, 2014

@nickdaniels Thanks, great to hear! ❤️

@apinrdw
Copy link

apinrdw commented May 21, 2016

Hi,
I am trying using Realm+Rubymotion and test to run the example on the repo.
But i got an error ./RubyMotionRealmObject.h:1:9: fatal error: 'Realm/Realm.h' file not found.
@alloy any suggestion to this problem?

@apinrdw
Copy link

apinrdw commented May 23, 2016

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
5 participants