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

'__rip' in '__darwin_arm_thread_state64 in ThirdParty glog dependency only on attached device #16106

Closed
mbalex99 opened this issue Sep 26, 2017 · 46 comments
Labels
Bug Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@mbalex99
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 8.4.0
Yarn: 1.0.0
npm: 5.3.0
Watchman: 4.7.0
Xcode: Xcode 9.0 Build version 9A235
Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
react-native: ^0.48.4 => 0.48.4

Steps to Reproduce

  1. react-native init Mira
  2. open Mira/ios/Mira.xcproj
  3. Select a connect iPhone 6s on iOS 11 and try to build and run

Expected Behavior

The iOS app builds on the connected iPhone 6s with iOS 11 and runs correctly

Actual Behavior

A build error in signalhandler.cc With

No member named '__rip' in '__darwin_arm_thread_state64' on the line

return (void*)context->PC_FROM_UCONTEXT;

// Returns the program counter from signal context, NULL if unknown.
void* GetPC(void* ucontext_in_void) {
#if (defined(HAVE_UCONTEXT_H) || defined(HAVE_SYS_UCONTEXT_H)) && defined(PC_FROM_UCONTEXT)
  if (ucontext_in_void != NULL) {
    ucontext_t *context = reinterpret_cast<ucontext_t *>(ucontext_in_void);
    return (void*)context->PC_FROM_UCONTEXT; // <---- build error here
  }
#endif
  return NULL;
}

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

  1. https://s3-us-west-1.amazonaws.com/maxofedenpublic/Mira.tar.gz
  2. Please attach a connected iPhone 6s with iOS 11
@donnes
Copy link

donnes commented Oct 2, 2017

Having the same issue when try build project from Xcode

@grahamtallen
Copy link

Same issue when building project from xcode

@colinramsay
Copy link
Contributor

Same, and I think it started when I upgraded to Xcode 9.

@vvkaghera
Copy link

@colinramsay @mbalex99 Got any solution?

@al-esok
Copy link

al-esok commented Nov 16, 2017

have same issue, after installing xcode 9 on my mac

@mbalex99
Copy link
Author

mbalex99 commented Nov 16, 2017 via email

@al-esok
Copy link

al-esok commented Nov 17, 2017

It is working for you with Xcode v9 ?

I was using it then downgraded to xcode v8.3.2.

With v8 also it is not working.

@mbalex99
Copy link
Author

mbalex99 commented Nov 17, 2017 via email

@al-esok
Copy link

al-esok commented Nov 17, 2017

Ooh.

I will try this.

Thanks :)

@chrisportela
Copy link

@mbalex99 Are you on High Sierra as well?

@mbalex99
Copy link
Author

mbalex99 commented Nov 26, 2017 via email

@fmoessle
Copy link

OS: Sierra 10.12.6
RN: 0.48.3
Xcode: Version 9.1 (9B55)

Same error:

No member named '__rip' in '__darwin_arm_thread_state'

and

No member named '__rip' in '__darwin_arm_thread_state64'

in signalhandler.cc

@chrisportela
Copy link

So I did a lot to fix things, but the main thing I did was rm -rf node_modules and yarn install again.

I also completely removed XCode 8 and 9 from my system and then reinstalled XCode 9 using the App Store.

After reinstalling it still didn't work until I nuked the node_modules folder. It's not clear to me why this fixed it.

@fmoessle
Copy link

I also removed and reinstalled Xcode, I will try your solution

@al-esok
Copy link

al-esok commented Dec 1, 2017

Steps:

  1. Remove every versions of xcode you have on your MAC.
  2. Download the latest xcode and place it in the Applications folder. This xcode filename should be 'Xcode'. Very important.
  3. Delete the build folder in your IOS folder in the React Native project.
  4. Optional: Delete node modules folder.
  5. You are now ready to run for IOS.

Those steps worked for me.

@grundmanise
Copy link

