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":http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/ 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.
 - 
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 "-=".
 - 
Ok I added macx:CONFIG += x86 to styleitem.pro but the error is still the same.
btw. Thanks for all your help Volker. I'll include you in the credits once I get this to fly.
 - 
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_CONFIGURATION:/Library/Preferences/Qt
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:
@file QtCore
QtCore: Mach-O dynamically linked shared library i386
@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.
 - 
[quote author="Hedge" date="1305379186"]
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.[/quote]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!
 - 
I have the same problem, the version of my Mac is 10.7, and when I compile the same message appears, have tried everything. Do you know any solution?!
Tks,
Tokunaga.
 - 
I decided that....
TKS,
Tokunaga
 - 
Why Wolker??? Do u have a problem???
 - 
[quote author="Tokunaga" date="1320012719"]Why Wolker??? Do u have a problem???[/quote]
Me? No. I think it's you having a problem. At least that's what you stated previously:
[quote author="Tokunaga" date="1319961219"]I have the same problem[/quote]
But it's hard to know what you did decide, though:
[quote author="Tokunaga" date="1319987713"]I decided that....
TKS,
Tokunaga[/quote]
Can you elaborate a bit more precisely?
 - 
Volker
somebody could solve this?
well, if you use a qt 4.7.4 on a Mac 32-bit it really appears, I checked other tutorials and talk to compile gcc libraries.
You know what really needs to be done? anyone have any solution? - 
Do you have msn or something??
my email hxcx_dod@hotmail.com