Jump to content

How Mangos find MySQL LIB? | RHEL Compile Error.


Guest nanounico

Recommended Posts

Hello,

Well, After a lot of test, i cant compile fine with latest MySQL 5.1.44 & 5.5.2

Allways the same error, something like can find the mysql libraries.

../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::~DatabaseMysql()':
DatabaseMysql.cpp:(.text+0x385): undefined reference to `mysql_close'
DatabaseMysql.cpp:(.text+0x3a1): undefined reference to `mysql_server_end'
../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::~DatabaseMysql()':
DatabaseMysql.cpp:(.text+0x445): undefined reference to `mysql_close'
DatabaseMysql.cpp:(.text+0x461): undefined reference to `mysql_server_end'
../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::~DatabaseMysql()':
DatabaseMysql.cpp:(.text+0x515): undefined reference to `mysql_close'
DatabaseMysql.cpp:(.text+0x531): undefined reference to `mysql_server_end'
../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::_TransactionCmd(char const*)':
DatabaseMysql.cpp:(.text+0x584): undefined reference to `mysql_query'
DatabaseMysql.cpp:(.text+0x5b0): undefined reference to `mysql_error'
../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::DirectExecute(char const*)':
DatabaseMysql.cpp:(.text+0xba6): undefined reference to `mysql_query'
DatabaseMysql.cpp:(.text+0xbff): undefined reference to `mysql_error'
../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::_Query(char const*, st_mysql_res**, st_mysql_field**, unsigned long*, unsigned int*)':
DatabaseMysql.cpp:(.text+0xcb0): undefined reference to `mysql_query'
DatabaseMysql.cpp:(.text+0xcd7): undefined reference to `mysql_error'
DatabaseMysql.cpp:(.text+0xd3b): undefined reference to `mysql_store_result'
DatabaseMysql.cpp:(.text+0xd4a): undefined reference to `mysql_affected_rows'
DatabaseMysql.cpp:(.text+0xd5e): undefined reference to `mysql_field_count'
DatabaseMysql.cpp:(.text+0xd87): undefined reference to `mysql_fetch_fields'
DatabaseMysql.cpp:(.text+0xda8): undefined reference to `mysql_free_result'
../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::DatabaseMysql()':
DatabaseMysql.cpp:(.text+0xef2): undefined reference to `mysql_server_init'
DatabaseMysql.cpp:(.text+0xef7): undefined reference to `mysql_thread_safe'
../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::DatabaseMysql()':
DatabaseMysql.cpp:(.text+0xfb2): undefined reference to `mysql_server_init'
DatabaseMysql.cpp:(.text+0xfb7): undefined reference to `mysql_thread_safe'
../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::Initialize(char const*)':
DatabaseMysql.cpp:(.text+0x14a7): undefined reference to `mysql_init'
DatabaseMysql.cpp:(.text+0x1584): undefined reference to `mysql_options'
DatabaseMysql.cpp:(.text+0x15be): undefined reference to `mysql_options'
DatabaseMysql.cpp:(.text+0x1603): undefined reference to `mysql_real_connect'
DatabaseMysql.cpp:(.text+0x1635): undefined reference to `mysql_get_client_info'
DatabaseMysql.cpp:(.text+0x165c): undefined reference to `mysql_get_server_info'
DatabaseMysql.cpp:(.text+0x1688): undefined reference to `mysql_autocommit'
DatabaseMysql.cpp:(.text+0x1843): undefined reference to `mysql_error'
DatabaseMysql.cpp:(.text+0x186d): undefined reference to `mysql_close'
../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::escape_string(char*, char const*, unsigned long)':
DatabaseMysql.cpp:(.text+0x134): undefined reference to `mysql_real_escape_string'
../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::ThreadEnd()':
DatabaseMysql.cpp:(.text+0x141): undefined reference to `mysql_thread_end'
../shared/Database/libmangosdatabase.a(DatabaseMysql.o): In function `DatabaseMysql::ThreadStart()':
DatabaseMysql.cpp:(.text+0x151): undefined reference to `mysql_thread_init'
../shared/Database/libmangosdatabase.a(QueryResultMysql.o): In function `QueryResultMysql::EndQuery()':
QueryResultMysql.cpp:(.text+0xd3): undefined reference to `mysql_free_result'
../shared/Database/libmangosdatabase.a(QueryResultMysql.o): In function `QueryResultMysql::~QueryResultMysql()':
QueryResultMysql.cpp:(.text+0x507): undefined reference to `mysql_free_result'
../shared/Database/libmangosdatabase.a(QueryResultMysql.o): In function `QueryResultMysql::NextRow()':
QueryResultMysql.cpp:(.text+0x551): undefined reference to `mysql_fetch_row'
QueryResultMysql.cpp:(.text+0x5e0): undefined reference to `mysql_free_result'
../shared/Database/libmangosdatabase.a(QueryResultMysql.o): In function `QueryResultMysql::~QueryResultMysql()':
QueryResultMysql.cpp:(.text+0x657): undefined reference to `mysql_free_result'
../shared/Database/libmangosdatabase.a(QueryResultMysql.o): In function `QueryResultMysql::~QueryResultMysql()':
QueryResultMysql.cpp:(.text+0x6e7): undefined reference to `mysql_free_result'
../shared/Database/libmangosdatabase.a(SqlDelayThread.o): In function `SqlDelayThread::run()':
SqlDelayThread.cpp:(.text+0x16d): undefined reference to `mysql_thread_init'
SqlDelayThread.cpp:(.text+0x20a): undefined reference to `mysql_thread_end'

