当编译只有一个main.cpp文件的OpenMP工程时,如果代码中使用的STL库,编译器会报内部错误,语言标准为C++14,器件为c6678。main.cpp代码如下:
#include <vector> struct ABC{float *data; } void test_fxn(const std::vector<ABC>& obj) {float * data=obj[0].data; }
报如下错误:
**** Build of configuration Debug for project test **** "C:\\ti\\ccs930\\ccs\\utils\\bin\\gmake" -k -j 64 all -O Building file: "../main.cpp" Invoking: C6000 Compiler "C:/ti/ccs930/ccs/tools/compiler/ti-cgt-c6000_8.3.8/bin/cl6x" -mv6600 --include_path="C:/Users/YuHaoxin/Documents/CCS_Workspace/test" --include_path="C:/ti/ccs930/ccs/tools/compiler/ti-cgt-c6000_8.3.8/include" -g --c99 --c++14 --diag_warning=225 --diag_wrap=off --display_error_number --multithread --openmp --preproc_with_compile --preproc_dependency="main.d_raw" --cmd_file="C:/Users/YuHaoxin/Documents/CCS_Workspace/cfg/Debug/configPkg/compiler.opt" "../main.cpp" >> Compilation failure subdir_rules.mk:9: recipe for target 'main.obj' failed INTERNAL ERROR: C:\ti\ccs930\ccs\tools\compiler\ti-cgt-c6000_8.3.8\bin\acpia6x.exe experienced a segmentation fault while processing function (unknown or file scope) file ../main.cpp line 9 This is caused by a defect in the TI EABI C/C++ Parser. TI Customer Support may be able to suggest a workaround to avoid this. Upgrading to the newest version of the compiler may fix this problem. Contact TI in the E2E support forums at https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_CCS_ under "Development Tools", "TI C/C++ Compiler". See the link titled "Submitting an issue". We need to see this ENTIRE error message and a complete, reproducible test case including ALL of the command-line options. Include the .pp file created by option --preproc_with_comment gmake: *** [main.obj] Error 1 gmake: Target 'all' not remade because of errors. **** Build Finished ****
编译选项为:
-mv6600 --include_path="C:/Users/YuHaoxin/Documents/CCS_Workspace/test" --include_path="C:/ti/ccs930/ccs/tools/compiler/ti-cgt-c6000_8.3.8/include" -g --c99 --c++14 --diag_warning=225 --diag_wrap=off --display_error_number --multithread --openmp
如果去除"–openmp"选项,则编译通过。
我的项目需要同时用的Openmp和C++14的STL,请问该如何解决这个问题?
Shine:
请问是否有参考过下面的帖子?https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_CCS_3307005
,
haoxin yu:
你好,我参考过这个帖子,但是实际情况时我在需要使用openmp的源文件在编译时报错,无法单独为这个文件关闭–openmp选项。请问您能重现这个错误吗,这个是不是编译器的bug?
,
Shine:
是否有尝试过上面帖子里的办法?CCS allows for File Specific Options. With that you can enable –openmp at the project level, and then manually remove –openmp on specific C++ source files which cause the compiler crash.
,
haoxin yu:
您好,我尝试了,关闭–openmp后确实可以编译通过,但是报错的函数正好需要使用openmp,这个选项在这个文件上无法关闭,请问有什么解决办法吗?
,
Shine:
openmp不支持C++,对于C++的代码不能使用-openmp编译。
,
haoxin yu:
我想你说得不对,我测试后确认openmp支持C++。另外,我测试后发现只要直接或间接包含utility头文件就会触发这个错误,包括自己定义的模板类。
,我测试后发现只要直接或间接包含utility头文件就会触发这个错误。另外,
, after testing, I found that this error will be triggered as long as the utility header file is included directly or indirectly. In addition,
,
Shine:
我看到您在e2e上也发帖了。建议再跟帖问一下产品线工程师,或者我帮您跟帖也可以,最好把可以编译的C++贴一下作参考。https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1040786/tms320c6678-c6000-8-3-8-compiler-report-internal-error-when-building-an-openmp-project-with-c-stl