Commit fec7eeea authored by Joerg Bruehe's avatar Joerg Bruehe

RPMs for ULN do not build in MySQL 5.6: Patches + libmysqld.so

Bug #15972480

This is the change for 5.5:
    a cleanup in the way "libmysqld.so" is created.
(Patches were adapted for 5.5 previously.)

Originally, the ".so" was created by taking all modules in
"libmysqld.a", after removing some few which caused unresolved
references.
This is no good idea, rather "ld" should be used to follow all
references from some few start modules.

At the same time, the ".so" version needed to be corrected:
The original "0.0.1" is both wrong and risky.
Rather, the server version is used to identify the ".so" file,
but for linkage the first two levels are sufficient (so upgrades
are possible without re-building the embedded application).
parent 5bb9adf4
...@@ -508,21 +508,28 @@ mkdir release ...@@ -508,21 +508,28 @@ mkdir release
# TODO / FIXME: Do we need "scriptstub"? # TODO / FIXME: Do we need "scriptstub"?
gcc $CFLAGS $LDFLAGS -o scriptstub "-DLIBDIR=\"%{_libdir}/mysql\"" %{SOURCE4} gcc $CFLAGS $LDFLAGS -o scriptstub "-DLIBDIR=\"%{_libdir}/mysql\"" %{SOURCE4}
# TODO / FIXME: "libmysqld.so" should have been produced above - WORK in PROGRESS # TODO / FIXME: "libmysqld.so" should have been produced above
# regular build will make libmysqld.a but not libmysqld.so :-( # regular build will make libmysqld.a but not libmysqld.so :-(
cd release cd release
mkdir libmysqld/work mkdir libmysqld/work
cd libmysqld/work cd libmysqld/work
ar -x ../libmysqld.a # "libmysqld" provides the same ABI as "libmysqlclient", but it implements the server:
rm rpl_utility.cc.o sql_binlog.cc.o # Try-and-Error: These modules cause unresolved references # The shared object is identified by the full version,
gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.0 -o libmysqld.so.0.0.1 \ # for linkage selection the first two levels are sufficient so that upgrades are possible
*.o \ # (see "man ld", option "-soname").
SO_FULL='%{mysql_version}'
SO_USE=`echo $SO_FULL | sed -e 's/\([0-9]\.[0-9]\)\.[0-9]*/\1/'`
# These two modules should pull everything else which is needed:
ar -x ../libmysqld.a client.c.o signal_handler.cc.o
gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.$SO_USE -o libmysqld.so.$SO_FULL \
*.o ../libmysqld.a \
-lpthread -lcrypt -laio -lnsl -lssl -lcrypto -lz -lrt -lstdc++ -lm -lc -lpthread -lcrypt -laio -lnsl -lssl -lcrypto -lz -lrt -lstdc++ -lm -lc
# this is to check that we built a complete library # this is to check that we built a complete library
cp %{SOURCE9} . cp %{SOURCE9} .
ln -s libmysqld.so.0.0.1 libmysqld.so.0 PROGNAME=`basename %{SOURCE9} .c`
gcc -I../../include -I../../../%{src_dir}/include $CFLAGS mysql-embedded-check.c libmysqld.so.0 ln -s libmysqld.so.$SO_FULL libmysqld.so.$SO_USE
LD_LIBRARY_PATH=. ldd ./a.out gcc -I../../include -I../../../%{src_dir}/include $CFLAGS -o $PROGNAME %{SOURCE9} libmysqld.so.$SO_USE
LD_LIBRARY_PATH=. ldd $PROGNAME
cd ../.. cd ../..
cd .. cd ..
...@@ -618,9 +625,11 @@ mv ${RPM_BUILD_ROOT}%{_bindir}/mysql_config ${RPM_BUILD_ROOT}%{_libdir}/mysql/my ...@@ -618,9 +625,11 @@ mv ${RPM_BUILD_ROOT}%{_bindir}/mysql_config ${RPM_BUILD_ROOT}%{_libdir}/mysql/my
install -m 0755 scriptstub ${RPM_BUILD_ROOT}%{_bindir}/mysql_config install -m 0755 scriptstub ${RPM_BUILD_ROOT}%{_bindir}/mysql_config
rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.a rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.a
install -m 0755 release/libmysqld/work/libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0.0.1 SO_FULL='%{mysql_version}'
ln -s libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0 SO_USE=`echo $SO_FULL | sed -e 's/\([0-9]\.[0-9]\)\.[0-9]*/\1/'`
ln -s libmysqld.so.0 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so install -m 0755 release/libmysqld/work/libmysqld.so.$SO_FULL ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.$SO_FULL
ln -s libmysqld.so.$SO_FULL ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.$SO_USE
ln -s libmysqld.so.$SO_USE ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so
rm -f ${RPM_BUILD_ROOT}%{_bindir}/comp_err rm -f ${RPM_BUILD_ROOT}%{_bindir}/comp_err
rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/comp_err.1* rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/comp_err.1*
...@@ -964,6 +973,12 @@ fi ...@@ -964,6 +973,12 @@ fi
%{_mandir}/man1/mysql_client_test.1* %{_mandir}/man1/mysql_client_test.1*
%changelog %changelog
* Thu Dec 7 2012 Joerg Bruehe <joerg.bruehe@oracle.com>
- Change the way in which "libmysqld.so" is created: Using all object modules
was wrong, gcc / ld can resolve the dependencies from "libmysqld.a".
Also, identify the ".so" version from the MySQL version, "0.0.1" was wrong.
Bug#15972480
* Tue Sep 18 2012 Joerg Bruehe <joerg.bruehe@oracle.com> * Tue Sep 18 2012 Joerg Bruehe <joerg.bruehe@oracle.com>
- Restrict the vendor check to Oracle: There is no history here - Restrict the vendor check to Oracle: There is no history here
which we have to allow for. which we have to allow for.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment