GCC SegFault When Compiling On Native NI LinuxRT Target

Updated Nov 18, 2022

Reported In

Operating System

  • LabVIEW Real-Time (NI Linux Real-Time)

Issue Details

I have installed GCC, the GNU Compiler Collection, via the opkg feeds available on an NI LinuxRT device. I am trying to compile user-code on the NI Linux RT target with GCC. When building a large or complex model, I receive the following error message from GCC:
g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

Why does this error appear?

Solution

This error appears because NI LinuxRT has a default hard stack size limit of 512kb. This can be printed by "ulimit -a -H", and changed by the following command:
ulimit -Hs unlimited
This will remove the hard stack size limit and allows for the compilation to finish on this boot. To permanently set this property, edit the file "/etc/profile.d/ulimit.sh" to adjust the property.