Fixed it by deleting node_modules & yarn install.

@vshalvaghasiya
Copy link

same issue in my Xcode 9
any person solving this error . ?

@jankarres
Copy link

Deleting node_modules and reinstall fixed it for me, too. Thanks @grundmanise.

@stale
Copy link

stale bot commented Jun 10, 2018

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jun 10, 2018
@zedtux
Copy link
Contributor

zedtux commented Jun 25, 2018

I have this issue too with Xcode 10 😞 .

I tried to remove the node_modules folder and running yarn after but didn't work.
I guess my issue is because I have Xcode 9 and 10. I just removed both of them and I'll follow the @al-esok's instructions.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jun 25, 2018
@zedtux
Copy link
Contributor

zedtux commented Jun 25, 2018

I have re-install completely Xcode, removed the node_modules folder and ran yarn.

To compile my project (I'm using Fastlane) I'm using the following :

$ set -o pipefail && xcodebuild clean -scheme "Companion-cal" -project "./ios/Companion.xcodeproj"  build-for-testing | tee '/Users/guillaumehain/Library/Logs/fastlane/xcbuild/2018-06-25/64805/xcodebuild.log' | xcpretty --color --simple

First time I ran it, I got the error:

▸ Compiling symbolize.cc
▸ Compiling signalhandler.cc

❌  /Users/guillaumehain/Developments/companion/node_modules/react-native/third-party/glog-0.3.4/src/signalhandler.cc:78:28: no member named '__rip' in '__darwin_arm_thread_state'

    return (void*)context->PC_FROM_UCONTEXT;
     ^

I ran it again and got the following:

▸ Compiling vlog_is_on.cc

❌  /Users/guillaumehain/Developments/companion/node_modules/react-native/third-party/glog-0.3.4/src/base/mutex.h:105:10: 'config.h' file not found

#include "config.h"           // to figure out pthreads support
       ^

To solve this one, I have to run the following command :

$ cd node_modules/react-native/third-party/glog-0.3.4/ && ./configure && ../../../..

Then I run again the build commande and got the following:

[10:41:27]: ▸ Compiling signalhandler.cc
[10:41:27]: ▸ ❌  /Users/guillaumehain/Developments/companion/node_modules/react-native/third-party/glog-0.3.4/src/signalhandler.cc:78:28: no member named '__rip' in '__darwin_arm_thread_state'
[10:41:27]: ▸ return (void*)context->PC_FROM_UCONTEXT;
[10:41:27]: ▸      ^

@gastonmorixe
Copy link

I have no idea what this is about but retuning NULL works for now.

@tanabs18
Copy link

@gastonmorixe Can you be more specific?

@kelset kelset added the Platform: iOS iOS applications. label Jun 29, 2018
@thesubway
Copy link

Thanks, works for me too.
Changing
return (void*)context->PC_FROM_UCONTEXT;
to
return NULL;

@GreenRidingHood
Copy link

@tanabs18, for me @thesubway suggestion worked, i guess this is what @gastonmorixe means.

you will go node-module/react-native/third-party/glog-0.3.4/src/signalhandler.cc and at line 78, you need to replace
return (void*)context->PC_FROM_UCONTEXT;
to
return NULL;
like @thesubway

that worked for me too

but I have no idea what is that line either :)

@thiZguy
Copy link

thiZguy commented Oct 9, 2018

thanks @thesubway, it works for me too, does somebody know what are the side effects of going with this approach?

@topwebtek7
Copy link

Any workaround for this issue beside editing dependency code?

@zedtux
Copy link
Contributor

zedtux commented Oct 10, 2018

The only way I could see is to un-define one of the 3 variables :

  • HAVE_UCONTEXT_H
  • HAVE_SYS_UCONTEXT_H
  • PC_FROM_UCONTEXT

But I'm not sure what would be the impact nor how to do this.

@alqamabinsadiq
Copy link

This worked for me too 👍
Changing:

