Bug #57909 mysqld crashes upon startup when linked statically
Submitted: 2 Nov 2010 0:46 Modified: 12 Nov 2010 2:03
Reporter: Matt Blair Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:5.1.50+, 5.5.6-rc OS:Linux (Ubuntu 10.10)
Assigned to: CPU Architecture:Any
Tags: ubuntu

[2 Nov 2010 0:46] Matt Blair
Description:
When compiling MySQL 5.1.51 on Ubuntu 10.10 and linking statically (--with-mysqld-ldflags=-all-static), mysqld crashes immediately upon startup. It works fine on Ubuntu 10.04. I followed the instructions here:

http://dev.mysql.com/doc/refman/5.1/en/using-stack-trace.html

and will attach the output.

How to repeat:
I compiled with the following configure line:

CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static

Suggested fix:
Beats me.
[2 Nov 2010 0:47] Matt Blair
stack trace

Attachment: mysqld (, text), 612 bytes.

[2 Nov 2010 3:48] Alexey Kishkin
Cannot reproduce against 5.1.52  with compile options you provided... In my case I compiled and run statically linked mysql without problem on ubuntu 10.10.

file mysqld
mysqld: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.15, not stripped

101102 13:41:40 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
101102 13:41:40 [Note] Event Scheduler: Loaded 0 events
101102 13:41:40 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.1.52'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
101102 13:42:42 [Note] /usr/local/mysql/libexec/mysqld: Normal shutdown

101102 13:42:42 [Note] Event Scheduler: Purging the queue. 0 events
101102 13:42:42 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete

101102 13:42:42 mysqld_safe mysqld from pid file /usr/local/mysql/var/home.pid ended
[2 Nov 2010 8:20] Valeriy Kravchuk
So, please, check with 5.1.52 that is already released officially.
[6 Nov 2010 13:14] Matt Blair
It's still crashing using 5.1.50-52 (.48 & .49 won't compile due to some do_abi_check issue), and 5.5.6-rc crashes. 5.5.6-rc is giving a bit more information that may be helpful:

101106 12:54:59 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
mysqld: ../sysdeps/unix/sysv/linux/getpagesize.c:32: __getpagesize: Assertion `_rtld_global_ro._dl_pagesize != 0' failed.
101106 12:54:59 - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

This is a fresh Linode 512 running Ubuntu 10.10 32-bit.

dpkg -l | grep libc6-dev
ii  libc6-dev                       2.12.1-0ubuntu8

A 64-bit Linode 512 with 10.10 and 5.1.52 is giving me error 11, with basically the same stack trace that I attached originally. 32-bit is saying error 6 like above.

I'll attach the script I'm using to compile MySQL. The binary that's produced on Ubuntu 10.04 is stable. I'm not using CMake because I can't find an option for static linking.
[6 Nov 2010 13:16] Matt Blair
How I'm compiling MySQL 5.5.6-rc

Attachment: bug.sh (application/x-shellscript, text), 519 bytes.

[6 Nov 2010 13:34] Matt Blair
Better category.
[8 Nov 2010 0:22] Matt Blair
This appears to be a bug in glibc:

http://thread.gmane.org/gmane.comp.lib.glibc.user/579

fixed here in Fedora:

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=26f25ed8b41240e0268e2e...

I've submitted a ticket to Ubuntu:

https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/672352

I'll close this bug once it's confirmed that I'm not off the mark here.
[12 Nov 2010 2:03] Matt Blair
Yep, it's upstream.

http://sourceware.org/bugzilla/show_bug.cgi?id=11929