React-native: '__rip' in '__darwin_arm_thread_state64 in ThirdParty glog dependency only on attached device

Created on 26 Sep 2017  ·  46Comments  ·  Source: facebook/react-native

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
Bug iOS Stale

Most helpful comment

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

All 46 comments

Having the same issue when try build project from Xcode

Same issue when building project from xcode

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

@colinramsay @mbalex99 Got any solution?

have same issue, after installing xcode 9 on my mac

I uninstalled other Xcode installs except Xcode 9. I made sure the app was
called

“Xcode” not “Xcode 9”.
On Thu, Nov 16, 2017 at 4:11 AM al-esok notifications@github.com wrote:

have same issue, after installing xcode 9 on my mac


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/16106#issuecomment-344904728,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACFSMYQahVgdRLAH6Du8vn87CRCFnnXUks5s3CZ0gaJpZM4PkqBo
.

>

Maximilian Alexander
[email protected]
www.maxofeden.com

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.

Correct it’s working with me and Xcode 9
On Thu, Nov 16, 2017 at 10:38 PM al-esok notifications@github.com wrote:

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.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/16106#issuecomment-345158279,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACFSMVFGQmFEPyQygyWJwjWd5KBweW4Nks5s3SnsgaJpZM4PkqBo
.

>

Maximilian Alexander
[email protected]
www.maxofeden.com

Ooh.

I will try this.

Thanks :)

@mbalex99 Are you on High Sierra as well?

Yes I’m on High Sierra
On Sat, Nov 25, 2017 at 5:11 PM cmp notifications@github.com wrote:

@mbalex99 https://github.com/mbalex99 Are you on High Sierra as well?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/react-native/issues/16106#issuecomment-346980923,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACFSMXharXL2IvwoeFSiXoEyvWjH5csFks5s6NbsgaJpZM4PkqBo
.

>

Maximilian Alexander
[email protected]
www.maxofeden.com

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

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.

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

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.

Fixed it by deleting node_modules & yarn install.

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

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

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.

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.

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]: ▸      ^

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

@gastonmorixe Can you be more specific?

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

@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 :)

seriously? we have to edit the dependency code to make it work? same result here, glog 0.3.5

Same with 0.3.4

thanks @thesubway, it works

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

Any workaround for this issue beside editing dependency code?

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.

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;

Hit a similar problem on iOS 12 with 0.56 and this response helped:
https://github.com/facebook/react-native/issues/19839#issuecomment-422519819

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

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 ../../../../

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 ../../../../

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!

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.

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\""

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

return NULL is working for me :)

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

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

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.

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.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

janmonschke picture janmonschke  ·  3Comments

josev55 picture josev55  ·  3Comments

jlongster picture jlongster  ·  3Comments

oney picture oney  ·  3Comments

madwed picture madwed  ·  3Comments