c++ - gcc Boost template results in "defined in discarded section" -


i'm using gcc 4.7.4 20140401 cross compile embedded arm cortex m4 (pixhawk). i'm trying boost statechart working , i've come across error can't resolve. below of 1 them, there many this.

_ztin5boost12noncopyable_11noncopyablee' referenced in section.rodata._ztin5boost10statechart13state_machinei15positioncontrol15holdingpositionsaivens0_25null_exception_translatoreee[_ztin5boost10statechart13state_machinei15positioncontrol15holdingpositionsaivens0_25null_exception_translatoreee]' of /home/nghia/documents/catkin/firmware/build/px4fmu-v2_default.build//home/nghia/documents/catkin/firmware/src/modules/state_machine_boost/module.pre.o: defined in discarded section `.rodata._ztin5boost12noncopyable_11noncopyablee[_ztin5boost12noncopyable_11noncopyablee]' of /home/nghia/documents/catkin/firmware/build/px4fmu-v2_default.build//home/nghia/documents/catkin/firmware/src/modules/state_machine_boost/module.pre.o

i've read through stackoverflow posts regarding 'defined in discarded section', haven't found solution works. includes enabling/disabling -ffunction-sections, -fdata-sections, --gc-sections, optimization flags, , re-ordering module.

boost statechart makes heavy use of template, suspect causing problem. gcc optimizing out stuff thinks isn't being used?

update: i've managed come bare minimal example triggers error above:

class dummy : boost::noncopyable { public:     int x;     };  static dummy g_dummy; 

it turns out problem module including boost statechart. removing boost related code in other module resolves compilation error. i'm guessing linker doesn't seeing multiple instance of boost templates in different object files.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -