Undefined symbols for architecture i386 [solved]
I’ve got an old Mac Book Pro running 32 Bit MacOS and want to compile Jens’ desktop-components [labs.qt.nokia.com] with it. Sadly everytime I try to I get the following error:
- Undefined symbols for architecture i386:
- "StylePlugin::registerTypes(char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- "StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- "non-virtual thunk to StylePlugin::registerTypes(char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- "non-virtual thunk to StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- ld: symbol(s) not found for architecture i386
- collect2: ld returned 1 exit status
What can I do about this? This is the only Mac I possess.
15 replies
The object files are missing the 32 bit intel part of a universal binary. You can resolve this by adding this to components/styleitem/styleitem.pro:
- macx:CONFIG += x86
Depending on what architectures you compile for, you might want to add one or more of this too:
- macx:CONFIG += x86_64 # 64 bit intel
- macx:CONFIG += ppc # 32 bit PPC
- macx:CONFIG += ppc64 # 64 bit PPC
- #or combined in one line:
- macx:CONFIG += x86_64 ppc ppc64
If you want to exclude one/more of those architectures, replace “+=” by “-=”.
It shouldn’t harm. I had no problems compiling the plugins for my Qt libs. So this seems to be some weird combo of issues.
Can you give some more details on your environment:
- Qt version?
- SDK or prebuilt binary framework or manually compiled libs?
- Carbon or Cocoa?
- output of “qmake -query”
- output of “file /path/to/your/qt/libs-or-framworks/QtCore.framework/Versions/Current/QtCore (it shows you the architectures Qt is built for)
- output of the compiler run (calling make), at least a snippet, to analyze the actual compiler calls
Qt version 4.7.3, manually compiled (there are no precompiled libs for Mac 32).
I don’t know how to determine whether Carbon or Cocoa is used.
Output of qmake -query
- QT_INSTALL_PREFIX:/usr/local/Trolltech/Qt-4.7.3
- QT_INSTALL_DATA:/usr/local/Trolltech/Qt-4.7.3
- QT_INSTALL_DOCS:/usr/local/Trolltech/Qt-4.7.3/doc
- QT_INSTALL_HEADERS:/usr/local/Trolltech/Qt-4.7.3/include
- QT_INSTALL_LIBS:/usr/local/Trolltech/Qt-4.7.3/lib
- QT_INSTALL_BINS:/usr/local/Trolltech/Qt-4.7.3/bin
- QT_INSTALL_PLUGINS:/usr/local/Trolltech/Qt-4.7.3/plugins
- QT_INSTALL_IMPORTS:/usr/local/Trolltech/Qt-4.7.3/imports
- QT_INSTALL_TRANSLATIONS:/usr/local/Trolltech/Qt-4.7.3/translations
- QT_INSTALL_EXAMPLES:/usr/local/Trolltech/Qt-4.7.3/examples
- QT_INSTALL_DEMOS:/usr/local/Trolltech/Qt-4.7.3/demos
- QMAKE_MKSPECS:/usr/local/Trolltech/Qt-4.7.3/mkspecs
- QMAKE_VERSION:2.01a
- QT_VERSION:4.7.3
Output of file QtCore:
Output of make:
- cd components/ && make -f Makefile
- cd styleitem/ && make -f Makefile
- rm -f libstyleplugin.dylib
- g++ -headerpad_max_install_names -arch i386 -single_module -dynamiclib -o libstyleplugin.dylib tmp/qrangemodel.o tmp/qstyleplugin.o tmp/qdeclarativefolderlistmodel.o tmp/qstyleitem.o tmp/moc_qrangemodel.o tmp/moc_qstyleplugin.o tmp/moc_qdeclarativefolderlistmodel.o tmp/moc_qstyleitem.o -F/usr/local/Trolltech/Qt-4.7.3/lib -L/usr/local/Trolltech/Qt-4.7.3/lib -framework QtDeclarative -L/usr/local/Trolltech/Qt-4.7.3/lib -F/usr/local/Trolltech/Qt-4.7.3/lib -framework QtScript -framework QtCore -framework QtSvg -framework QtGui -framework QtSql -framework QtXmlPatterns -framework QtNetwork
- Undefined symbols for architecture i386:
- "StylePlugin::registerTypes(char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- "StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- "non-virtual thunk to StylePlugin::registerTypes(char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- "non-virtual thunk to StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- ld: symbol(s) not found for architecture i386
- collect2: ld returned 1 exit status
- make[2]: *** [../plugin/libstyleplugin.dylib] Error 1
- make[1]: *** [sub-styleitem-make_default] Error 2
- make: *** [sub-components-make_default] Error 2
Now I’ve got the same shit with a 64 bit Mac but with the error-message:
- symbol(s) not found for architecture x86_64
This is the compile output:
- Undefined symbols for architecture x86_64:
- "StylePlugin::registerTypes(char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- "StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- "non-virtual thunk to StylePlugin::registerTypes(char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- "non-virtual thunk to StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
- vtable for StylePluginin moc_qstyleplugin.o
- ld: symbol(s) not found for architecture x86_64
I added macx:CONFIG += x86_64 to the pro-file but that didn’t change anything.
EDIT: I finally found the reason why building the desktop components failed. For some reason two files of the desktop components were changed (I found out via a simple git status). Now it compiles fine on both Macs.
EDIT: I finally found the reason why building the desktop components failed. For some reason two files of the desktop components were changed (I found out via a simple git status). Now it compiles fine on both Macs.
Ah! Good to know. Could be I cloned the already corrected version from gitorious. Usually Mac environments are not that different :-)
Good luck with your further development!
You must log in to post a reply. Not a member yet? Register here!


