Problem linking MySQL 4.1.11 via FreeBSD 4.10 ports

Clifton Royston cliftonr at tikitechnologies.com
Tue Apr 19 17:02:41 PDT 2005


  I am having a problem building from ports, which is a fairly rare
experience for me.

  When I try to make the current port of the MySQL 4.1 server under
FreeBSD 4.10, I get a huge stream of "undefined reference" errors at
the link step for mysqld.  It would seem it can't find any
thread-related library references, e.g. `mutex_enter_func', regardless
of which thread library I request.  I started out trying to build with
the default pthreads library, then switched to the Linuxthreads library
as it's supposed to have better performance under 4.x anyway.

  I've checked my environment for a messed up LD_CONFIG_PATH, have
rerun ldconfig (numerous times) and have checked the threads libraries
created using ldd.  I can see the "lthread" library being referenced on
the command line.

Factoids:

 * Running FreeBSD 4.10 on a development-only server (thank goodness.)

 * The ports tree was CVSupped late last week (4/14/2005)

 * Trying to build MySQL version 4.1.11 from /usr/ports/databases/mysql41-server/

 * linuxthreads-2.2.3_16 built and installed yesterday, did not resolve
the problem

 * Problem seen (with different variable names) both with and without
the WITH_LINUXTHREADS=yes parameter to "make".

 * gcc 2.95.4 (system version), libtool-1.5.10_1 (from ports)

 * I've built about 10 other packages from ports into binary packages
in the last few days, with no similar problems.

 * I've tried switching to a regular root shell via su, to make sure
it's not a sudo environment problem, even though my other port makes
work from sudo.

 * I've repeatedly done a "make clean" to make sure that I don't have
configuration cruft.

$ cc -v
Using builtin specs.
gcc version 2.95.4 20020320 [FreeBSD]

$ head -4 /var/run/dmesg.boot | tail -1
FreeBSD 4.10-RELEASE #0: Tue Jun 22 17:01:51 HST 2004

$ head Makefile
# New ports collection makefile for:    MySQL-server
# Date created:                         Fri Apr 11 10:06:26 CET 2003
# Whom:                                 Alex Dupre <sysadmin at alexdupre.com>
#
# $FreeBSD: ports/databases/mysql41-server/Makefile,v 1.206 2005/04/12 03:25:02 obrien Exp $
#

PORTNAME?=      mysql
PORTVERSION=    4.1.11
PORTREVISION?=  1

$ sudo make FORCE_PKG_REGISTER=yes WITH_LINUXTHREADS=yes 
...
Making all in share
/usr/local/bin/libtool15 --preserve-dup-deps --mode=link cc  -DDBUG_OFF  -DNEWSA
LT  -D__USE_UNIX98 -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include/pthread/linu
xthreads -DNEWSALT  -D__USE_UNIX98 -D_REENTRANT -D_THREAD_SAFE -I/usr/local/incl
ude/pthread/linuxthreads -felide-constructors -fno-rtti -fno-exceptions   -fno-i
mplicit-templates -fno-exceptions -fno-rtti -DMYSQLD_NET_RETRY_COUNT=1000000
-o mysqld  sql_lex.o sql_handler.o  item.o item_sum.o item_buff.o  item_func.o i
tem_cmpfunc.o  item_strfunc.o item_timefunc.o  thr_malloc.o item_create.o  item_
subselect.o item_row.o  item_geofunc.o field.o strfunc.o  key.o sql_class.o sql_
list.o  net_serv.o protocol.o sql_state.o  lock.o my_lock.o sql_string.o  sql_ma
nager.o sql_map.o mysqld.o  password.o hash_filo.o hostname.o  set_var.o sql_par
se.o sql_yacc.o  sql_base.o table.o sql_select.o  sql_insert.o sql_prepare.o sql
_error.o  sql_update.o sql_delete.o uniques.o  sql_do.o procedure.o item_uniq.o
 sql_test.o log.o log_event.o  init.o derror.o sql_acl.o  unireg.o des_key_file.
o discover.o  time.o opt_range.o opt_sum.o  records.o filesort.o handler.o  ha_h
eap.o ha_myisam.o ha_myisammrg.o  ha_berkeley.o ha_innodb.o ha_isam.o  ha_isammr
g.o ha_ndbcluster.o sql_db.o  sql_table.o sql_rename.o sql_crypt.o  sql_load.o m
f_iocache.o field_conv.o  sql_show.o sql_udf.o sql_analyse.o  sql_cache.o slave.
o sql_repl.o  sql_union.o sql_derived.o client.o  sql_client.o mini_client_error
s.o  pack.o stacktrace.o repl_failsafe.o  gstream.o spatial.o sql_help.o  protoc
ol_cursor.o tztime.o my_time.o  ha_example.o ha_archive.o ha_tina.o  ha_blackhol
e.o -L../bdb/build_unix -ldb  ../innobase/usr/libusr.a ../innobase/srv/libsrv.a
../innobase/dict/libdict.a ../innobase/que/libque.a ../innobase/srv/libsrv.a ../
innobase/ibuf/libibuf.a ../innobase/row/librow.a ../innobase/pars/libpars.a ../i
nnobase/btr/libbtr.a ../innobase/trx/libtrx.a ../innobase/read/libread.a ../inno
base/usr/libusr.a ../innobase/buf/libbuf.a ../innobase/ibuf/libibuf.a ../innobas
e/eval/libeval.a ../innobase/log/liblog.a ../innobase/fsp/libfsp.a ../innobase/f
ut/libfut.a ../innobase/fil/libfil.a ../innobase/lock/liblock.a ../innobase/mtr/
libmtr.a ../innobase/page/libpage.a ../innobase/rem/librem.a ../innobase/thr/lib
thr.a ../innobase/sync/libsync.a ../innobase/data/libdata.a ../innobase/mach/lib
mach.a ../innobase/ha/libha.a ../innobase/dyn/libdyn.a ../innobase/mem/libmem.a
../innobase/sync/libsync.a ../innobase/ut/libut.a ../innobase/os/libos.a ../inno
base/ut/libut.a     ../myisam/libmyisam.a  ../myisammrg/libmyisammrg.a  ../heap/
libheap.a  ../vio/libvio.a  ../mysys/libmysys.a  ../dbug/libdbug.a  ../regex/lib
regex.a  ../strings/libmystrings.a -lz   -lwrap -DHAVE_GLIBC2_STYLE_GETHOSTBYNAM
E_R -D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads -L/usr/local/lib -l
lthread -llgcc_r -lcrypt -lm  -DHAVE_GLIBC2_STYLE_GETHOSTBYNAME_R -D_THREAD_SAFE
 -I/usr/local/include/pthread/linuxthreads -L/usr/local/lib -llthread -llgcc_r
cc -DDBUG_OFF -DNEWSALT -D__USE_UNIX98 -D_REENTRANT -D_THREAD_SAFE -I/usr/local/
include/pthread/linuxthreads -DNEWSALT -D__USE_UNIX98 -D_REENTRANT -D_THREAD_SAF
E -I/usr/local/include/pthread/linuxthreads -felide-constructors -fno-rtti -fno-
exceptions -fno-implicit-templates -fno-exceptions -fno-rtti -DMYSQLD_NET_RETRY_
COUNT=1000000 -o mysqld sql_lex.o sql_handler.o item.o item_sum.o item_buff.o it
em_func.o item_cmpfunc.o item_strfunc.o item_timefunc.o thr_malloc.o item_create
.o item_subselect.o item_row.o item_geofunc.o field.o strfunc.o key.o sql_class.
o sql_list.o net_serv.o protocol.o sql_state.o lock.o my_lock.o sql_string.o sql
_manager.o sql_map.o mysqld.o password.o hash_filo.o hostname.o set_var.o sql_pa
rse.o sql_yacc.o sql_base.o table.o sql_select.o sql_insert.o sql_prepare.o sql_
error.o sql_update.o sql_delete.o uniques.o sql_do.o procedure.o item_uniq.o sql
_test.o log.o log_event.o init.o derror.o sql_acl.o unireg.o des_key_file.o disc
over.o time.o opt_range.o opt_sum.o records.o filesort.o handler.o ha_heap.o ha_
myisam.o ha_myisammrg.o ha_berkeley.o ha_innodb.o ha_isam.o ha_isammrg.o ha_ndbc
luster.o sql_db.o sql_table.o sql_rename.o sql_crypt.o sql_load.o mf_iocache.o f
ield_conv.o sql_show.o sql_udf.o sql_analyse.o sql_cache.o slave.o sql_repl.o sq
l_union.o sql_derived.o client.o sql_client.o mini_client_errors.o pack.o stackt
race.o repl_failsafe.o gstream.o spatial.o sql_help.o protocol_cursor.o tztime.o
 my_time.o ha_example.o ha_archive.o ha_tina.o ha_blackhole.o -DHAVE_GLIBC2_STYL
E_GETHOSTBYNAME_R -D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads -DHAV
E_GLIBC2_STYLE_GETHOSTBYNAME_R -D_THREAD_SAFE -I/usr/local/include/pthread/linux
threads  -L/usr/ports/databases/mysql41-server/work/mysql-4.1.11/bdb/build_unix
-ldb ../innobase/usr/libusr.a ../innobase/srv/libsrv.a ../innobase/dict/libdict.
a ../innobase/que/libque.a ../innobase/srv/libsrv.a ../innobase/ibuf/libibuf.a .
./innobase/row/librow.a ../innobase/pars/libpars.a ../innobase/btr/libbtr.a ../i
nnobase/trx/libtrx.a ../innobase/read/libread.a ../innobase/usr/libusr.a ../inno
base/buf/libbuf.a ../innobase/ibuf/libibuf.a ../innobase/eval/libeval.a ../innob
ase/log/liblog.a ../innobase/fsp/libfsp.a ../innobase/fut/libfut.a ../innobase/f
il/libfil.a ../innobase/lock/liblock.a ../innobase/mtr/libmtr.a ../innobase/page
/libpage.a ../innobase/rem/librem.a ../innobase/thr/libthr.a ../innobase/sync/li
bsync.a ../innobase/data/libdata.a ../innobase/mach/libmach.a ../innobase/ha/lib
ha.a ../innobase/dyn/libdyn.a ../innobase/mem/libmem.a ../innobase/sync/libsync.
a ../innobase/ut/libut.a ../innobase/os/libos.a ../innobase/ut/libut.a ../myisam
/libmyisam.a ../myisammrg/libmyisammrg.a ../heap/libheap.a ../vio/libvio.a ../my
sys/libmysys.a ../dbug/libdbug.a ../regex/libregex.a ../strings/libmystrings.a -
lz -lwrap -L/usr/local/lib -llthread -llgcc_r -lcrypt -lm -llthread -llgcc_r
../innobase/srv/libsrv.a(srv0srv.o): In function `srv_get_n_threads':
srv0srv.o(.text+0x2a1): undefined reference to `mutex_enter_func'
srv0srv.o(.text+0x2de): undefined reference to `mutex_exit'
../innobase/srv/libsrv.a(srv0srv.o): In function `srv_get_thread_type':
srv0srv.o(.text+0x89a): undefined reference to `mutex_enter_func'
srv0srv.o(.text+0x8e0): undefined reference to `mutex_exit'
../innobase/srv/libsrv.a(srv0srv.o): In function `srv_init':
srv0srv.o(.text+0x90a): undefined reference to `mem_alloc_func'

and then on for page after page of "undefined reference" errors.

  I will be happy to provide more detail if helpful; right now I am
feeling like I must be an idiot and overlooking something obvious, but
can not find the evidence to convict me of that.

  -- Clifton

-- 
          Clifton Royston  --  cliftonr at tikitechnologies.com 
         Tiki Technologies Lead Programmer/Software Architect
"I'm gonna tell my son to grow up pretty as the grass is green
And whip-smart as the English Channel's wide..."
                                            -- 'Whip-Smart', Liz Phair


More information about the freebsd-questions mailing list