Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - 4.2.3 c++ static ctor error: __cxa_guard_acquire / __cxa_guard_release: (3 Items)
   
4.2.3 c++ static ctor error: __cxa_guard_acquire / __cxa_guard_release  
I just upgraded from 4.2.1 to 4.2.3 and now a static ctor in a function body errors:

C:/QNX630/host/win32/x86/usr/bin/qcc -V4.2.3,gcc_ntoarmle_acpp-ne -lang-c++
-g -g  -o boardinfo -Wl,--start-group boardinfo.o libhal.a -Wl,--end-group 
/libhal.a(foofoo.o): In function `ServiceFoo':
.../src/lib/Hal/foofoo/.objs/../foofoo.cpp:126: undefined reference to `__cxa_guard_acquire'
.../src/lib/Hal/foofoo/.objs/../foofoo.cpp:126: undefined reference to `__cxa_guard_release'

Line 126 is this static declaration within a function body:
...
   static HalTrace trace("Foo");

Your qcc -vvvvv is:

cc: looking for gcc_ntoarmle_acpp-ne+debug in C:/QNX630/host/win32/x86/etc/qcc/gcc/4.2.3/gcc_ntoarmle_acpp-ne++.conf
cc: looking for gcc_ntoarmle_acpp-ne+debug in C:/QNX630/host/win32/x86/etc/qcc/gcc/4.2.3/gcc_ntoarmle_acpp-ne.conf
C:/QNX630/host/win32/x86/usr/bin/ntoarm-ld-2.18 -EL -m armnto -p --dynamic-linker /usr/lib/ldqnx.so.2 -rpath-link C:/
QNX630/target/qnx6/armle/lib:C:/QNX630/target/qnx6/armle/usr/lib:C:/QNX630/target/qnx6/armle/lib/gcc/4.2.3:C:/QNX630/
target/qnx6/armle/opt/lib C:/QNX630/target/qnx6/armle/lib/crt1.o C:/QNX630/target/qnx6/armle/lib/crti.o C:/QNX630/target
/qnx6/armle/lib/crtbegin.o --start-group bsp/mp/rev2/src/bin/boardinfo/.objs/boardinfo.o bsp/mp/rev2/lib/libhal.a --end-
group  -o boardinfo -Y/cygdrive/C/QNX630/target/qnx6/armle/lib:/cygdrive/C/QNX630/target/qnx6/armle/usr/lib:/cygdrive/C/
QNX630/target/qnx6/armle/opt/lib -LC:/QNX630/host/win32/x86/usr/lib/gcc/arm-unknown-nto-qnx6.3.0/4.2.3/ -LC:/QNX630/
target/qnx6/armle/lib/gcc/4.2.3 -LC:/QNX630/target/qnx6/usr/arm-unknown-nto-qnx6.3.0/lib/ -LC:/QNX630/target/qnx6/armle/
lib -LC:/QNX630/target/qnx6/armle/usr/lib -LC:/QNX630/target/qnx6/armle/opt/lib -lecpp-ne C:/QNX630/host/win32/x86/usr/
lib/gcc/arm-unknown-nto-qnx6.3.0/4.2.3//libgcc.a -lc -dn -Bstatic -lc C:/QNX630/host/win32/x86/usr/lib/gcc/arm-unknown-
nto-qnx6.3.0/4.2.3//libgcc.a C:/QNX630/target/qnx6/armle/lib/crtend.o C:/QNX630/target/qnx6/armle/lib/crtn.o
Re: 4.2.3 c++ static ctor error: __cxa_guard_acquire / __cxa_guard_release  
Looks like libcxa.a is missing from the qcc conf files. I'll look into why but in the meantime you should be able to 
link with -lcxa

Regards,

Ryan Mansfield
Re: 4.2.3 c++ static ctor error: __cxa_guard_acquire / __cxa_guard_release  

I added the missing -lcxa -lecpp-ne into the 16 places in the c++ conf file and it seems to work.  I am glad it was 
something easy.

Thanks for the prompt assist.

dave