I'm encoutering a Relocation truncated to fit: secrel32 against `.debug_frame$_......... issue in my C++ project.
I have already seen the links below but it doesn't seem to match the behavior of the build issue :
What does this GCC error "... relocation truncated to fit..." mean?
https://www.technovelty.org/c/relocation-truncated-to-fit-wtf.html
This issue only appears in debug mode. My project builds with no error in release mode.
Also commenting random portion of code in the main function "solves" the build issue.
My project is configured in a Qt environment using a msys2-mingw64 toolchain and gcc version 10.2.0 (Rev6, Built by MSYS2 project).
Compilation logs output :
g++ -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,-subsystem,console -mthreads -o debug\program.exe @object_script.program.Debug -LC:\Users\user\Desktop\build-project-Qt_5_15_0_MinGW_64_bit_msys2-Debug\src\libs\common\debug -lcommon C:\msys64\mingw64\lib\libQt5Core.dll.a
debug/main.o:main.cpp:(.debug_frame$_ZSt13__invoke_implIvRZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESF_ZN28SatelliteBeamSelectionSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_EUlSI_E_JSI_EESO_St14__invoke_otherSR_DpOT1_+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZSt13__invoke_implIvRZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESF_ZN28SatelliteBeamSelectionSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_EUlSI_E_JSI_EESO_St14__invoke_otherSR_DpOT1_'
debug/main.o:main.cpp:(.debug_frame$_ZNSt14_Function_base13_Base_managerIZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESG_ZN28SatelliteBeamSelectionSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSJ_E_E8_M_cloneERSt9_Any_dataRKSZ_St17integral_constantIbLb0EE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNSt14_Function_base13_Base_managerIZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESG_ZN28SatelliteBeamSelectionSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSJ_E_E8_M_cloneERSt9_Any_dataRKSZ_St17integral_constantIbLb0EE'
debug/main.o:main.cpp:(.debug_frame$_ZNSt14_Function_base13_Base_managerIZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESG_ZN28SatelliteBeamSelectionSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSJ_E_E10_M_destroyERSt9_Any_dataSt17integral_constantIbLb0EE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNSt14_Function_base13_Base_managerIZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESG_ZN28SatelliteBeamSelectionSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSJ_E_E10_M_destroyERSt9_Any_dataSt17integral_constantIbLb0EE'
debug/main.o:main.cpp:(.debug_frame$_ZNKSt9_Any_data9_M_accessIPZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_EERKSO_v+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNKSt9_Any_data9_M_accessIPZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_EERKSO_v'
debug/main.o:main.cpp:(.debug_frame$_ZSt7forwardIRZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_ENUlSH_E_clESH_EUlvE_ESO_RNSt16remove_referenceISN_E4typeE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZSt7forwardIRZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_ENUlSH_E_clESH_EUlvE_ESO_RNSt16remove_referenceISN_E4typeE'
debug/main.o:main.cpp:(.debug_frame$_ZSt13__invoke_implIvRZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_ENUlSH_E_clESH_EUlvE_JEESN_St14__invoke_otherSQ_DpOT1_+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZSt13__invoke_implIvRZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_ENUlSH_E_clESH_EUlvE_JEESN_St14__invoke_otherSQ_DpOT1_'
debug/main.o:main.cpp:(.debug_frame$_ZNSt14_Function_base13_Base_managerIZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_E8_M_cloneERSt9_Any_dataRKSZ_St17integral_constantIbLb0EE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNSt14_Function_base13_Base_managerIZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_E8_M_cloneERSt9_Any_dataRKSZ_St17integral_constantIbLb0EE'
debug/main.o:main.cpp:(.debug_frame$_ZNSt14_Function_base13_Base_managerIZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_E10_M_destroyERSt9_Any_dataSt17integral_constantIbLb0EE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNSt14_Function_base13_Base_managerIZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_E10_M_destroyERSt9_Any_dataSt17integral_constantIbLb0EE'
debug/main.o:main.cpp:(.debug_frame$_ZNKSt9_Any_data9_M_accessIPZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSI_E_EERKSO_v+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNKSt9_Any_data9_M_accessIPZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSI_E_EERKSO_v'
debug/main.o:main.cpp:(.debug_frame$_ZSt7forwardIRZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_EUlSH_E_ESO_RNSt16remove_referenceISN_E4typeE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZSt7forwardIRZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_EUlSH_E_ESO_RNSt16remove_referenceISN_E4typeE'
debug/main.o:main.cpp:(.debug_frame$_ZSt13__invoke_implIvRZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_EUlSH_E_JSH_EESN_St14__invoke_otherSQ_DpOT1_+0x1c): additional relocation overflows omitted from the output
collect2.exe: error: ld returned 1 exit status
I checked section sizes of the main object with GNU size tool. I added the "-fstack-usage" flag to check stack usage. I added the "fPIC" flag to the common library. It didn't fix the issue.
I am looking for some hints.
Thank you by advance !