Bug 2371

Summary: QT MYSQL Module does not build when MySQL installed on the host
Product: buildroot Reporter: Paul Jones <paul>
Component: OtherAssignee: Thomas Petazzoni <thomas.petazzoni>
Status: RESOLVED FIXED    
Severity: minor CC: buildroot
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:

Description Paul Jones 2010-08-09 08:15:51 UTC
This is the output I get when trying to build QT for ARM with the mysql module enabled.

InterBase auto-detection... ()
gmake[1]: Entering directory `/media/dev/buildroot-arm/output/build/qt-everywhere-opensource-src-4.6.2/config.tests/unix/ibase'
compiling ibase.cpp
ibase.cpp:42:19: error: ibase.h: No such file or directory
gmake[1]: *** [ibase.o] Error 1
gmake[1]: Leaving directory `/media/dev/buildroot-arm/output/build/qt-everywhere-opensource-src-4.6.2/config.tests/unix/ibase'
InterBase disabled.
MySQL (thread-safe) auto-detection... ()
gmake[1]: Entering directory `/media/dev/buildroot-arm/output/build/qt-everywhere-opensource-src-4.6.2/config.tests/unix/mysql_r'
compiling ../mysql/mysql.cpp
linking mysql_r
/usr/lib64/mysql/libmysqlclient_r.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
gmake[1]: *** [mysql_r] Error 1
gmake[1]: Leaving directory `/media/dev/buildroot-arm/output/build/qt-everywhere-opensource-src-4.6.2/config.tests/unix/mysql_r'
MySQL (thread-safe) disabled.
MySQL (thread-unsafe) auto-detection... ()
gmake[1]: Entering directory `/media/dev/buildroot-arm/output/build/qt-everywhere-opensource-src-4.6.2/config.tests/unix/mysql'
compiling mysql.cpp
linking mysql
/usr/lib64/mysql/libmysqlclient.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
gmake[1]: *** [mysql] Error 1
gmake[1]: Leaving directory `/media/dev/buildroot-arm/output/build/qt-everywhere-opensource-src-4.6.2/config.tests/unix/mysql'
MySQL (thread-unsafe) disabled.
MySQL support cannot be enabled due to functionality tests!
 Turn on verbose messaging (-v) to ./configure to see the final report.
 If you believe this message is in error you may use the continue
 switch (-continue) to ./configure to continue.
make: *** [/media/dev/buildroot-arm/output/build/qt-everywhere-opensource-src-4.6.2/.configured] Error 101
Comment 1 Thomas Petazzoni 2010-08-10 15:44:36 UTC
Which version of Buildroot are you using ?
Comment 2 Paul Jones 2010-08-10 22:47:37 UTC
Latest Git version
Comment 3 Thomas Petazzoni 2010-08-11 09:04:00 UTC
Ok, strange, when MySQL is enabled we give Qt a set of custom CFLAGS/LDFLAGS so it shouldn't be looking at the host versions.

What distro are you using ? Which MySQL-related packages are installed on your host ? (here on my Ubuntu system, the libmysqlclient.so file is not in the same directory as you).

Can you turn on the -v switch for Qt configure step ? I.e, something like:

diff --git a/package/qt/qt.mk b/package/qt/qt.mk
index baf6539..8ab70ac 100644
--- a/package/qt/qt.mk
+++ b/package/qt/qt.mk
@@ -503,7 +503,7 @@ endif
                PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
                PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig:$(PKG_CONFIG_PATH)" \
                ./configure \
-               $(if $(VERBOSE),-verbose,-silent) \
+               -verbose \
                -force-pkg-config \
                -embedded $(BR2_PACKAGE_QT_EMB_PLATFORM) \
                $(QT_QCONFIG_COMMAND) \
Comment 4 Paul Jones 2010-08-12 11:37:16 UTC
The output from before was with the -v option enabled.

I just tried compiling on another near identical machine also running Gentoo and I didn't get the error, so I assume it must just be something amiss on this machine. I'll keep looking, everything else compiles fine.
Comment 5 Paul Jones 2010-08-13 10:21:54 UTC
I had the MYSQL server installed on the host, uninstalling that fixed the problem. I also had it installed on the other computer but it still worked. Seems like a path search order issue or something?
Comment 6 Thomas Petazzoni 2010-08-13 14:20:59 UTC
Ok. However, even if MySQL is installed on the host, we should be able to work properly. The Qt configure output is not verbose enough to understand what's going on, we'd need the full link command line. Could you have a look at Qt ./configure and config.tests/unix/compile.test to see how more information could be shown ?

For the record, on which distro (and version) and with which packages installed exactly the problem was happening ?

Thanks!
Comment 7 Thomas Petazzoni 2010-08-22 05:43:00 UTC
Paul, could you provide some details about which distro, version and install set of packages was causing problems ? I'd like to reproduce the problem here. Thanks!
Comment 8 Paul Jones 2010-08-22 10:13:49 UTC
Sorry for the delay.

Distro is Gentoo on x86_64 with mysql server + client installed.
Buildroot is latest git, using both internal or external crosstool-ng uClibc toolchain (one at a time though...)
Problem occurs with QTe version 4.6.2 and 4.6.3

This is the output from config.tests/mysql

peejay@desktop /media/dev/buildroot-arm/output/build/qt-everywhere-opensource-src-4.6.3/config.tests/unix/mysql $ make -n
echo compiling mysql.cpp && /media/dev/buildroot-arm/output/staging/usr/bin/arm-unknown-linux-uclibcgnueabi-g++ --sysroot=/media/dev/buildroot-arm/output/staging -c -pipe -O2 -mtune=arm920t -march=armv4t -mabi=aapcs-linux -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I/media/dev/buildroot-arm/output/staging/usr/include -I/media/dev/buildroot-arm/output/staging/include -O2 -Wall -W  -I../../../mkspecs/qws/linux-arm-g++ -I. -I/usr/include/mysql -I/media/dev/buildroot-arm/output/staging/usr/include/mysql -o mysql.o mysql.cpp
echo linking mysql && /media/dev/buildroot-arm/output/staging/usr/bin/arm-unknown-linux-uclibcgnueabi-g++ --sysroot=/media/dev/buildroot-arm/output/staging -L/media/dev/buildroot-arm/output/staging/lib -L/media/dev/buildroot-arm/output/staging/usr/lib -Wl,-O1 -o mysql mysql.o     -L/usr/lib64/mysql -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto -L/media/dev/buildroot-arm/output/staging/usr/lib/mysql -lmysqlclient 
peejay@desktop /media/dev/buildroot-arm/output/build/qt-everywhere-opensource-src-4.6.3/config.tests/unix/mysql $ make
compiling mysql.cpp
linking mysql
/usr/lib64/mysql/libmysqlclient.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make: *** [mysql] Error 1
Comment 9 Thomas Petazzoni 2010-12-22 13:07:43 UTC
Fix sent to the Buildroot list.
Comment 10 Peter Korsgaard 2010-12-22 21:10:19 UTC
Fixed by Thomas in git, thanks.