How to solve "You must NOT be root to run crosstool-NG" when using ct-ng?
c, cross-compiling
Solution
`CT_ALLOW_BUILD_AS_ROOT=y`
As of d5900debd397b8909d9cafeb9a1093fb7a5dc6e6 (Jun 2018) that option allows you to allow you to build as root if you really know what you are doing:
CT_EXPERIMENTAL=y
CT_ALLOW_BUILD_AS_ROOT=y
CT_ALLOW_BUILD_AS_ROOT_SURE=y
They can accessed on the menus from:
- Paths and misc options
- Try features marked as EXPERIMENTAL
- Allow building as root user (READ HELP!)
- Are you sure?
However, I would recommend you to read the help for that option carefully:
│ You normally do *not* need to be root to build a toolchain using │
│ crosstool-NG. In fact, it is *VERY* dangerous to run as root, as │
│ crosstool-NG will, as part of the build process, remove a few │
│ directories. If anything goes wrong, running as root can ruin │
│ your host distribution. │
│ │
│ I can't stress it enough: DO NOT RUN AS ROOT !! │
│ │
│ Do not run as root, you've been warned. │
│ Do not come whining, if it nukes your host system. │
│ Do not come whining, if you lose any data. │
│ Do not run as root. │
│ │
│ Do not run as root, you've been warned. │
│ Do not come whining, if the Earth stops rotating. │
│ Do not come whining, if kittens are smashed. │
│ Do not run as root. │
│ │
│ Do not run as root, do not run as root! │
│ (ad libitum) │
│
Maybe the most acceptable use case for this is to run crosstool-NG run within Docker as I'm doing here. It works.
Found by grepping the error message in the source code :-)
Problem
when I follow the steps here to create a cross complie env, [http://crosstool-ng.org/ ] I got such an error: ``` root@gpl-vm:~# ct-ng build [ERROR] You must NOT be root to run crosstool-NG [00:00] / make: *** [build] Error 1 ``` When I switch to a common user, it says I have no right to perform the command.