Skip to content

Commit

Permalink
readme: Document solutions for some common problems
Browse files Browse the repository at this point in the history
  • Loading branch information
kdrag0n committed Jul 26, 2020
1 parent fa815f5 commit a819e2f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,32 @@ Proton Clang has been designed to be easy-to-use compared to other toolchains, s
- `CLANG_TRIPLE` does not need to be set because we don't use AOSP binutils
- `LD_LIBRARY_PATH` does not need to be set because we set library load paths in the toolchain
- No separate GCC/binutils toolchains are necessary; all tools are bundled

## Common problems

### `as: unrecognized option '-EL'`

Usually, this means that `CROSS_COMPILE` is not set correctly. Check that variable as well as your `PATH` to make sure that the required tools are available for Clang to invoke. You can test it manually like tihs:

```bash
$ ${CROSS_COMPILE}ld -v
GNU ld (GNU Binutils) 2.34
```

If you see `Command not found` or any other error, one of the two variables mentioned above is most likely set incorrectly.

If you continue to encounter this error after verifying `CROSS_COMPILE` and `PATH`, you are probably running into a change in Clang 12's handling of cross-compiling. The fix is to either merge linux-stable (which already has the fix included) cherry-pick ["Makefile: Fix GCC_TOOLCHAIN_DIR prefix for Clang cross compilation"](https://github.com/kdrag0n/proton_zf6/commit/6e87fec9a3df5) manually.

If the error still continues to appear and you have an arm64 kernel that includes vdso32, you will also need to cherry-pick ["arm64: vdso32: Fix '--prefix=' value for newer versions of clang"](https://github.com/kdrag0n/proton_zf6/commit/68acd6966ac98) to fix the second vdso32 error. Merging linux-stable is also an option if you are on Linux 5.4 or newer.

### `Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler`

This error is actually a result of stack protector checks in the Makefile that cause the real error to be masked. It indicates that one or more unsupported compiler flags have been passed to Clang. Disable `CONFIG_CC_STACKPROTECTOR_STRONG` in favor of `CONFIG_CC_STACKPROTECTOR_NONE` temporarily (make sure you don't keep this change permanently for security reasons) and Clang will output the flag that is causing the problem.

In downstream kernels, the cause is usually big.LITTLE CPU optimization flags that have been added to the Makefile unconditionally. The correct solution is to check `cc-name` for the current compiler and adjust the optimization flags accordingly — big.LITTLE for GCC and little-only for Clang. See ["Makefile: Optimize for sm8150's Kryo 485 CPU setup"](https://github.com/kdrag0n/proton_zf6/commit/f45e4ffbecd1c059aa49d8a119b50ee84d7f9d0f) for an example implementation of this.

### `scripts/gcc-version.sh: line 25: aarch64-linux-gnu-gcc: command not found`

This is caused by unconditional invocations of `gcc-version.sh` in CAF's camera_v2 driver. The recommended solution is to cherry-pick [Google's fix](https://android.googlesource.com/kernel/msm/+/9b3a54e388fae0fcc5ea64a4c612936baae44fce) from the Pixel 2 kernel, which simply removes the faulty invocations as they were never useful to begin with.

Note that these errors are harmless and don't necessarily need to be fixed, but nonetheless, ignoring them is not recommended.

0 comments on commit a819e2f

Please sign in to comment.