问题
I'm trying to test the backward compatibility between QNX 6.6.0 and 6.5.0 (in concequence of an earlier question I've got). I compiled a relatively simple program using SDP6.6.0 and executed it on Neutrino 6.5.0. When I execute the program the follow runtime error pops up:
unknown symbol: __stack_chk_guard
ldd:FATAL: Could not resolve all symbols
What is causing this?..
(I've found the solution but it wasn't working rightaway. When I started writing this question I realized the error I made. For future reference I will provide the solution here as Q&A myself).
回答1:
Since QNX is using gcc (qcc):
"Buffer overflow detection is enabled in the current and newer gcc builds however in some (rare and complex) cases this may result in run time complications such as undefined symbol: __stack_chk_guard
errors. In such cases a possible solution is to disable this feature by adding -fno-stack-protector
to the CFLAG
list used by gcc compilation options" (see also [1] and What is the use of -fno-stack-protector?).
Additionally: I found a forum thread where Ryan Mansfield (QNX compiler lead maintainer, I think) says:
One problem [one] might hit trying to get 6.6.0 binaries to run on 6.5.0, is that everything is built is with
-fstack-protector
, which relies on support in libc. This wasn't in the 6.5.0 libc but IIRC, 6.5.0SP1 added.
Thus, in QNX 6.5.0SP1 this issue seems to be fixed.
来源:https://stackoverflow.com/questions/30535117/qnx-runtime-error-unknown-symbol-stack-chk-guard