Important: Please read the Qt Code of Conduct -

Error building 4.8.0 from source on Mac OSX Lion

  • OSX 10.7.3 with Xcode 4.2, trying to build Qt 4.8.0 from source using "./configure -arch x86" (I'm stuck in 32-bit because of QTKit/QuickTime APIs I need, and the pre-built Qt libs are 64-bit only). I also tried "./configure -arch x86 -arch x86_64" with the same result.

    The build was going ok for quite some time (over an hour) but then failed at this point. It seems to be a problem linking "libqsqlmysql_debug.dylib" for i386, but I'm not exactly sure.

    Any ideas? Should I update to XCode 4.3 (I've heard its very buggy)? Do I need more options in my Qt configure to get this to work? Thanks!

    g++ -headerpad_max_install_names -arch i386 -single_module -dynamiclib -Xarch_i386 -mmacosx-version-min=10.4 -o libqsqlmysql_debug.dylib .obj/debug-shared/main.o .obj/debug-shared/qsql_mysql.o .obj/debug-shared/moc_qsql_mysql.o -F/Users/jasonlivingston/Downloads/qt-everywhere-opensource-src-4.8.0/lib -L/Users/jasonlivingston/Downloads/qt-everywhere-opensource-src-4.8.0/lib -L/usr/local/mysql/lib -lmysqlclient_r -lpthread -framework QtSql -L/Users/jasonlivingston/Downloads/qt-everywhere-opensource-src-4.8.0/lib -F/Users/jasonlivingston/Downloads/qt-everywhere-opensource-src-4.8.0/lib -framework QtCore
    ld: warning: ignoring file /usr/local/mysql/lib/libmysqlclient_r.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
    Undefined symbols for architecture i386:
    "_mysql_affected_rows", referenced from:
    QMYSQLResult::nextResult() in qsql_mysql.o
    QMYSQLResult::reset(QString const&) in qsql_mysql.o
    ld: symbol(s) not found for architecture i386
    collect2: ld returned 1 exit status
    make[4]: *** [../../../../plugins/sqldrivers/libqsqlmysql_debug.dylib] Error 1
    make[3]: *** [debug-all] Error 2
    make[2]: *** [sub-mysql-make_default] Error 2
    make[1]: *** [sub-sqldrivers-make_default] Error 2
    make: *** [sub-plugins-make_default-ordered] Error 2

  • The error message is quite clear here: You're building Qt for (at least) i386 architecture, but the mysql libs are built for some different architecture(s) (probably x86_64). You need to either get mysql for the needed architecture, or build Qt for the architecture of your mysql installation.

Log in to reply