I try with some "Solutions"

--with-mysql-libs=
--with-mysql-includes=
export CPPFLAGS=

Nothing work.

Only for testing purposes i try compile with tc, and compile fine.

so, maybe is MaNGOS problem.

TC find MySQL lib with this: (Using cMake)

# - Find MySQL
# Find the MySQL includes and client library
# This module defines
# MYSQL_INCLUDE_DIR, where to find mysql.h
# MYSQL_LIBRARIES, the libraries needed to use MySQL.
# MYSQL_FOUND, If false, do not try to use MySQL.
#
# Copyright (c) 2006, Jaroslaw Staniek, <[email protected]>
# Lot of adustmens by Michal Cihar <[email protected]>
#
# vim: expandtab sw=4 ts=4 sts=4:
#
# Redistribution and use is allowed according to the terms of the BSD license.

MACRO(FIND_MYSQL)
if(UNIX)
set(MYSQL_CONFIG_PREFER_PATH "$ENV{MYSQL_HOME}/bin" CACHE FILEPATH
"preferred path to MySQL (mysql_config)")
find_program(MYSQL_CONFIG mysql_config
${MYSQL_CONFIG_PREFER_PATH}
/usr/local/mysql/bin/
/usr/local/bin/
/usr/bin/
)

if(MYSQL_CONFIG)
message(STATUS "Using mysql-config: ${MYSQL_CONFIG}")
# set INCLUDE_DIR
exec_program(${MYSQL_CONFIG}
ARGS --include
OUTPUT_VARIABLE MY_TMP)

string(REGEX REPLACE "-I([^ ]*)( .*)?" "\\\\1" MY_TMP "${MY_TMP}")

set(MYSQL_ADD_INCLUDE_DIR ${MY_TMP} CACHE FILEPATH INTERNAL)

# set LIBRARY_DIR
exec_program(${MYSQL_CONFIG}
ARGS --libs_r
OUTPUT_VARIABLE MY_TMP)

set(MYSQL_ADD_LIBRARIES "")

string(REGEX MATCHALL "-l[^ ]*" MYSQL_LIB_LIST "${MY_TMP}")
foreach(LIB ${MYSQL_LIB_LIST})
string(REGEX REPLACE "[ ]*-l([^ ]*)" "\\\\1" LIB "${LIB}")
list(APPEND MYSQL_ADD_LIBRARIES "${LIB}")
endforeach(LIB ${MYSQL_LIBS})

