Compiling of version 0.6.2 fails on OpenIndiana

Bug #1382505 reported by Predrag Zecevic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Data Dumper
Fix Released
Undecided
Unassigned

Bug Description

Hi,

is it possible to get this nice tool compiled on OpenIndiana (OI, http://wiki.openindiana.org) OS?

To make situation clean, I have compiled (for test purposes) MySQL myself, using GCC:

$ gcc --version
gcc (GCC) 4.8.3
...

MySQL has been compiled (http://dev.mysql.com/doc/internals/en/building-with-cmake.html) with following commands (bash):

$ export MY_ARCH=32
$ export MY_PREFIX=/opt/MySQL/5.6.21_${MY_ARCH}

$ mkdir bld && cd bld
$ CFLAGS="-m${MY_ARCH} -lsocket -O3" CXXFLAGS="-m${MY_ARCH} -lsocket" LDFLAGS="-m${MY_ARCH}" PKG_CONFIG_PATH="/usr/lib/pkgconfig" cmake .. -DCMAKE_INSTALL_PREFIX=${MY_PREFIX} -DSYSCONFDIR=${MY_PREFIX}/etc -DDTRACE=off

Compilation went fine and MySQL was installed to /opt/MySQL/5.6.21_32 directory.
To make 32bit version default, I have created symbolic link: (cd /opt/MySQL && ln -s 5.6.21_32 5.6)

Now:
$ which /opt/MySQL/5.6/bin/mysql
/opt/MySQL/5.6/bin/mysql
$ mysql --version
mysql Ver 14.14 Distrib 5.6.21, for solaris11 (i386) using EditLine wrapper

mydumper was unpacked from mydumper-0.6.2.tar.gz
$ mkdir bld && cd bld

$ cmake .. -DMYSQL_LIBRARIES_mysqlclient_r=/opt/MySQL/5.6/lib/libmysqlclient_r.so
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Using mysql-config: /opt/MySQL/5.6/bin/mysql_config
-- Found MySQL: /opt/MySQL/5.6/include, /opt/MySQL/5.6/lib/libmysqlclient_r.so;/usr/lib/libthread.so;/usr/lib/libsocket.so;/usr/lib/libnsl.so;/usr/lib/libm.so
-- Found ZLIB: /usr/lib/libz.so (found version "1.2.8")
-- checking for one of the modules 'glib-2.0'
-- checking for one of the modules 'gthread-2.0'
-- checking for module 'libpcre'
-- found libpcre, version 8.21
-- Found PCRE: /usr/include/pcre

CMake Warning at docs/CMakeLists.txt:9 (message):
  Unable to find Sphinx documentation generator

-- ------------------------------------------------
-- MYSQL_CONFIG = /opt/MySQL/5.6/bin/mysql_config
-- CMAKE_INSTALL_PREFIX = /usr/local
-- BUILD_DOCS = ON
-- WITH_BINLOG = OFF
-- RUN_CPPCHECK = OFF
-- Change a values with: cmake -D<Variable>=<Value>
-- ------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /export/NoBackup/Build/mydumper-0.6.2/bld

$ gmake
Scanning dependencies of target mydumper
[ 25%] Building C object CMakeFiles/mydumper.dir/mydumper.c.o
[ 50%] Building C object CMakeFiles/mydumper.dir/server_detect.c.o
[ 75%] Building C object CMakeFiles/mydumper.dir/g_unix_signal.c.o
Linking C executable mydumper
Undefined first referenced
 symbol in file
operator new[](unsigned int) /opt/MySQL/5.6/lib/libmysqlclient_r.so
operator new(unsigned int) /opt/MySQL/5.6/lib/libmysqlclient_r.so
vtable for __cxxabiv1::__si_class_type_info /opt/MySQL/5.6/lib/libmysqlclient_r.so
operator delete[](void*) /opt/MySQL/5.6/lib/libmysqlclient_r.so
operator delete(void*) /opt/MySQL/5.6/lib/libmysqlclient_r.so
std::terminate() /opt/MySQL/5.6/lib/libmysqlclient_r.so
vtable for __cxxabiv1::__vmi_class_type_info /opt/MySQL/5.6/lib/libmysqlclient_r.so
vtable for __cxxabiv1::__class_type_info /opt/MySQL/5.6/lib/libmysqlclient_r.so
__gxx_personality_v0 /opt/MySQL/5.6/lib/libmysqlclient_r.so
__cxa_pure_virtual /opt/MySQL/5.6/lib/libmysqlclient_r.so
ld: fatal: symbol referencing errors. No output written to mydumper
collect2: error: ld returned 1 exit status
gmake[2]: *** [mydumper] Error 1
gmake[1]: *** [CMakeFiles/mydumper.dir/all] Error 2
gmake: *** [all] Error 2

I am stuck. Do you have any idea?

Best regards.

Tags: openindiana
description: updated
description: updated
Revision history for this message
Predrag Zecevic (predrag-zecevic-5) wrote :

Hi all,

I have made some progress (hint form http://stackoverflow.com/a/203550). So, compilation has been tried with:

$ pwd
mydumper-0.6.2/bld

$ rm -rf *

$ export LDFLAGS="-lstdc++ -m32"
$ export CFLAGS="-m32"
$ export CXXFLAGS="-m32"

$ cmake .. -DCMAKE_INSTALL_PREFIX=/opt/SFW \
         -DMYSQL_INCLUDE_DIR=/opt/MySQL/5.6/include \
         -DMYSQL_ADD_LIBRARY_PATH=/opt/MySQL/5.6/lib \
         -DMYSQL_LIBRARIES=/opt/MySQL/5.6/lib/libmysqlclient_r.so

....

$ gmake
Scanning dependencies of target mydumper
[ 16%] Building C object CMakeFiles/mydumper.dir/mydumper.c.o
[ 33%] Building C object CMakeFiles/mydumper.dir/server_detect.c.o
[ 50%] Building C object CMakeFiles/mydumper.dir/g_unix_signal.c.o
Linking C executable mydumper
Undefined first referenced
 symbol in file
ceilf CMakeFiles/mydumper.dir/mydumper.c.o (symbol belongs to implicit dependency /lib/libm.so.2)
ld: fatal: symbol referencing errors. No output written to mydumper
collect2: error: ld returned 1 exit status
gmake[2]: *** [mydumper] Error 1
gmake[1]: *** [CMakeFiles/mydumper.dir/all] Error 2
gmake: *** [all] Error 2

So, only small thing has left.

Regards.

Revision history for this message
Predrag Zecevic (predrag-zecevic-5) wrote :

And (after googling a bit), i have found solution - added 'libm' for compiler and linker, so created this shell to compile:

---8<---
#!/bin/bash
rm -rf *

export MYSQL_HOME=/opt/MySQL/5.6
export PREFIX=/opt/SFW
export LDFLAGS="-lm -m32 -R${PREFIX}/lib -L${PREFIX}/lib -R${MYSQL_HOME}/lib -L${MYSQL_HOME}/lib -lstdc++"
export CFLAGS="-lm -m32 -I${PREFIX}/includei -I${MYSQL_HOME}/include"
export CXXFLAGS="-lm -m32 -I${PREFIX}/includei -I${MYSQL_HOME}/include"

cmake .. -DCMAKE_INSTALL_PREFIX=${PREFIX} \
         -DMYSQL_INCLUDE_DIR=${MYSQL_HOME}/include \
         -DMYSQL_LIBRARIES=${MYSQL_HOME}/lib/libmysqlclient_r.so

gmake

echo "pfexec gmake install"
---8<---

Call in it:
$ bash ../build.sh
...
...
-- ------------------------------------------------
-- MYSQL_CONFIG = /opt/MySQL/5.6/bin/mysql_config
-- CMAKE_INSTALL_PREFIX = /opt/SFW
-- BUILD_DOCS = ON
-- WITH_BINLOG = OFF
-- RUN_CPPCHECK = OFF
-- Change a values with: cmake -D<Variable>=<Value>
-- ------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /export/NoBackup/Build/mydumper-0.6.2/bld
Scanning dependencies of target mydumper
[ 16%] Building C object CMakeFiles/mydumper.dir/mydumper.c.o
[ 33%] Building C object CMakeFiles/mydumper.dir/server_detect.c.o
[ 50%] Building C object CMakeFiles/mydumper.dir/g_unix_signal.c.o
Linking C executable mydumper
[ 50%] Built target mydumper
Scanning dependencies of target myloader
[ 66%] Building C object CMakeFiles/myloader.dir/myloader.c.o
Linking C executable myloader
[ 66%] Built target myloader
Scanning dependencies of target doc_sources
[ 66%] Built target doc_sources
Scanning dependencies of target doc_html
[ 66%] Building HTML documentation with Sphinx
[ 83%] Built target doc_html
Scanning dependencies of target doc_man
[ 83%] Building manual page with Sphinx
[100%] Built target doc_man

$ pfexec gmake install
pfexec gmake install
[ 50%] Built target mydumper
[ 66%] Built target myloader
[ 66%] Built target doc_sources
[ 66%] Building HTML documentation with Sphinx
[ 83%] Built target doc_html
[ 83%] Building manual page with Sphinx
[100%] Built target doc_man
Install the project...
-- Install configuration: ""
-- Installing: /opt/SFW/bin/mydumper
-- Removed runtime path from "/opt/SFW/bin/mydumper"
-- Installing: /opt/SFW/bin/myloader
-- Removed runtime path from "/opt/SFW/bin/myloader"
-- Installing: /opt/SFW/share/doc/mydumper
...
-- Installing: /opt/SFW/share/man/man1/mydumper.1
-- Installing: /opt/SFW/share/man/man1/myloader.1

BUT, when I try to run it:

$ ydumper --help
ld.so.1: mydumper: fatal: libmysqlclient.so.18: open failed: No such file or directory
Killed
predrag_zecevic@solarix /export/NoBackup/Build/mydumper-0.6.2/bld

And THIS works:

$ LD_LIBRARY_PATH=:/opt/SFW/lib:/opt/MySQL/5.6/lib mydumper --help
Usage:
  mydumper [OPTION...] multi-threaded MySQL dumping

Help Options:
  -?, --help Show help options

Application Options:
  -B, --database Database to dump
...

So, how to make binary to 'recall' libraries?

Regards.

Revision history for this message
Predrag Zecevic (predrag-zecevic-5) wrote :

Hi,

any idea on this?

Usually when I have something like this:

$ export LDFLAGS="-lm -m32 -R${PREFIX}/lib -L${PREFIX}/lib -R${MYSQL_HOME}/lib -L${MYSQL_HOME}/lib -lstdc++"

Compiled binary looks fro libs marked with '-R' switch w/o need to modify linker path/cache (/var/ld/ld.config in this case)

Regards.

Revision history for this message
Predrag Zecevic (predrag-zecevic-5) wrote :

I am using it like described in last comment, compilation passed w/o problems (see above)

Revision history for this message
Predrag Zecevic (predrag-zecevic-5) wrote :

Another note:

Compiling against MySQL 5.7 fails, because it does not delivers "libmysqlclient_r" anymore (latest tested mydumper version is 0.9.2)

Thanks for this nice tool :-)
With best regards.

Changed in mydumper:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.