我正尝试在AIX上为我的cpp代码使用xlc编译器。我想要我的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
但是当我运行make (就在上面的输出之后)时,它似乎使用的是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目录中grep gcc和xlc时,我能找到的只有gcc。为什么cmake不接受我对xlc编译器的请求?
发布于 2017-10-04 22:42:49
检查系统上的cc
符号链接,确保它指向XL而不是gcc。执行which cc
,然后对其执行ls -l
。
发布于 2017-10-07 02:44:14
根据CMake FAQ "How do I use a different compiler?" section的说法,有3种方法。看起来你已经尝试使用所有3个,包括Method 3 (set())
,它被标记为“避免”。
您是否可以再次尝试使用Method 1: use environment variables
,但这一次使用此处列出的环境变量、CC
(用于C)和CXX
(用于C++)环境变量?
https://stackoverflow.com/questions/46566874
复制相似问题