CMAKE AIX XLC编译器未使用

CMAKE AIX xlc compiler not getting used

本文关键字:未使用 编译器 XLC AIX CMAKE      更新时间:2023-10-16

我正在尝试将XLC编译器用于AIX上的CPP代码。我想要我的C代码的CC编译器

输出:

user@AIX> cmake -DCMAKE_CXX_COMPILER=/usr/vac/bin/xlc ..
-- The C compiler identification is XL 11.1.0
-- The CXX compiler identification is XL 11.1.0
-- Check for working C compiler: /usr/vac/bin/cc
-- Check for working C compiler: /usr/vac/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/vac/bin/xlc
-- Check for working CXX compiler: /usr/vac/bin/xlc -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done

但是当我运行时(在上述输出之后),它似乎是在使用GCC编译器。

user@AIX> make
[  0%] Building CXX object ../libs/shrxml/CMakeFiles/shrxml.dir/XML.cpp.o
gcc: unrecognized option '-+'
gcc: unrecognized option '-qthreaded'
gcc: unrecognized option '-qhalt=e'
gcc: unrecognized option '-qnamemangling=v6'
gcc: unrecognized option '-qmaxmem=9216'
gcc: unrecognized option '-qnamemangling=v6'
gcc: unrecognized option '-qmaxmem=9216'
gcc: unrecognized option '-qpic'
In file included from /opt/freeware/lib/gcc/powerpc-ibm-
aix6.1.0.0/4.4.5/include/c++/backward/strstream:47,
                 from 
/home/user/workspace/bitbucket/ark/src/libs/shrxml/XML.cpp:105:
/opt/freeware/lib/gcc/powerpc-ibm-
aix6.1.0.0/4.4.5/include/c++/backward/backward_warning.h:28:2: warning: 
#warning This file includes at least one deprecated or antiquated header 
which may be removed without further notice at a future date. Please use a 
non-deprecated interface with equivalent functionality instead. For a 
listing of replacement headers and interfaces, consult the file 
backward_warning.h. To disable this warning use -Wno-deprecated.

我尝试在我的cmakelists中添加集合.txt文件

 set(CMAKE_CXX_COMPILER /usr/vac/bin/xlc CACHE PATH "" FORCE)
 set(CMAKE_CC_COMPILER  /usr/vac/bin/cc  CACHE PATH "" FORCE)

我还导出了环境变量:

user@AIX> echo $CMAKE_CXX_COMPILER
/usr/vac/bin/xlc
user@AIX> 

有什么想法吗?

/usr/vac/bin目录中没有CC或XLC的链接。

当我在shrxlm目录中使用GCC和XLC时,我能找到的就是GCC。为什么Cmake不兑现我对XLC编译器的要求?

检查系统上的cc符号链接,以确保其指向XL而不是GCC。执行which cc,然后进行ls -l

根据cmake常见问题解答"我如何使用其他编译器?"部分,有3种方法。看起来您尝试使用所有3个,包括标记为"避免"的Method 3 (set())

您可以再次尝试Method 1: use environment variables,但是这次使用在此处列出的环境变量,CC(for C)和CXX(对于C )环境变量?