ucontext_t *context = reinterpret_cast<ucontext_t *>(ucontext_in_void);
return (void*)context->PC_FROM_UCONTEXT;

To

return NULL;

@brickpop
Copy link

Hit a similar problem on iOS 12 with 0.56 and this response helped:
#19839 (comment)

@icaromag
Copy link

Same issue on 0.57.3, fixed by returning NULL instead of (void*)context->PC_FROM_UCONTEXT.
Thanks @thesubway!

@brenwell
Copy link

Thanks to @ledfusion. I was not configuring glog correctly for xcode 10. This is now in my npm postinstall

cd node_modules/react-native ; ./scripts/ios-install-third-party.sh ; cd ../../
cd node_modules/react-native/third-party/glog-0.3.4/ ; sh ../../scripts/ios-configure-glog.sh ; cd ../../../../

@ivanzotov
Copy link
Contributor

ivanzotov commented Nov 27, 2018

Thanks @thesubway. Here is a solution that works for me:

# https://github.com/facebook/react-native/pull/19579/commits/293915091ca6c9de2c54681e78eecf3229bc05d5
sed -i "" "s|fileRef = 13526A511F362F7F0008EF00|fileRef = 3DBE0D001F3B181A0099AA32|g" node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj
sed -i "" "s|13526A521F362F7F0008EF00|2D3ABDC220C7206E00DF56E9|g" node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj
cd node_modules/react-native ; ./scripts/ios-install-third-party.sh ; cd ../../

# https://github.com/facebook/react-native/issues/16106#issuecomment-401662200
sed -i "" "78s|.*|    return NULL;|" node_modules/react-native/third-party/glog-0.3.4/src/signalhandler.cc
cd node_modules/react-native/third-party/glog-0.3.4/ ; ./configure ; cd ../../../../

@chriiess
Copy link

chriiess commented Dec 5, 2018

in node_modules/react-native/third-party/glog-0.3.4/src/config.h
find this line
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
replace

#if defined(__arm__) || defined(__arm64__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__pc
#else
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
#endif 

It works for me!

@Alec13355
Copy link

I opened a PR on glog to return the line to NULL. If that gets through builds should work again. I don't know if it'll get approved, but I hope it will.

@darin-sai
Copy link

Might have fixed this for me by editing the "fetch_and_unpack glog-0.3.4.tar.gz" line of "node_modules/react-native/scripts/ios-install-third-party.sh"

The fourth parameter is the script to be run, but the path given will not exist. Going up two levels will find it.

replace "\"$SCRIPTDIR/ios-configure-glog.sh\""
with "\"../../$SCRIPTDIR/ios-configure-glog.sh\""

@crack-boy
Copy link

Thanks to @ledfusion. I was not configuring glog correctly for xcode 10. This is now in my npm postinstall

cd node_modules/react-native ; ./scripts/ios-install-third-party.sh ; cd ../../
cd node_modules/react-native/third-party/glog-0.3.4/ ; sh ../../scripts/ios-configure-glog.sh ; cd ../../../../

true way

@semi-dev-13
Copy link

return NULL is working for me :)

@TRIPTI-JAIN
Copy link

Changing
return (void*)context->PC_FROM_UCONTEXT;
to
return NULL;

@illidandh
Copy link

yes edit it to "return NULL" , its build success but its safe ? and no impact ?

@EnettyTech
Copy link

Open the node_modules/react-native/third-party/glog-0.3.4/src/config.h file
or search for the location defined by PC_FROM_UCONTEXT directly in the project.

replace

/* How to access the PC from a struct ucontext */
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip

for:

/* How to access the PC from a struct ucontext */
#if defined(__arm__) || defined(__arm64__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__pc
#else
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
#endif

Then recompile.
Worked for me.

@stale
Copy link

stale bot commented Nov 13, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 13, 2019
@stale
Copy link

stale bot commented Nov 20, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Nov 20, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Nov 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests