Clang error: cannot specify 'B' along with 'A' (err_drv_cannot_mix_options)
Jump to navigation
Jump to search
Text | error: cannot specify 'B' along with 'A' (since 9.0) |
---|---|
Type | Error |
Category | None (since 9.0) |
Internal Id | err_drv_cannot_mix_options (since 9.0) |
Internal Message | cannot specify '%1' along with '%0' (since 9.0)
|
Regular Expression | (?:error|fatal error)\: cannot specify '(.*?)' along with '(.*?)'
|
First Commit | 2018-08-15 4593e4131aff AMDGPU: Teach toolchain to link rocm device libs |
Description
Example
Flags | -xc++ -target arm64-apple-ios13.0-macabi -mtargetos=macos10.15
|
|
---|---|---|
Source |
int main() { return 0; }
| |
Compiler Output |
clang++: error: cannot specify '-mtargetos=macos10.15' along with '-target arm64-apple-ios13.0-macabi' clang++: error: invalid version number in '-target arm64-apple-ios13.0-macabi' |
Clang Internals (17.0.6)
Git Commit Message
AMDGPU: Teach toolchain to link rocm device libs Currently the library is separately linked, but this isn't correct to implement fast math flags correctly. Each module should get the version of the library appropriate for its combination of fast math and related flags, with the attributes propagated into its functions and internalized. HIP already maintains the list of libraries, but this is not used for OpenCL. Unfortunately, HIP uses a separate --hip-device-lib argument, despite both languages using the same bitcode library. Eventually these two searches need to be merged. An additional problem is there are 3 different locations the libraries are installed, depending on which build is used. This also needs to be consolidated (or at least the search logic needs to deal with this unnecessary complexity).
Used in Clang Sources
This section lists all occurrences of the diagnostic within the Clang's codebase. For each occurrence, an auto-extracted snipped from the source code is listed including key elements like control structures, functions, or classes. It should illustrate the conditions under which the diagnostic is activated.
clang/lib/Driver/ToolChains/Darwin.cpp (line 2172)
void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
// ...
if (OSTarget) {
// Disallow mixing -target and -mtargetos=.
if (const auto *MTargetOSArg = Args.getLastArg(options::OPT_mtargetos_EQ)) {
// ...
getDriver().Diag(diag::err_drv_cannot_mix_options) << TargetArgStr << MTargetOSArgStr;
clang/lib/Driver/ToolChains/Darwin.cpp (line 2215)
void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
// ...
if (OSTarget) {
// ...
} else if ((OSTarget = getDeploymentTargetFromMTargetOSArg(Args, getDriver(), SDKInfo))) {
// ...
if (OSVersionArgTarget) {
// ...
getDriver().Diag(diag::err_drv_cannot_mix_options) << MTargetOSArgStr << OSVersionArgStr;
clang/lib/Driver/ToolChains/Gnu.cpp (line 316)
static bool getStaticPIE(const ArgList &Args, const ToolChain &TC) {
// ...
// -no-pie is an alias for -nopie. So, handling -nopie takes care of
// -no-pie as well.
if (HasStaticPIE && Args.hasArg(options::OPT_nopie)) {
// ...
D.Diag(diag::err_drv_cannot_mix_options) << StaticPIEName << NoPIEName;