This has come up a lot recently. I have several messages in my INBOX where people as asking for my secret recipe for properly building MySQL with LinuxThreads on FreeBSD.

I don't have much time right now to explain how I derived this, but here's the relevant piece of the build script I use at work when producing FreeBSD binaries from the MySQL source tree...

This assumes that you've installed the LinuxThreads package from the ports tree. Sorry for the poor formatting, but this should really be one big line:

CFLAGS='-O -pipe -march=pentiumpro -D__USE_UNIX98                \
-D_REENTRANT -D_THREAD_SAFE -DHAVE_BROKEN_REALPATH               \
-I/usr/local/include/pthread/linuxthreads' CXX=cc                \
CC=cc CXXFLAGS='-O -pipe -march=pentiumpro                       \
-D__USE_UNIX98 -D_REENTRANT -D_THREAD_SAFE                       \
-DHAVE_BROKEN_REALPATH -I/usr/local/include/pthread/linuxthreads \
-felide-constructors -fno-rtti -fno-exceptions' ./configure      \
--with-mit-threads=no '--with-comment=Yahoo SMP'                 \
--enable-assembler --with-innodb                                 \
'--with-named-thread-libs=-DHAVE_GLIBC2_STYLE_GETHOSTBYNAME_R    \
-D_THREAD_SAFE -DHAVE_BROKEN_REALPATH                            \
-I/usr/local/include/pthread/linuxthreads -L/usr/local/lib       \
-llthread -llgcc_r' --prefix=$PREFIX --enable-thread-safe-client \
--with-server-suffix='-Yahoo-SMP' --with-libwrap --with-raid     \
--with-extra-charsets=complex

The HAVE_BROKEN_REALPATH probably isn't necessary anymore, since the configure script should catch that. But it can't hurt to leave in. That's probably true of several options above.

It's ugly, but It Works For Me(tm) on various versions of FreeBSD 4.x.

I do not have access to a FreeBSD 5.0 box yet, so don't ask me about that. I don't know. Really.

Good luck.

Posted by jzawodn at January 23, 2003 03:02 PM

Reader Comments
# habu said:

We tried compile mysql on FreeBSD 4.8 as described here
but for both versions - 3.23 and 4.0 of mysql compilation end with same results:

mysqld.o: In function `main:
mysqld.o(.text+0x1b1c): undefined reference to `my_pthread_setprio
sql_parse.o: In function `dispatch_command(enum_server_command, THD *, char *, unsigned int):
sql_parse.o(.text+0x1808): undefined reference to `my_pthread_setprio
sql_parse.o(.text+0x1861): undefined reference to `my_pthread_setprio
../innobase/os/libos.a(os0thread.o): In function `os_thread_create:
os0thread.o(.text+0xc2): undefined reference to `my_pthread_setprio
*** Error code 1

Function my_pthread_setprio is not included in linux thread library
so I donot know how to compile mysql.

on August 2, 2003 09:14 AM
Disclaimer: The opinions expressed here are mine and mine alone. My current, past, or previous employers are not responsible for what I write here, the comments left by others, or the photos I may share. If you have questions, please contact me. Also, I am not a journalist or reporter. Don't "pitch" me.

 

Privacy: I do not share or publish the email addresses or IP addresses of anyone posting a comment here without consent. However, I do reserve the right to remove comments that are spammy, off-topic, or otherwise unsuitable based on my comment policy. In a few cases, I may leave spammy comments but remove any URLs they contain.