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

Compiler errors when building for iOS device #14174

Closed
rigdern opened this issue May 25, 2017 · 13 comments
Closed

Compiler errors when building for iOS device #14174

rigdern opened this issue May 25, 2017 · 13 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@rigdern
Copy link
Contributor

rigdern commented May 25, 2017

@javache

After this commit (885856c), I can no longer successfully build my iOS app for use on my device (building for simulator works).

The error occurs when configuring glog (delete the directory called "third-party" before building for device to repro). The error is:

configure:3705: checking whether the C compiler works
configure:3727: gcc    conftest.c  >&5
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/usr/lib/libSystem.tbd, missing required architecture x86_64 in file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/usr/lib/libSystem.tbd (3 slices)
ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3731: $? = 1
configure:3769: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "glog"
| #define PACKAGE_TARNAME "glog"
| #define PACKAGE_VERSION "0.3.4"
| #define PACKAGE_STRING "glog 0.3.4"
| #define PACKAGE_BUGREPORT "[email protected]"
| #define PACKAGE_URL ""
| #define PACKAGE "glog"
| #define VERSION "0.3.4"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3774: error: in `/Users/adcom/Code/projects/RNPlayground/node_modules/react-native/third-party/glog-0.3.4':
configure:3776: error: C compiler cannot create executables

I'm building on a late 2014 Mac Mini for an iPhone 6s+.

@javache
Copy link
Member

javache commented May 25, 2017

When installing the third-party dependencies we run the https://github.com/facebook/react-native/blob/master/scripts/ios-configure-glog.sh script, which is generating this error.

Could you try commenting out line 5 and 7 there (the Xcode context) checks?

@rigdern
Copy link
Contributor Author

rigdern commented May 25, 2017

@javache

It seems I get a different error after doing this:

configure:12505: error: in `/Users/rigdern/code/work/projects/RNPlayground2/node_modules/react-native/third-party/glog-0.3.4':
configure:12507: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details

You can see more of the error message here.

@javache
Copy link
Member

javache commented May 25, 2017

Do you have any other compilers configured on your PATH? Somehow it seems to hit this error in the internal header

#if   !defined(__sys_cdefs_arch_unknown__) && defined(__arm__)
#elif !defined(__sys_cdefs_arch_unknown__) && defined(__arm64__)
#else
#error Unsupported architecture
#endif

One idea is to also define CXX, can you add export CXX=$CC after the export CC?

@rigdern
Copy link
Contributor Author

rigdern commented May 25, 2017

@javache

Do you have any other compilers configured on your PATH?

I don't know. I've reproed both errors I've shared in this discussion on two different machines. One of the machines is brand new and pretty much the only things I've installed on it are the tools for doing iOS and Android React Native development.

Are you able to repro this issue?

One idea is to also define CXX, can you add export CXX=$CC after the export CC?

How do I export CXX=$CC? Where do I put that? Expanding the step that is failing in Xcode, I don't even see an export CC line.

image

@javache
Copy link
Member

javache commented May 26, 2017

In the ios-configure-glog script (https://github.com/facebook/react-native/blob/master/scripts/ios-configure-glog.sh#L5-L7), replace lines 5-7 with

export CC="$(xcrun -find -sdk iphoneos cc) -arch armv7 -isysroot $(xcrun -sdk iphoneos --show-sdk-path)"
export CXX=$CC

@rigdern
Copy link
Contributor Author

rigdern commented May 26, 2017

@javache That fixes the build for me!

@javache javache closed this as completed Jun 1, 2017
@SudoPlz
Copy link
Contributor

SudoPlz commented Jun 21, 2017

@javache I'm getting that error on my CI, do we have to do anything in particular to fix this?

This is what I'm getting:

Running Phase Script 'Install Third Party'
116
    »     cd node_modules/react-native/React
117
    »     /bin/sh -c /tmp/sandbox/5857df94fd675501000961e3/bbbuild/Build/Intermediates/ArchiveIntermediates/TestApp/IntermediateBuildFilesPath/React.build/Release-iphoneos/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh
118
    »   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
119
    »                                  Dload  Upload   Total   Spent    Left  Speed
120
    ✗
121
       0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
122
    100   119    0   119    0     0    793      0 --:--:-- --:--:-- --:--:--   798
123
    ✗
124
       6  510k    6 33390    0     0   100k      0  0:00:05 --:--:--  0:00:05  100k
125
    100  510k  100  510k    0     0  1291k      0 --:--:-- --:--:-- --:--:-- 6922k
126
    » checking for gawk... no
127
    » checking for nawk... no
128
    » checking whether make sets $(MAKE)... yes
129
    » checking for arm-apple-darwin-gcc... no
130
    » checking whether the C compiler works... no
131
    ✗ configure: error: in `node_modules/react-native/third-party/glog-0.3.4':
132
    ✗ configure: error: C compiler cannot create executables
133
    » See `config.log' for more details
134
    ✗ Command /bin/sh failed with exit code 77
135
    ** ARCHIVE FAILED **
136
    The following build commands failed:
137
        PhaseScriptExecution Install\ Third\ Party /tmp/sandbox/5857df94fd675501000961e3/bbbuild/Build/Intermediates/ArchiveIntermediates/TestApp/IntermediateBuildFilesPath/React.build/Release-iphoneos/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh
138
    (1 failure)

@javache
Copy link
Member

javache commented Jun 21, 2017

Can you attach the config.log to get more details.

#14267 may also fix this.

@SudoPlz
Copy link
Contributor

SudoPlz commented Jun 21, 2017

5c53f89 did fix it for me.

Thanks @javache and @janicduplessis !

@hramos
Copy link
Contributor

hramos commented Jul 14, 2017

This should be shipping in 0.46.3 once #14174 finishes.

@divyanshyadav
Copy link

Facing the same issue.

@hramos
Copy link
Contributor

hramos commented Jul 18, 2017

@divyanshyadav are you seeing this in 0.46.3?

@blackchestnut
Copy link

Maybe this #14382 (comment) will help

@facebook facebook locked as resolved and limited conversation to collaborators Jun 1, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants