I have compiled OpenCV library from scratch with TIARMCLANG compiler for ARM Cortex-R5 CPU and once the build is done, I tried to link to a simple CPP project in the CCS Studio IDE (IDE for TI's MCU's) and then I am getting multipe errors as shown below
Description Resource Path Location Type
#16004-D file "/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build/lib/libopencv_core.a<alloc.cpp.obj>" has a Tag_ABI_PCS_GOT_use attribute value of "2" that is different than one previously seen ("1"); combining incompatible files opencv_test_code C/C++ Problem
#16004-D file "/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build/lib/libopencv_core.a<alloc.cpp.obj>" has a Tag_ABI_PCS_RO_data attribute value of "1" that is different than one previously seen ("0"); combining incompatible files opencv_test_code C/C++ Problem
#16004-D file "/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build/lib/libopencv_core.a<alloc.cpp.obj>" has a Tag_ABI_PCS_RW_data attribute value of "1" that is different than one previously seen ("0"); combining incompatible files opencv_test_code C/C++ Problem
#16004-D file "/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build/lib/libopencv_core.a<arithm.cpp.obj>" has a Tag_ABI_PCS_GOT_use attribute value of "2" that is different than one previously seen ("1"); combining incompatible files opencv_test_code C/C++ Problem
#16004-D file "/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build/lib/libopencv_core.a<arithm.cpp.obj>" has a Tag_ABI_PCS_RO_data attribute value of "1" that is different than one previously seen ("0"); combining incompatible files opencv_test_code C/C++ Problem
#16004-D file "/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build/lib/libopencv_core.a<arithm.cpp.obj>" has a Tag_ABI_PCS_RW_data attribute value of "1" that is different than one previously seen ("0"); combining incompatible files opencv_test_code C/C++ Problem
#16004-D file "/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build/lib/libopencv_core.a<arithm.dispatch.cpp.obj>" has a Tag_ABI_PCS_GOT_use attribute value of "2" that is different than one previously seen ("1"); combining incompatible files opencv_test_code C/C++ Problem
#16004-D file "/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build/lib/libopencv_core.a<arithm.dispatch.cpp.obj>" has a Tag_ABI_PCS_RO_data attribute value of "1" that is different than one previously seen ("0"); combining incompatible files opencv_test_code C/C++ Problem
#16004-D file "/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build/lib/libopencv_core.a<arithm.dispatch.cpp.obj>" has a Tag_ABI_PCS_RW_data attribute value of "1" that is different than one previously seen ("0"); combining incompatible files opencv_test_code C/C++ Problem
Here are my compiler flags and the command I am using to compile these CPP files.
/home/kowshik/ti/ti-cgt-armllvm_3.0.0.STS//bin/tiarmclang -DOPENCV_HAVE_FILESYSTEM_SUPPORT=0 -I/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build -I/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build/3rdparty/ade/ade-0.1.2a/sources/ade/include -w --specs=nosys.specs -frtti -fshort-enums -fshort-wchar -Wno-unknown-warning-option -Wno-unused-command-line-argument -Wno-suggest-override -mfpu=vfpv3-d16 -mabi=aapcs -Wno-narrowing -fno-pie -fno-pic -fexceptions -fpermissive -mcpu=cortex-r5 -mthumb -mfloat-abi=hard --std=c++11 -I/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/fake_root_test/include -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -fdiagnostics-show-option -Qunused-arguments -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -Ofast -DNDEBUG -fPIC -std=c++11 -o CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.2a/sources/ade/source/alloc.cpp.obj -c /home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/build/3rdparty/ade/ade-0.1.2a/sources/ade/source/alloc.cpp
My C and C++ flags are attached below
SET(CMAKE_C_FLAGS "-w --specs=nosys.specs -frtti -fshort-enums -fshort-wchar -Wno-unknown-warning-option -Wno-unused-command-line-argument -Wno-suggest-override -mfpu=vfpv3-d16 -Wno-narrowing -fno-pie -fno-pic -fexceptions -fpermissive -mcpu=cortex-r5 -mthumb -mfloat-abi=hard -mfpu=vfpv3-d16 -I/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/fake_root_test/include" CACHE STRING "c compiler flags")
SET(CMAKE_CXX_FLAGS "-w --specs=nosys.specs -frtti -fshort-enums -fshort-wchar -Wno-unknown-warning-option -Wno-unused-command-line-argument -Wno-suggest-override -mfpu=vfpv3-d16 -mabi=aapcs -Wno-narrowing -fno-pie -fno-pic -fexceptions -fpermissive -mcpu=cortex-r5 -mthumb -mfloat-abi=hard --std=c++11 -I/home/kowshik/Desktop/opencv_porting/opencv_with_tiarmclang/fake_root_test/include" CACHE STRING "cxx compiler flags")
The above errors are mainly caused due to enabling the PIC feature (Position independant code). Some of the compilers might support this and some might not. So, in my build system I have disabled the PIC option and these went away.
Please note, even though you're passing -fno-pic in your compiler flags, it still doesn't over write if -fPIC is enabled. So please be careful with this.