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

How can solved the warning "direct access in function 'auto realm::sync" #6688

Closed
outsbook opened this issue Aug 4, 2020 · 34 comments
Closed

Comments

@outsbook
Copy link

outsbook commented Aug 4, 2020

Xcode Version: 11.5
Project Target: iOS 13.5
Language: Swift 5

Installed via Pod
Realm Version: 5.3.3

The warning is
warning: direct access in function 'auto realm::sync::Instruction::visit<(anonymous namespace)::RecoverLocalChangesetsHandler&>((anonymous namespace)::RecoverLocalChangesetsHandler&)' from file '/Users/shams/Work/iOS/innogyHealthGuard/Pods/Realm/core/librealmcore-ios.a(client_reset.o)' to global weak symbol 'typeinfo for realm::Lstrealm::Timestamp' from file '/Users/shams/Work/iOS/innogyHealthGuard/Pods/Realm/core/librealmcore-ios.a(list.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

@ejm01
Copy link
Contributor

ejm01 commented Aug 4, 2020

I don't know for certain. But looked at some other cases where this warning appears with other libraries.
Do the project, Pods, and Realm library settings for Symbols Hidden by Default and Inline Methods Hidden match?

@phoney
Copy link
Contributor

phoney commented Aug 5, 2020

I'm also seeing this. I'm using RealmSwift. I believe it appeared in 5.3.3 and wasn't present in 5.3.2. It's not just one warning; there are 32 of them.

Inline Methods Hidden: YES
Symbols Hidden by Default: NO

I have about 20 pods and they all have those same values for those two build settings.

The values for these build settings in the Pods project itself are different. Both values are NO.

If I go back to 5.3.2 the build settings mentioned above are the same as in 5.3.3 but the warnings don't appear. I believe that librealmcore-ios.a is distributed as a binary so it isn't being built on my Mac. So the problem is how that library was built.

I don't know how to determine the build settings for librealmcore-ios.a but I think that's what changed.

There are a series of recent commits that update the core library by @tgoyne that are probably the culprit.

@szubiszon
Copy link

I have the same problem, and I'm using RealmSwift too. Problem exist in 5.3.3 version only, 5.3.2 don't have those warnings.
direct access in function 'auto realm::sync::Instruction::visit<(anonymous namespace)::RecoverLocalChangesetsHandler&>((anonymous namespace)::RecoverLocalChangesetsHandler&)' from file '/Users/kamil/Projects/XXX/Pods/Realm/core/librealmcore-ios.a(client_reset.o)' to global weak symbol 'typeinfo for realm::Lst<realm::Timestamp>' from file '/Users/kamil/Projects/XXX/Pods/Realm/core/librealmcore-ios.a(list.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

@adrianod1as
Copy link

+1

@szubiszon
Copy link

szubiszon commented Aug 24, 2020

Xcode Version: 11.6
Project Target: iOS 12.4.1 & 13.6
Language: Swift 5

Installed via Pod
Realm Version: 5.3.5

I have exported all generated errors:
Build App_2020-08-24T10-14-50.txt

@MischkaTheBear
Copy link

MischkaTheBear commented Aug 26, 2020

+1 as well. Updated from Realm 5.3.3 to 5.3.5 today and still get 32 warnings of variations on the following:

"Direct access in function 'realm::sync::InstructionApplier::operator()(realm::sync::Instruction::ArrayInsert const&)' from file '../Realm/core/librealmcore-ios.a(instruction_applier.o)' to global weak symbol 'typeinfo for realm::Lst<realm::util::Optional >' from file './Realm/core/librealmcore-ios.a(list.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings."

@csharpseattle
Copy link

+1

@leemaguire
Copy link
Contributor

Screenshot 2020-09-01 at 11 22 18

In the Realm target under your pods project do you see the highlighted flags?

@phoney
Copy link
Contributor

phoney commented Sep 1, 2020

I've updated to 5.3.5. I see those custom build flags in the project (and also in the two .xcconfig files). I don't see the warnings.

Looking at the history for Realm.podspec those flags for armv7 were added on Feb 11, 2020, which was a version older than 5.0.0.

FWIW, these warnings seemed to come and go but I couldn't figure out what the correlation was. Maybe this is a Cocoapod or Xcode bug. Xcode doesn't like Cocoapods.

@marck-gorgon
Copy link

It seems Realm & RealmSwift 5.3.6 has fixed it, at least for me.

@outsbook
Copy link
Author

outsbook commented Sep 8, 2020

Yes, it's fixed in v5.3.6

@outsbook outsbook closed this as completed Sep 8, 2020
@88HOMIN
Copy link

88HOMIN commented Sep 8, 2020

v5.3.6 same issue....

@bhbfhfb
Copy link

bhbfhfb commented Sep 9, 2020

Yes, it's fixed in v5.3.6

I changed from v5.3.5 to v5.3.6.
This issue still appears.

@MischkaTheBear
Copy link

Updated to 5.3.6 -- Problem persists...

@uglyelf
Copy link

uglyelf commented Sep 10, 2020

Updated to 5.4.0 Still have the problem.

@phoney
Copy link
Contributor

phoney commented Sep 10, 2020

