Adding -Wl to Linker Parameters
Error Information
1 2 3 | clang: error: unsupported option `--whole-archive` clang: error: unsupported option `--no-whole-archive` clang: error: unknown argument: `-soname` |
Problem
Some application build scripts may not automatically add -Wl to the parameters that need to be passed to the linker when the compiler is Clang. -Wl must be added to these parameters so that they can be passed to the linker.
These parameters include but are not limited to:
- --whole-archive
- --no-whole-archive
- -soname
If unknown argument or unsupported option is displayed and the option is to be passed to the linker, -Wl must be added to the option.
Solution
Add -Wl before these parameters. An example is as follows:
1 | -Wl,--whole-archive -Wl,--no-whole-archive -Wl,-soname |
Parent topic: Link Problems