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

[iOS] Undefined symbols for architecture arm64: "_RCTSetLogFunction" #2685

Closed
Javanaise opened this issue Sep 14, 2015 · 73 comments
Closed

[iOS] Undefined symbols for architecture arm64: "_RCTSetLogFunction" #2685

Javanaise opened this issue Sep 14, 2015 · 73 comments
Assignees
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@Javanaise
Copy link

Hello,
I have this linking error:
Undefined symbols for architecture arm64:
"_RCTSetLogFunction", referenced from:
-[PropertyFinderTests testRendersWelcomeScreen] in PropertyFinderTests.o

When i try to compile the default project on iOS. (using react-native init)

@mkonicek
Copy link
Contributor

If anything broke this it might have been my commit: 19f922a

@kmagiera @brentvatne @ide Are you hitting this as well? My Xcode is unfortunately busted, reinstalling now.

@mkonicek
Copy link
Contributor

@javache is in London and it's quite late here. Can you unblock yourself by commenting out the test code until we can repro?

@kmagiera
Copy link
Contributor

@javache is with me at at-scale conf in SJ, he promised to take a look

@mkonicek
Copy link
Contributor

Awesome, thank you @kmagiera and @javache!

@mkonicek
Copy link
Contributor

Just did react-native init MyAwesomeApp and the app builds from Xcode and runs on an iPhone 6 simulator. What device are you using?

@mkonicek mkonicek added the Platform: iOS iOS applications. label Sep 14, 2015
@brentvatne
Copy link
Collaborator

@Javanaise - which version of Xcode? Only 6.3+ are supported

@Javanaise
Copy link
Author

@mkonicek A real iphone 6
@brentvatne 6.4

@brentvatne
Copy link
Collaborator

@Javanaise - try pressing ⌘+k to clean the build and run it again

@Javanaise
Copy link
Author

@brentvatne did a Clean and a Clean build folder, still fails

@brentvatne
Copy link
Collaborator

@Javanaise - have you tried in the simulator?

@Javanaise
Copy link
Author

@brentvatne it's working in the simulator

@brentvatne
Copy link
Collaborator

@Javanaise - what OS version?

@hernanmateo
Copy link

Same problem on iphone 6 ios 8.3. It is working on the simulator.

@ide
Copy link
Contributor

ide commented Sep 14, 2015

Also what simulator? Make sure it's 5s or newer which runs the x86_64 libs.

@Javanaise
Copy link
Author

@brentvatne os x ? 10.10.5
@ide I used iphone 6 for the simulator, and it built.
I only have a problem with both my iphone 6 and 5 real phones.

@fukai7722
Copy link

The same problem
iPhone 6
iOS 8.4
OS X El Capitan 15A282b

@ide
Copy link
Contributor

ide commented Sep 15, 2015

Compiling fine for me (even after cleaning) w/actual iPhone 6, Xcode 7 GM, El Cap beta 8. Wonder if Xcode is the issue here...

@mingzgc
Copy link

mingzgc commented Sep 15, 2015

Also same problem
Xcode Version 6.4 (6E35b)
iphone6 plus
ios 8.4.1
OSX 10.10.5

@jondot
Copy link
Contributor

jondot commented Sep 15, 2015

Same here,

Xcode 7 GM
iphone6
ios 8.4.1
OSX 10.10.5

fails only on real device.

as a quick workaround, removing tests makes this go away

@javache
Copy link
Member

javache commented Sep 15, 2015

I can repro this when building the SampleApp for testing for iPhone 6 using Xcode 7 GM. Investigating.

@javache
Copy link
Member

javache commented Sep 15, 2015

The problem seems that Xcode's dead code stripping removes the RCTSetLogFunction, since it's not being called anywhere. Disabling "Dead Code Stripping" from your main target's build settings for Debug builds will disable the build error.

This method was changed in b998e5a

@xuwenmin
Copy link

i have some error,but only remove test target,it's ok!

@ghost
Copy link

ghost commented Sep 18, 2015

The solution @javache provided worked for me after encountering this error running on a physical device from Xcode 7 after upgrading my existing app to React Native v0.11.0. Thanks for opening this issue @Javanaise!!

@tealtail
Copy link

Disabling "Dead Code Stripping" let me run on my physical device.
Thanks @javache!

@javache
Copy link
Member