@uglyelf Can you check the flags mentioned by leemaguire upthread? If they are missing this may be a syncing issue and you may want to try these various things to clear your cache. Option-Clean in Xcode. delete your Pods folder. pod deintegrate. Run pod install or pod update after and rebuild. I found the errors disappeared and reappeared a few times but eventually went away and stayed away. Not certain what really fixed it though.

@uglyelf
Copy link

uglyelf commented Sep 10, 2020

K. I've now done all that and cleared the derived data and restarted x-code. Still has the error. @phoney I'm grateful for your suggestions. Do you have any more?

@phoney
Copy link
Contributor

phoney commented Sep 10, 2020

Sorry about that. Do you see those flags in the Pods project?

pod cache clean should delete all the pods and local pod specs. I think if you do pod cache list you can see the paths to the cached files and then manually delete them. Also, quit and restart Xcode.

@uglyelf
Copy link

uglyelf commented Sep 10, 2020

Sorry. Should have said, yes, the flags are there.
I just ran pod cache clean --all
No change.

@phoney
Copy link
Contributor

phoney commented Sep 11, 2020

Hmmm. My Podfile line is pod 'RealmSwift', '~> 5.0' Is yours the same? I'm currently on Realm 5.4.0 but this seemed to go away with 5.3.5.

One other cleaning suggestion: close Xcode, delete the folder in Library/Developer/Xcode/DerivedData/ for your project. This does slightly more than opt-clean.

@uglyelf
Copy link

uglyelf commented Sep 11, 2020

Right right. I cleared the derived data as stated a couple responses ago. Always clear the derived data. :)
I don't have limitations on my pod file for realm. Here are my versions in the Podfile.lock regarding realm:

  • Realm (5.4.0):
    • Realm/Headers (= 5.4.0)
  • Realm/Headers (5.4.0)
  • RealmSwift (5.4.0):
    • Realm (= 5.4.0)

@sedwo
Copy link

sedwo commented Sep 18, 2020

Realm (5.4.1), Xcode 12.

ld: warning: direct access in function 'realm::sync::InstructionApplier::operator()....

image

@phoney
Copy link
Contributor

phoney commented Sep 18, 2020

This bug came back in 5.4.1. I updated to 5.4.2 today and it still persists. I do see the flags in the Pods project for RealmSwift.

I think we need to open another issue for it since this one is closed.

@tgoyne Do you understand the cause of this issue?

@akhilvarmaeternal
Copy link

This is still happening in 5.4.2, 32 issues and tried everything explained above. Nothing seems to work

@leemaguire
Copy link
Contributor

Can you add -fvisibility=hidden to 'Other C++ Flags' in your Target/Project (and Pods) and see if that helps.

@reggian
Copy link

reggian commented Sep 29, 2020

@leemaguire
Adding the -fvisibility=hidden to 'Other C++ Flags' in the Target/Project did not yield any change.
Adding the -fvisibility=hidden to 'Other C++ Flags' in the Pods project did not yield any change.
Adding the -fvisibility=hidden to 'Other C++ Flags' in the Realm target in the Pods project on the other hand increased the warning count to 43 and added 5 errors:

Undefined symbol: _OBJC_CLASS_$_RLMResults
Undefined symbol: _OBJC_CLASS_$_RLMRealmConfiguration
Undefined symbol: _OBJC_CLASS_$_RLMObject
Undefined symbol: _OBJC_METACLASS_$_RLMObject
Undefined symbol: _OBJC_CLASS_$_RLMRealm

--
Mac OS X 10.15.7 (19H2)
Xcode 12.0 (12A7209)
CocoaPods 1.9.3
Realm 5.4.4

@akhilvarmaeternal
Copy link

akhilvarmaeternal commented Sep 29, 2020

Below is my current setting, it seems to have solved it for me at least in Run, The errors appear sometimes on Build but never on Run. I also did not add them manually, I deleted the Pods folder and did pod install. The flags were absent when I updated the pod from pre 5.0 release.

Inline Methods Hidden - Yes and Symbols Hidden by Default - No for Pods Project and Target.
Inline Methods Hidden - Yes and Symbols Hidden by Default - Yes for main target

I've stumbled onto this setting and there's not rationale behind it so, any enlightenment would be useful.

Screenshot 2020-09-29 at 3 38 47 PM

(Other C++ Flags in Realm Target)

@iwan-ua
Copy link

iwan-ua commented Sep 30, 2020

5.4.6 same
Xcode 12
cleared pods and derived data

@iDevid
Copy link

iDevid commented Oct 5, 2020

Same here

@phoney
Copy link
Contributor

phoney commented Oct 7, 2020

Warnings are back for me in 5.4.7 and 5.4.8. The flags are all present in the Realm project. The warnings refer to librealmcore-ios.a, which I believe isn't compiled on my computer. It's downloaded as part of the library. Commit messages seem to say that realm core has been updated a lot lately. I believe the problem is how that file is built.

@leemaguire
Copy link
Contributor

Please update to the latest version of Realm v10.1.1 this should resolve these warnings.

@leemaguire
Copy link
Contributor

Closing this issue due to inactivity. If this issue still persists with the latest version v10.1.4 please open a new issue. Thanks.

@sync-by-unito sync-by-unito bot closed this as completed Nov 23, 2020
@alexkendall
Copy link

Im experiencing this in v10.1.4

@joaopdcgarcia
Copy link

same in v 10.41.0

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

No branches or pull requests