When starting akonadiserver, I got this message: akonadiserver: relocation error: /usr/qt4/plugins/sqldrivers/libqsqlmysql.so: symbol mysql_real_connect, version libmysqlclient_16 not defined in file libmysqlclient.so.18 with link time reference When recompiling mariadb-10.1.11 with binutils-2.25.1, the problem disappears. A git bisect shows that https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=422f11824b3abf6c71042e2ee3aed572f250fc89 is the first bad commit. binutils-2.26 with this commit reverted does not exhibit the problem.
Please try users/hjl/pr19553/binutils-2_26-branch branch.
The problem stills there or I made a mistake with git (my knowledge of git is quite limited). I used git like this: git clone git://sourceware.org/git/binutils-gdb.git git checkout users/hjl/pr19553/binutils-2_26-branch and building the same way like when I was bisecting.
Please provide all linker input files and command line options used to build libqsqlmysql.so.
(In reply to H.J. Lu from comment #3) > Please provide all linker input files and command line options used to > build libqsqlmysql.so. This is the command line that build libqsqlmysql.so: g++ -Wl,-rpath-link,/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src-4.8.7/lib -Wl,-O1 -Wl,-rpath,/usr/qt4/lib -Wl,-rpath,/usr/qt4/lib -shared -o libqsqlmysql.so .obj/release-shared/main.o .obj/release-shared/qsql_mysql.o .obj/release-shared/moc_qsql_mysql.o -L/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src-4.8.7/lib -L/usr/lib -lmysqlclient -lz -lm -ldl -lssl -lcrypto -lQtSql -L/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src-4.8.7/lib -lQtCore -lpthread Can you tell me what should I do for "provide all linker input files"? For bisecting, I rebuild binutils and mariadb, not QT.
(In reply to dura from comment #4) > (In reply to H.J. Lu from comment #3) > > Please provide all linker input files and command line options used to > > build libqsqlmysql.so. > > This is the command line that build libqsqlmysql.so: > g++ > -Wl,-rpath-link,/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere- > opensource-src-4.8.7/lib -Wl,-O1 -Wl,-rpath,/usr/qt4/lib > -Wl,-rpath,/usr/qt4/lib -shared -o libqsqlmysql.so > .obj/release-shared/main.o .obj/release-shared/qsql_mysql.o > .obj/release-shared/moc_qsql_mysql.o > -L/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src- > 4.8.7/lib -L/usr/lib -lmysqlclient -lz -lm -ldl -lssl -lcrypto -lQtSql > -L/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src- > 4.8.7/lib -lQtCore -lpthread > > Can you tell me what should I do for "provide all linker input files"? These aren't linker command line options. You should add "-v" to show the command line options passed to linker. I need all files passed to linker as inputs, including .o, .a and .so files. You can verify that by putting all them in a directory and passing to ld: # ld ........................... with the same order shown by "g++ -v".
Created attachment 9022 [details] linker input files for libqsqlmysql.so
This is what adding -v to g++ command line give me: g++ -v -Wl,-rpath-link,/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src-4.8.7/lib -Wl,-O1 -Wl,-rpath,/usr/qt4/lib -Wl,-rpath,/usr/qt4/lib -shared -o libqsqlmysql.so .obj/release-shared/main.o .obj/release-shared/qsql_mysql.o .obj/release-shared/moc_qsql_mysql.o -L/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src-4.8.7/lib -L/usr/lib -lmysqlclient -lz -lm -ldl -lssl -lcrypto -lQtSql -L/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src-4.8.7/lib -lQtCore -lpthread Reading specs from /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/specs COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --disable-static --disable-multilib --with-native-system-header-dir=/usr/include --with-local-prefix=/usr/local --prefix=/usr --enable-languages=c,c++ --disable-multilib --disable-bootstrap --with-cloog --enable-cloog-backend=isl --with-system-zlib Thread model: posix gcc version 5.3.0 (GCC) COMPILER_PATH=/usr/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/:/usr/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/:/usr/libexec/gcc/x86_64-unknown-linux-gnu/:/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/:/usr/lib/gcc/x86_64-unknown-linux-gnu/ LIBRARY_PATH=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/:/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-shared' '-o' 'libqsqlmysql.so' '-L/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src-4.8.7/lib' '-L/usr/lib' '-L/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src-4.8.7/lib' '-shared-libgcc' '-mtune=nehalem' '-march=nehalem' /usr/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/collect2 -plugin /usr/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccIMdc7u.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -shared -o libqsqlmysql.so /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/crti.o /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/crtbeginS.o -L/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src-4.8.7/lib -L/usr/lib -L/bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src-4.8.7/lib -L/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0 -L/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../.. -rpath-link /bsources/qt-everywhere-opensource-src-4.8.7/qt-everywhere-opensource-src-4.8.7/lib -O1 -rpath /usr/qt4/lib -rpath /usr/qt4/lib .obj/release-shared/main.o .obj/release-shared/qsql_mysql.o .obj/release-shared/moc_qsql_mysql.o -lmysqlclient -lz -ldl -lssl -lcrypto -lQtSql -lQtCore -lpthread -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/crtendS.o /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/crtn.o I used this command to test the contents of the archive: ld -nostdlib -o libqsqlmysql.so crti.o crtbeginS.o .obj/release-shared/main.o .obj/release-shared/qsql_mysql.o .obj/release-shared/moc_qsql_mysql.o -L. -lmysqlclient -lz -ldl -lssl -lcrypto -lQtSql -lQtCore -lpthread -lstdc++ -lm -lgcc_s -lc -lgcc_s -lgthread -lglib-2 -lrt -lpcre crtendS.o crtn.o -shared
How was libmysqlclient.so built? I saw: 78: 00000000000296d0 0 FUNC GLOBAL DEFAULT 11 mysql_real_connect@@libmysqlclient_16 229: 00000000000296d0 3522 FUNC GLOBAL DEFAULT 11 mysql_real_connect@@libmysqlclient_18 331: 000000000002b7d0 187 FUNC GLOBAL DEFAULT 11 There can't be 2 default version for mysql_real_connect, one is mysql_real_connect@@libmysqlclient_16 and the other is mysql_real_connect_cont@@libmysqlclient_18 My libmysqlclient.so has 538: 000000000002d020 0 FUNC GLOBAL DEFAULT 12 mysql_real_connect@libmysqlclient_16 539: 000000000002d020 4406 FUNC GLOBAL DEFAULT 12 mysql_real_connect@@libmysqlclient_18 574: 000000000002f830 216 FUNC GLOBAL DEFAULT 12 mysql_real_connect@@libmysqlclient_18 is default and mysql_real_connect@libmysqlclient_16 isn't. The difference is @@libmysqlclient_16 vs @libmysqlclient_16.
Please double check that libmysqlclient.so was built using a linker with PR 19073 fixed.
libmysqlclient.so in the tarball was built with command line in comment #7 and binutils 2.26 commit 422f11824b3abf6c71042e2ee3aed572f250fc89 reversed, so as a consequence, without PR 19073 which is a correction for this commit. All my produced libmysqlclient.so with binutils 2.26 show mysql_real_connect@@libmysqlclient_16 and mysql_real_connect_cont@@libmysqlclient_18 with or without 422f11824b3abf6c71042e2ee3aed572f250fc89 reversed as a result of "readelf --symbols libmysqlclient.so"
(In reply to dura from comment #10) > libmysqlclient.so in the tarball was built with command line in comment #7 > and binutils 2.26 commit 422f11824b3abf6c71042e2ee3aed572f250fc89 reversed, > so as a consequence, without PR 19073 which is a correction for this commit. > > All my produced libmysqlclient.so with binutils 2.26 show > mysql_real_connect@@libmysqlclient_16 and > mysql_real_connect_cont@@libmysqlclient_18 with or without > 422f11824b3abf6c71042e2ee3aed572f250fc89 reversed as a result of "readelf > --symbols libmysqlclient.so" Please provide all linker input files for creating libmysqlclient.so.
(In reply to H.J. Lu from comment #11) > (In reply to dura from comment #10) > > libmysqlclient.so in the tarball was built with command line in comment #7 > > and binutils 2.26 commit 422f11824b3abf6c71042e2ee3aed572f250fc89 reversed, > > so as a consequence, without PR 19073 which is a correction for this commit. > > > > All my produced libmysqlclient.so with binutils 2.26 show > > mysql_real_connect@@libmysqlclient_16 and > > mysql_real_connect_cont@@libmysqlclient_18 with or without > > 422f11824b3abf6c71042e2ee3aed572f250fc89 reversed as a result of "readelf > > --symbols libmysqlclient.so" > > Please provide all linker input files for creating libmysqlclient.so. I also need linker command line options for creating libmysqlclient.so.
Created attachment 9027 [details] linker input files for libmysqlclient.so
This is the linker command line as shown by g++ -v: /usr/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/collect2 -plugin /usr/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccYF735e.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -shared -o libmysqlclient.so.18.0.0 -s -s /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/crti.o /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/crtbeginS.o -L/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0 -L/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../.. -z relro -z now --no-undefined --no-undefined /bsources2/mariadb-10.1.11/build/libmysql/libmysql_versions.ld -soname libmysqlclient.so.18 CMakeFiles/libmysql.dir/libmysql_exports_file.cc.o -lpthread libclientlib.a ../dbug/libdbug.a ../strings/libstrings.a ../vio/libvio.a ../mysys/libmysys.a ../mysys_ssl/libmysys_ssl.a -lz -lssl -lcrypto -ldl -ldl ../dbug/libdbug.a ../mysys/libmysys.a ../mysys_ssl/libmysys_ssl.a -lz ../strings/libstrings.a -lssl -lcrypto -ldl -lpthread -lstdc++ -lm -lgcc_s -lc -lgcc_s /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/crtendS.o /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/crtn.o I used strace to find out all files used by the linker.
A simple testcase: [hjl@gnu-6 pr19698]$ cat foo.c void foo () { } [hjl@gnu-6 pr19698]$ cat foo.v "foo@VERS.1" = foo; VERSION { VERS.2 { global: foo; }; VERS.1 { }; } [hjl@gnu-6 pr19698]$ make readelf --dyn-syms libfoo.so | grep foo 2: 00000000000002b4 0 FUNC GLOBAL DEFAULT 6 foo@@VERS.1 5: 00000000000002b4 7 FUNC GLOBAL DEFAULT 6 foo@@VERS.2 [hjl@gnu-6 pr19698]$
[hjl@gnu-6 pr19698]$ make libfoo.so gcc -c -o foo.o foo.c ./ld -o libfoo.so -shared foo.v foo.o [hjl@gnu-6 pr19698]$
Please try https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=5f0e933d5c1f9667ef83e5d1bd62bc350c04191a
I can confirm that building mariadb with binutils-2.26, with your patch and without 422f11824b3abf6c71042e2ee3aed572f250fc89422f11824b3abf6c71042e2ee3aed572f250fc89 reversed produce a libmysqlclient.so that does not show double default mysql_real_connect and is usable by akonadiserver.
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0f550b3df1d4ae31d12505cf93981313c9c6dd25 commit 0f550b3df1d4ae31d12505cf93981313c9c6dd25 Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Feb 24 15:13:35 2016 -0800 Update symbol version for symbol from linker script We need to update symbol version for symbols from linker script. bfd/ PR ld/19698 * elflink.c (bfd_elf_record_link_assignment): Set versioned if symbol version is unknown. ld/ PR ld/19698 * testsuite/ld-elf/pr19698.d: New file. * testsuite/ld-elf/pr19698.s: Likewise. * testsuite/ld-elf/pr19698.t: Likewise.
*** Bug 19724 has been marked as a duplicate of this bug. ***
The binutils-2_26-branch branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=544ddf9322b1b83982e5cb84a54d084ee7e718ea commit 544ddf9322b1b83982e5cb84a54d084ee7e718ea Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Feb 24 15:13:35 2016 -0800 Update symbol version for symbol from linker script We need to update symbol version for symbols from linker script. Backport from master bfd/ PR ld/19698 * elflink.c (bfd_elf_record_link_assignment): Set versioned if symbol version is unknown. ld/ PR ld/19698 * testsuite/ld-elf/pr19698.d: New file. * testsuite/ld-elf/pr19698.s: Likewise. * testsuite/ld-elf/pr19698.t: Likewise.
Fixed for trunk and 2.26 branch.