javache commented May 8, 2016

Could you submit a pull request that changes the project generator to do this by default? Thanks!

ghost pushed a commit that referenced this issue Jun 4, 2016
Summary:
Fixes #2685
Closes #7918

Differential Revision: D3389814

fbshipit-source-id: d5054dae386d66e8055c883581f142ec24e60e18
@herkyl
Copy link

herkyl commented Jun 10, 2016

I had the same issue. However, it was caused by renaming the app. I fixed it by doing a project wide search and replacing all occurrences of the name. I also had to change a few directory and file names.

@jonigl
Copy link

jonigl commented Jun 13, 2016

Same Issue here but adding libReact.a to my test target do the trick! :)

@KGALLET
Copy link

KGALLET commented Jun 17, 2016

Same issue and disabling Dead Code Stripping didn't solve the problem whereas @bidatacoder solution worked fine for me 👍

@longsangstan
Copy link

longsangstan commented Jul 18, 2016

HI,
I have the same problem but
-it says architecture i386 instead of arm64
-it only happens when i choose iphone 5/4s simulators; other version such as 5s/6/6s don't have the problem

I tried the dead code stripping and add libReact.a to TESTS, both of them are not working for me.

Have anyone had the same problem?

update:
After many hours of googling and trying, I finally fixed it.
After disabling dead code stripping and adding libReact.a to Tests, I have to add -lc++ in other linker flags.

Here are some of the things that DIDN'T work for me:
-changing Architectures/Valid Architectures
-set No to build active architectures only
-remove test host

Hope it helps.

samerce pushed a commit to iodine/react-native that referenced this issue Aug 23, 2016
Summary:
Fixes facebook#2685
Closes facebook#7918

Differential Revision: D3389814

fbshipit-source-id: d5054dae386d66e8055c883581f142ec24e60e18
mpretty-cyro pushed a commit to HomePass/react-native that referenced this issue Aug 25, 2016
Summary:
Fixes facebook#2685
Closes facebook#7918

Differential Revision: D3389814

fbshipit-source-id: d5054dae386d66e8055c883581f142ec24e60e18
@zdol
Copy link

zdol commented Dec 12, 2016

For anyone having this problem, make sure you add the -lc++ flag to your <AppName>Tests target and not your normal target (where it probably already exists.)

@czl1378
Copy link

czl1378 commented Dec 16, 2016

@zdol Tests has no 'Other Linker Flags' option

@czl1378
Copy link

czl1378 commented Dec 16, 2016

In Build Settings All, I found that option, and after add -lc++ flag, it works! Thank you @zdol !

@testxin
Copy link

testxin commented Dec 17, 2016

@czl1378 it's work for me thanks

@benjaminb10
Copy link

benjaminb10 commented Dec 20, 2016

Here is a screenshot, thanks @czl1378

screenshot_2016-12-20 19 08 31_7naokg

@tianxind
Copy link

I have been struggling with this for a while after upgrading to rn0.39, and the answer @czl1378 and @benjaminb10 is correct. you need to add other linker flags.

@felipecocco
Copy link

+1 -- Adding the flags fixed the build errors for me on 0.40.0

@xzilja
Copy link
Contributor

xzilja commented Jan 18, 2017

@benjaminb10 +1 adding that flag fixes the issue

@sashakid
Copy link

sashakid commented Feb 1, 2017

Under Link Binary with Libraries, click the + icon and then add libReact.a. Then build again.

For me, vice versa, removing libReact.a helped me and my tests and my app runs both on simulator and device.

@yimingtang
Copy link

I'm using CocoaPods 1.2.0 and React Native 0.42.0. When I try to archive a release build, the error occurs.

It seems that your solutions won't work in my situation. Any ideas?

@smccamley
Copy link

@bidatacoder 's solution didnt work for me :-( I don't have 'Workspace'->libReact.a ... the closest I have is libcxxreact.a

Any ideas?

@facebook facebook locked as resolved and limited conversation to collaborators Jul 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 21, 2018
grabbou pushed a commit to react-native-community/cli that referenced this issue Sep 26, 2018
Summary:
Fixes facebook/react-native#2685
Closes facebook/react-native#7918

Differential Revision: D3389814

fbshipit-source-id: d5054dae386d66e8055c883581f142ec24e60e18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests