AFAIK, __stack_chk_fail is a standard library function that is run when stack smashing is detected. If a binary is compiled with -fstack-protector, it will just link to it just like printf? So how is undefined reference to symbol '__stack_chk_fail@@GLIBC_2.4'
even possible?
Asked
Active
Viewed 1,347 times
0
-
"is a standard library function". Which standard defines it? – n. m. could be an AI Oct 11 '20 at 19:52
-
1It does not appear in the C18 standard doc - edit - two different languages are tagged! – Weather Vane Oct 11 '20 at 19:52
-
1It's definitely not a standard function, it's a common extension though. – Marco Bonelli Oct 11 '20 at 19:52
-
@n.'pronouns'm. https://code.woboq.org/userspace/glibc/debug/stack_chk_fail.c.html which kind of function is it then? – Oct 11 '20 at 19:53
-
@MarcoBonelli it said nothing about *why* it could be undefined. – Oct 11 '20 at 19:54
-
@Discape really? The first line of the accepted answer is *libgurobi_c++.a was compiled with -fno-stack-protector (obviously)*. In any case, it's impossible to say anything if you just post the error without anything else that might help [reproduce](https://stackoverflow.com/help/minimal-reproducible-example) it. – Marco Bonelli Oct 11 '20 at 19:57
-
It is a non-standard function. That's what kind of function it is. – n. m. could be an AI Oct 11 '20 at 19:59
-
@MarcoBonelli > libgurobi_c++.a was compiled with -fno-stack-protector then why is it trying to reference __stack_chk_fail if it doesn't even have a stack protector. And why would it not be able to be found in glibc? – Oct 11 '20 at 20:01
-
"Why would it not be able to be found in glibc" This question has a very easy answer: because it is not there. Or, at any rate, the *requested version* of the symbol is not there. It may or may not contain an older version. – n. m. could be an AI Oct 11 '20 at 20:03
-
@Discape well, if you are linking a piece of code that was compiled with stack protector with another that was not, then you can get this error.. but that depends. It could also be a version mismatch. – Marco Bonelli Oct 11 '20 at 20:04
-
aight gotcha thanks – Oct 11 '20 at 20:04