Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 584458 - dev-qt/qtsql (all versions): libqsqlodbc.so plugin is terribly broken
Summary: dev-qt/qtsql (all versions): libqsqlodbc.so plugin is terribly broken
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Qt Bug Alias
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-29 14:17 UTC by Jesús Guerrero Botella (RETIRED)
Modified: 2016-06-08 14:46 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesús Guerrero Botella (RETIRED) gentoo-dev 2016-05-29 14:17:39 UTC
Hello.

I have been battling with this for nearly one month, and I was about to ditch Qt entirely for this. I was about to get mad.

Fact is, that the libqsqlodbc.so plugins for ALL the Qt versions I tried (4.x, 5.x and even 5.6) are broken badly. I don't know if this could be due to stripping or LDFLAGS or whatever, but they don't work at all.

Let me say that the ODBC connection is correct, and I can use isql, osql, tsql et al, from command line, and query the database without problems.

The plugin loads, but it fails to connect always and this code:

        qDebug() << db.lastError().text();
        qDebug() << db.lastError().driverText();
        qDebug() << db.drivers();

outputs this crap:

"��������������������d����ៀ餅餒夝ᤝ餞够񗼅����嶆����嶇埇埀ퟀ埀ퟀ埀ퟀ埀ퟀ埀ퟀ埀ퟀ埀ퟀ埀ퟀ埀ퟀ埀ퟀ埀ퟀ顀៘񀀂𠄀៬񀀂 QODBC3: Unable to connect" 
"QODBC3: Unable to connect" 
("QSQLITE", "QSQLITE3", "QMYSQL3", "QMYSQL", "QODBC3", "QODBC", "QTDS7", "QTDS") 


Which means something is corrupted in that library. Hell, things are *that* broken which it lowered drastically the quality of my Gentoo install to that of *buntu :lol:

I have been debugging that with the collaboration of another Qt user in this forums:

https://forum.qt.io/topic/67049/qodbc-can-t-connect-yet-another-thread

He packed a 5.6 libqsqlodbc.so file from his install, which I substituted in my system. After creating a link or two in /usr/lib so that it can find all the stuff, my program worked at first attempt without touching a single line of code.

I will try to find the problem and report back, but I guess someone around here might be faster than me.
Comment 1 Jesús Guerrero Botella (RETIRED) gentoo-dev 2016-05-29 15:57:14 UTC
Just tried building the plugin myself from source and copying it over to /usr/lib/qt5/plugins/sqldrivers/ and it works. So, it's definitely portage mangling the build which causes the problem.
Comment 2 Davide Pesavento gentoo-dev 2016-05-31 21:12:14 UTC
Just to clarify, the problem happens only with the QODBC plugin (i.e. USE=odbc), right? The sqlite, mysql, etc.. plugins do not exhibit the same issue..?

