---
title: 给链接器参数加上-Wl
description: "```"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevkithistory/bisheng/hist-bisheng/kunpengbisheng_06_0040_0.html
sourcePath: /source/zh/kunpengdevkithistory/bisheng/hist-bisheng/kunpengbisheng_06_0040_0.html
indexId: 29b3efe1368a746f78602e50f6f2b0a33dc65e182bf5829cff5fa3c373ec1edf82
---
# 给链接器参数加上-Wl

#### 错误信息

```
clang: error: unsupported option `--whole-archive` 
clang: error: unsupported option `--no-whole-archive` 
clang: error: unknown argument: `-soname`
```


#### 问题介绍

部分应用构建脚本在编译器为clang时可能不会默认给需要传递给链接器加上-Wl，这部分参数必须添加-Wl，才能传递给链接器。

包括但不限于：

- --whole-archive
- --no-whole-archive
- -soname

如果出现unknown argument或者unsupported option，并且该选项是应该传给链接器的，则需要加上-Wl。


#### 解决方案

这些参数前面添加-Wl,。例如：

```
-Wl,--whole-archive -Wl,--no-whole-archive -Wl,-soname
```
