You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build-speed.md
+12-72Lines changed: 12 additions & 72 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,47 +72,8 @@ We suggest to use [**ccache**](https://ccache.dev/) to cache the compilation of
72
72
Ccache works by wrapping the C++ compilers, storing the compilation results, and skipping the compilation
73
73
if an intermediate compilation result was originally stored.
74
74
75
-
To install it, you can follow the [official installation instructions](https://github.com/ccache/ccache/blob/master/doc/INSTALL.md).
76
-
77
-
On macOS, we can install ccache with `brew install ccache`.
78
-
Once installed you can configure it as follows to cache NDK compile results:
79
-
80
-
```
81
-
ln -s $(which ccache) /usr/local/bin/gcc
82
-
ln -s $(which ccache) /usr/local/bin/g++
83
-
ln -s $(which ccache) /usr/local/bin/cc
84
-
ln -s $(which ccache) /usr/local/bin/c++
85
-
ln -s $(which ccache) /usr/local/bin/clang
86
-
ln -s $(which ccache) /usr/local/bin/clang++
87
-
```
88
-
89
-
This will create symbolic links to `ccache` inside the `/usr/local/bin/` which are called `gcc`, `g++`, and so on.
90
-
91
-
This works as long as `/usr/local/bin/` comes first than `/usr/bin/` inside your `$PATH` variable, which is the default.
92
-
93
-
You can verify that it works using the `which` command:
94
-
95
-
```
96
-
$ which gcc
97
-
/usr/local/bin/gcc
98
-
```
99
-
100
-
If the results is `/usr/local/bin/gcc`, then you're effectively calling `ccache` which will wrap the `gcc` calls.
101
-
102
-
:::caution
103
-
Please note that this setup of `ccache` will affect all the compilations that you're running on your machine, not only those related to React Native. Use it at your own risk. If you're failing to install/compile other software, this might be the reason. If that is the case, you can remove the symlink you created with:
104
-
105
-
```
106
-
unlink /usr/local/bin/gcc
107
-
unlink /usr/local/bin/g++
108
-
unlink /usr/local/bin/cc
109
-
unlink /usr/local/bin/c++
110
-
unlink /usr/local/bin/clang
111
-
unlink /usr/local/bin/clang++
112
-
```
113
-
114
-
to revert your machine to the original status and use the default compilers.
115
-
:::
75
+
Ccache is available in the package manager for most operating systems. On macOS, we can install ccache with `brew install ccache`.
76
+
Or you can follow the [official installation instructions](https://github.com/ccache/ccache/blob/master/doc/INSTALL.md) to install from source.
116
77
117
78
You can then do two clean builds (e.g. on Android you can first run `yarn react-native run-android`, delete the `android/app/build` folder and run the first command once more). You will notice that the second build was way faster than the first one (it should take seconds rather than minutes).
118
79
While building, you can verify that `ccache` works correctly and check the cache hits/miss rate `ccache -s`
@@ -139,44 +100,23 @@ Should you need to wipe your cache, you can do so with `ccache --clear`
139
100
140
101
#### XCode Specific Setup
141
102
142
-
To make sure `ccache` works correctly with iOS and XCode, you need to follow a couple of extra steps:
143
-
144
-
1. You must alter the way Xcode and `xcodebuild` call for the compiler command. By default they use _fully specified paths_ to the compiler binaries, so the symbolic links installed in `/usr/local/bin` will not be used. You may configure Xcode to use _relative_ names for the compilers using either of these two options:
103
+
To make sure `ccache` works correctly with iOS and XCode, you need to enable React Native support for ccache in `ios/Podfile`.
145
104
146
-
- environment variables prefixed on the command line if you use a direct command line: `CLANG=clang CLANGPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ xcodebuild <rest of xcodebuild command line>`
147
-
- A `post_install` section in your `ios/Podfile` that alters the compiler in your Xcode workspace during the `pod install` step:
105
+
Open `ios/Podfile` in your editor and uncomment the `ccache_enabled` line.
148
106
149
107
```ruby
150
108
post_install do |installer|
151
-
react_native_post_install(installer)
152
-
153
-
# ...possibly other post_install items here
154
-
155
-
installer.pods_project.targets.each do |target|
156
-
target.build_configurations.each do |config|
157
-
# Using the un-qualified names means you can swap in different implementations, for example ccache
2. You need a ccache configuration that allows for a certain level of sloppiness and cache behavior such that ccache registers cache hits during Xcode compiles. The ccache configuration variables that are different from standard are as follows if configured by environment variable:
The same may be configured in a `ccache.conf` file or any other mechanism ccache provides. More on this can be found in the [official ccache manual](https://ccache.dev/manual/4.3.html).
179
-
180
120
#### Using this approach on a CI
181
121
182
122
Ccache uses the `/Users/$USER/Library/Caches/ccache` folder on macOS to store the cache.
Copy file name to clipboardExpand all lines: website/versioned_docs/version-0.74/build-speed.md
+12-72Lines changed: 12 additions & 72 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,47 +72,8 @@ We suggest to use [**ccache**](https://ccache.dev/) to cache the compilation of
72
72
Ccache works by wrapping the C++ compilers, storing the compilation results, and skipping the compilation
73
73
if an intermediate compilation result was originally stored.
74
74
75
-
To install it, you can follow the [official installation instructions](https://github.com/ccache/ccache/blob/master/doc/INSTALL.md).
76
-
77
-
On macOS, we can install ccache with `brew install ccache`.
78
-
Once installed you can configure it as follows to cache NDK compile results:
79
-
80
-
```
81
-
ln -s $(which ccache) /usr/local/bin/gcc
82
-
ln -s $(which ccache) /usr/local/bin/g++
83
-
ln -s $(which ccache) /usr/local/bin/cc
84
-
ln -s $(which ccache) /usr/local/bin/c++
85
-
ln -s $(which ccache) /usr/local/bin/clang
86
-
ln -s $(which ccache) /usr/local/bin/clang++
87
-
```
88
-
89
-
This will create symbolic links to `ccache` inside the `/usr/local/bin/` which are called `gcc`, `g++`, and so on.
90
-
91
-
This works as long as `/usr/local/bin/` comes first than `/usr/bin/` inside your `$PATH` variable, which is the default.
92
-
93
-
You can verify that it works using the `which` command:
94
-
95
-
```
96
-
$ which gcc
97
-
/usr/local/bin/gcc
98
-
```
99
-
100
-
If the results is `/usr/local/bin/gcc`, then you're effectively calling `ccache` which will wrap the `gcc` calls.
101
-
102
-
:::caution
103
-
Please note that this setup of `ccache` will affect all the compilations that you're running on your machine, not only those related to React Native. Use it at your own risk. If you're failing to install/compile other software, this might be the reason. If that is the case, you can remove the symlink you created with:
104
-
105
-
```
106
-
unlink /usr/local/bin/gcc
107
-
unlink /usr/local/bin/g++
108
-
unlink /usr/local/bin/cc
109
-
unlink /usr/local/bin/c++
110
-
unlink /usr/local/bin/clang
111
-
unlink /usr/local/bin/clang++
112
-
```
113
-
114
-
to revert your machine to the original status and use the default compilers.
115
-
:::
75
+
Ccache is available in the package manager for most operating systems. On macOS, we can install ccache with `brew install ccache`.
76
+
Or you can follow the [official installation instructions](https://github.com/ccache/ccache/blob/master/doc/INSTALL.md) to install from source.
116
77
117
78
You can then do two clean builds (e.g. on Android you can first run `yarn react-native run-android`, delete the `android/app/build` folder and run the first command once more). You will notice that the second build was way faster than the first one (it should take seconds rather than minutes).
118
79
While building, you can verify that `ccache` works correctly and check the cache hits/miss rate `ccache -s`
@@ -139,44 +100,23 @@ Should you need to wipe your cache, you can do so with `ccache --clear`
139
100
140
101
#### XCode Specific Setup
141
102
142
-
To make sure `ccache` works correctly with iOS and XCode, you need to follow a couple of extra steps:
143
-
144
-
1. You must alter the way Xcode and `xcodebuild` call for the compiler command. By default they use _fully specified paths_ to the compiler binaries, so the symbolic links installed in `/usr/local/bin` will not be used. You may configure Xcode to use _relative_ names for the compilers using either of these two options:
103
+
To make sure `ccache` works correctly with iOS and XCode, you need to enable React Native support for ccache in `ios/Podfile`.
145
104
146
-
- environment variables prefixed on the command line if you use a direct command line: `CLANG=clang CLANGPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ xcodebuild <rest of xcodebuild command line>`
147
-
- A `post_install` section in your `ios/Podfile` that alters the compiler in your Xcode workspace during the `pod install` step:
105
+
Open `ios/Podfile` in your editor and uncomment the `ccache_enabled` line.
148
106
149
107
```ruby
150
108
post_install do |installer|
151
-
react_native_post_install(installer)
152
-
153
-
# ...possibly other post_install items here
154
-
155
-
installer.pods_project.targets.each do |target|
156
-
target.build_configurations.each do |config|
157
-
# Using the un-qualified names means you can swap in different implementations, for example ccache
2. You need a ccache configuration that allows for a certain level of sloppiness and cache behavior such that ccache registers cache hits during Xcode compiles. The ccache configuration variables that are different from standard are as follows if configured by environment variable:
The same may be configured in a `ccache.conf` file or any other mechanism ccache provides. More on this can be found in the [official ccache manual](https://ccache.dev/manual/4.3.html).
179
-
180
120
#### Using this approach on a CI
181
121
182
122
Ccache uses the `/Users/$USER/Library/Caches/ccache` folder on macOS to store the cache.
Copy file name to clipboardExpand all lines: website/versioned_docs/version-0.75/build-speed.md
+12-72Lines changed: 12 additions & 72 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,47 +72,8 @@ We suggest to use [**ccache**](https://ccache.dev/) to cache the compilation of
72
72
Ccache works by wrapping the C++ compilers, storing the compilation results, and skipping the compilation
73
73
if an intermediate compilation result was originally stored.
74
74
75
-
To install it, you can follow the [official installation instructions](https://github.com/ccache/ccache/blob/master/doc/INSTALL.md).
76
-
77
-
On macOS, we can install ccache with `brew install ccache`.
78
-
Once installed you can configure it as follows to cache NDK compile results:
79
-
80
-
```
81
-
ln -s $(which ccache) /usr/local/bin/gcc
82
-
ln -s $(which ccache) /usr/local/bin/g++
83
-
ln -s $(which ccache) /usr/local/bin/cc
84
-
ln -s $(which ccache) /usr/local/bin/c++
85
-
ln -s $(which ccache) /usr/local/bin/clang
86
-
ln -s $(which ccache) /usr/local/bin/clang++
87
-
```
88
-
89
-
This will create symbolic links to `ccache` inside the `/usr/local/bin/` which are called `gcc`, `g++`, and so on.
90
-
91
-
This works as long as `/usr/local/bin/` comes first than `/usr/bin/` inside your `$PATH` variable, which is the default.
92
-
93
-
You can verify that it works using the `which` command:
94
-
95
-
```
96
-
$ which gcc
97
-
/usr/local/bin/gcc
98
-
```
99
-
100
-
If the results is `/usr/local/bin/gcc`, then you're effectively calling `ccache` which will wrap the `gcc` calls.
101
-
102
-
:::caution
103
-
Please note that this setup of `ccache` will affect all the compilations that you're running on your machine, not only those related to React Native. Use it at your own risk. If you're failing to install/compile other software, this might be the reason. If that is the case, you can remove the symlink you created with:
104
-
105
-
```
106
-
unlink /usr/local/bin/gcc
107
-
unlink /usr/local/bin/g++
108
-
unlink /usr/local/bin/cc
109
-
unlink /usr/local/bin/c++
110
-
unlink /usr/local/bin/clang
111
-
unlink /usr/local/bin/clang++
112
-
```
113
-
114
-
to revert your machine to the original status and use the default compilers.
115
-
:::
75
+
Ccache is available in the package manager for most operating systems. On macOS, we can install ccache with `brew install ccache`.
76
+
Or you can follow the [official installation instructions](https://github.com/ccache/ccache/blob/master/doc/INSTALL.md) to install from source.
116
77
117
78
You can then do two clean builds (e.g. on Android you can first run `yarn react-native run-android`, delete the `android/app/build` folder and run the first command once more). You will notice that the second build was way faster than the first one (it should take seconds rather than minutes).
118
79
While building, you can verify that `ccache` works correctly and check the cache hits/miss rate `ccache -s`
@@ -139,44 +100,23 @@ Should you need to wipe your cache, you can do so with `ccache --clear`
139
100
140
101
#### XCode Specific Setup
141
102
142
-
To make sure `ccache` works correctly with iOS and XCode, you need to follow a couple of extra steps:
143
-
144
-
1. You must alter the way Xcode and `xcodebuild` call for the compiler command. By default they use _fully specified paths_ to the compiler binaries, so the symbolic links installed in `/usr/local/bin` will not be used. You may configure Xcode to use _relative_ names for the compilers using either of these two options:
103
+
To make sure `ccache` works correctly with iOS and XCode, you need to enable React Native support for ccache in `ios/Podfile`.
145
104
146
-
- environment variables prefixed on the command line if you use a direct command line: `CLANG=clang CLANGPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ xcodebuild <rest of xcodebuild command line>`
147
-
- A `post_install` section in your `ios/Podfile` that alters the compiler in your Xcode workspace during the `pod install` step:
105
+
Open `ios/Podfile` in your editor and uncomment the `ccache_enabled` line.
148
106
149
107
```ruby
150
108
post_install do |installer|
151
-
react_native_post_install(installer)
152
-
153
-
# ...possibly other post_install items here
154
-
155
-
installer.pods_project.targets.each do |target|
156
-
target.build_configurations.each do |config|
157
-
# Using the un-qualified names means you can swap in different implementations, for example ccache
2. You need a ccache configuration that allows for a certain level of sloppiness and cache behavior such that ccache registers cache hits during Xcode compiles. The ccache configuration variables that are different from standard are as follows if configured by environment variable:
The same may be configured in a `ccache.conf` file or any other mechanism ccache provides. More on this can be found in the [official ccache manual](https://ccache.dev/manual/4.3.html).
179
-
180
120
#### Using this approach on a CI
181
121
182
122
Ccache uses the `/Users/$USER/Library/Caches/ccache` folder on macOS to store the cache.
0 commit comments