Also, please attach your emerge --info.
Comment 3 Davide Pesavento gentoo-dev 2016-05-31 21:31:09 UTC
(In reply to Jesús Guerrero Botella from comment #1)
> Just tried building the plugin myself from source and copying it over to
> /usr/lib/qt5/plugins/sqldrivers/ and it works. So, it's definitely portage
> mangling the build which causes the problem.

The CXXFLAGS/LDFLAGS you used for the manual build are exactly the same used by the portage build?

Are you using dev-db/unixODBC or dev-db/libiodbc? Please run `scanelf -qn` on the libqsqlodbc.so compiled by portage and the one you compiled yourself and report the output.
Comment 4 Jesús Guerrero Botella (RETIRED) gentoo-dev 2016-06-01 14:43:46 UTC
(In reply to Davide Pesavento from comment #2)
> Just to clarify, the problem happens only with the QODBC plugin (i.e.
> USE=odbc), right? The sqlite, mysql, etc.. plugins do not exhibit the same
> issue..?
> 
> Also, please attach your emerge --info.

Just odbc. I have used mysql and sqlite in the past, can't comment on anything else. Both worked fine, always.

It's the first time I have used odbc in qt/linux, but I have tested several qt versions. 4.x, and 5.x, up to 5.6, all from portage.
Comment 5 Jesús Guerrero Botella (RETIRED) gentoo-dev 2016-06-01 14:50:52 UTC
(In reply to Davide Pesavento from comment #3)
> (In reply to Jesús Guerrero Botella from comment #1)
> > Just tried building the plugin myself from source and copying it over to
> > /usr/lib/qt5/plugins/sqldrivers/ and it works. So, it's definitely portage
> > mangling the build which causes the problem.
> 
> The CXXFLAGS/LDFLAGS you used for the manual build are exactly the same used
> by the portage build?

Well, I haven't touched them. I haven't explicitly set LDFLAGS in make.conf, and for CFLAGS I have "-march=native -O2 -pipe", I also have FEATURES="splitdebug", but I also tested with "-splitdebug nostrip", just in case...


> Are you using dev-db/unixODBC or dev-db/libiodbc? Please run `scanelf -qn`
> on the libqsqlodbc.so compiled by portage and the one you compiled yourself
> and report the output.

I have used unixODBC because with iodbc not even the tsql/osql/isql command line tools could connect. Probably my fault, but that's another story. Also, if I enabled both odbc and iodbc for qtsql, then the odbc plugin refused to load, so I emerged qtsql with "-iodbc odbc".

My emerge --info is:
Portage 2.2.28 (python 3.4.3-final-0, default/linux/amd64/13.0, gcc-4.9.3, glibc-2.22-r4, 4.6.0 x86_64)
=================================================================
System uname: Linux-4.6.0-x86_64-Intel-R-_Core-TM-_i5-2520M_CPU_@_2.50GHz-with-gentoo-2.2
KiB Mem:     3926568 total,    156144 free
KiB Swap:    1999996 total,   1916252 free
Timestamp of repository gentoo: Fri, 20 May 2016 14:00:02 +0000
sh bash 4.3_p42-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.10-r1::gentoo, 3.4.3-r1::gentoo
dev-util/cmake:           3.3.1-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.19.1::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r4::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

x11
    location: /var/lib/layman/x11
    masters: gentoo
    priority: 0

pentoo
    location: /var/lib/layman/pentoo
    masters: gentoo
    priority: 1

java
    location: /var/lib/layman/java
    masters: gentoo
    priority: 2

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 3

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=native"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="es_ES.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X aac alsa amd64 branding bzip2 cdda cddb classic cleartype cli consolekit cracklib crypt cups cxx dbus dri dvdr egl exif ffmpeg flac fortran gdbm gif git glamor gles2 gtkstyle iconv icu imlib ipv6 jpeg libkms libnotify lzma lzo mad matroska mmx mmxext modules mp3 mpeg multilib ncurses nls nptl odbc offensive ogg opengl openmp pam pcre pixbuf png policykit python qt3support readline seccomp session sna spell sqlite sse sse2 ssl startup-notification svg tcpd theora threads thunar truetype twolame udev udisks unicode upower vaapi vcd vcdx vdpau vlc vorbis x264 xa xattr xdg xft xml xv xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx sse sse2 sse3 ssse3 mmxext avx sse4_1 sse4_2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="synaptics evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="es es_ES en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21" USERLAND="GNU" VIDEO_CARDS="intel" XFCE_PLUGINS="clock multiload-nandhp brightness battery power" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON




scanelf -qt on the file generated by portage is:

$ scanelf -qn /usr/lib/qt5/plugins/sqldrivers/libqsqlodbc.so.mine 
libodbc.so.2,libQt5Sql.so.5,libQt5Core.so.5,libstdc++.so.6,libm.so.6,libc.so.6  /usr/lib/qt5/plugins/sqldrivers/libqsqlodbc.so.mine

and for the file I compiled using the qt build system from command line is:

$ scanelf -qn /usr/lib/qt5/plugins/sqldrivers/libqsqlodbc.so
libodbc.so.2,libQt5Sql.so.5,libQt5Core.so.5,libstdc++.so.6,libm.so.6,libc.so.6  /usr/lib/qt5/plugins/sqldrivers/libqsqlodbc.so



I also paste the output of the file command:

$ file /usr/lib/qt5/plugins/sqldrivers/libqsqlodbc.so*
/usr/lib/qt5/plugins/sqldrivers/libqsqlodbc.so:      ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
/usr/lib/qt5/plugins/sqldrivers/libqsqlodbc.so.mine: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

This last bit is why I tested the "nostrip" feature. It didn't help, though.

Thank you for all the assistance.
Comment 6 Jesús Guerrero Botella (RETIRED) gentoo-dev 2016-06-01 14:53:00 UTC
I think I forgot to say that I tested many unixODBC and freetds versions, but that also didn't help. There's no reason why it should had anyway, since freetds and unixODBC work from command line, and the libqsqlodbc.so file from "manual qt" also works.

The only piece that has failed, for more than one month of trying crazy things, is the portage generated .so file.
Comment 7 Jesús Guerrero Botella (RETIRED) gentoo-dev 2016-06-03 16:43:38 UTC
This won't contribute to the bug, but it will surely come in handy for anyone who comes here looking for a solution, even if only a temporal one.

After compiling qtsql by hand and puting the .so file there, my qt code worked and I could connect to mssql without problems. I tested a simple update statement and that worked so I let it at there for a couple days until I had some time to continue my work on this.

Then I noticed that no select statement would work. It seems my tds driver wouldn't recognize such intrincated commands, such as "select onefield from onetable". I wonder why, cause from command (tsql, osql, isql) line it works!

But to the point: if you get into this same trouble, keyword and install freetds-1.0. Luckily it got added to portage some days ago. Don't play with protocol versions in freetds.conf, it will do nothing but getting your time wasted.
Comment 8 Jesús Guerrero Botella (RETIRED) gentoo-dev 2016-06-08 14:46:45 UTC
Just letting you all know that this has happened consistently across several installations, all of them amd64 if that matters at all.