Stack protection

Migrating an accounting system from an old Xen 2.0 domain to XenEnterprise means it is also time to upgrade from sarge. Due to changes in available libraries, this required recompiling Leading to issues dealing with a new gcc 4.1 feature:

fastbase@fb:~/tcl/new$ /usr/bin/tclsh fbserver.tcl -setup /home/fastbase/tcl/dat/setup.dat
Cannot connect to MySQL
couldn't load file "./": ./ undefined symbol: <strong>__stack_chk_fail_local</strong>
    while executing
"error "Cannot connect to MySQL\n$connect_error""
    invoked from within
"if {!$connected} {
        error "Cannot connect to MySQL\n$connect_error"
    (file "fbserver.tcl" line 75)

Stack protection is good, but not helpful in this situation. And this was not an easy condition to google, with not specific information. Some items dealt with this, and luckily I managed to figure a solution from some indirect information.

gcc -Wall -fPIC -I/usr/include/mysql -I/usr/include/tcl8.4 <strong>-fno-stack-protector</strong>   -c -o fbsql.o fbsql.c

Unfortunately the developer of this code passed away this year, so I couldn’t ask him to made fbsql.c work with gcc’s stack protection. Hopefully the above helps future google searchers.

Comments are closed.