set(MYSQL_ADD_LIBRARY_PATH "")

string(REGEX MATCHALL "-L[^ ]*" MYSQL_LIBDIR_LIST "${MY_TMP}")
foreach(LIB ${MYSQL_LIBDIR_LIST})
string(REGEX REPLACE "[ ]*-L([^ ]*)" "\\\\1" LIB "${LIB}")
list(APPEND MYSQL_ADD_LIBRARY_PATH "${LIB}")
endforeach(LIB ${MYSQL_LIBS})

else(MYSQL_CONFIG)
set(MYSQL_ADD_LIBRARIES "")
list(APPEND MYSQL_ADD_LIBRARIES "mysqlclient")
endif(MYSQL_CONFIG)
else(UNIX)
set(MYSQL_ADD_INCLUDE_DIR "c:/msys/local/include" CACHE FILEPATH INTERNAL)
set(MYSQL_ADD_LIBRARY_PATH "c:/msys/local/lib" CACHE FILEPATH INTERNAL)
ENDIF(UNIX)

find_path(MYSQL_INCLUDE_DIR mysql.h
/usr/local/include
/usr/local/include/mysql
/usr/local/mysql/include
/usr/local/mysql/include/mysql
/usr/include
/usr/include/mysql
${MYSQL_ADD_INCLUDE_DIR}
)

set(TMP_MYSQL_LIBRARIES "")

foreach(LIB ${MYSQL_ADD_LIBRARIES})
find_library("MYSQL_LIBRARIES_${LIB}" NAMES ${LIB}
PATHS
${MYSQL_ADD_LIBRARY_PATH}
/usr/lib/mysql
/usr/local/lib
/usr/local/lib/mysql
/usr/local/mysql/lib
)
list(APPEND TMP_MYSQL_LIBRARIES "${MYSQL_LIBRARIES_${LIB}}")
endforeach(LIB ${MYSQL_ADD_LIBRARIES})

set(MYSQL_LIBRARIES ${TMP_MYSQL_LIBRARIES} CACHE FILEPATH INTERNAL)

if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
set(MYSQL_FOUND TRUE CACHE INTERNAL "MySQL found")
message(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
else(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
set(MYSQL_FOUND FALSE CACHE INTERNAL "MySQL found")
message(STATUS "MySQL not found.")
endif(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)

mark_as_advanced(MYSQL_INCLUDE_DIR MYSQL_LIBRARIES)
ENDMACRO(FIND_MYSQL)

So, how i can integrate that for can compile MaNGOS with Make?

Thanks.

Link to comment
Share on other sites

Off course, that is not the problem!

Only happen with latest MySQL, With libmysqlclient.so.16 - libmysqlclient_r.so.16 becose with old mysql, libmysqlclient.so.15 - libmysqlclient_r.so.15 compile fine!

I think the best solution is edit the way MaNGOS find mysql libraries, that no only help me, i think help for future upgrades in MySQL.

Checkout:

Compile Fine

       libmysqlclient_r.so.15 (libc6,x86-64) => /usr/lib64/mysql/libmysqlclient_r.so.15
       libmysqlclient_r.so.15 (libc6) => /usr/lib/mysql/libmysqlclient_r.so.15
       libmysqlclient.so.15 (libc6,x86-64) => /usr/lib64/mysql/libmysqlclient.so.15
       libmysqlclient.so.15 (libc6) => /usr/lib/mysql/libmysqlclient.so.15

Compile Fail

       libmysqlclient_r.so.16 (libc6,x86-64) => /usr/lib64/libmysqlclient_r.so.16
       libmysqlclient_r.so (libc6,x86-64) => /usr/lib64/libmysqlclient_r.so
       libmysqlclient.so.16 (libc6,x86-64) => /usr/lib64/libmysqlclient.so.16
       libmysqlclient.so (libc6,x86-64) => /usr/lib64/libmysqlclient.so

But with the TC way, i can compile without any problem.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use