May 12, 2011

Hedge Hedge
Lab Rat
191 posts

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:

  1. Undefined symbols for architecture i386:
  2.   "StylePlugin::registerTypes(char const*)", referenced from:
  3.       vtable for StylePluginin moc_qstyleplugin.o
  4.   "StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
  5.       vtable for StylePluginin moc_qstyleplugin.o
  6.   "non-virtual thunk to StylePlugin::registerTypes(char const*)", referenced from:
  7.       vtable for StylePluginin moc_qstyleplugin.o
  8.   "non-virtual thunk to StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
  9.       vtable for StylePluginin moc_qstyleplugin.o
  10. ld: symbol(s) not found for architecture i386
  11. collect2: ld returned 1 exit status

What can I do about this? This is the only Mac I possess.

15 replies

May 12, 2011

Volker Volker
Ant Farmer
5428 posts

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:

  1. macx:CONFIG += x86

Depending on what architectures you compile for, you might want to add one or more of this too:

  1. macx:CONFIG += x86_64 # 64 bit intel
  2. macx:CONFIG += ppc      # 32 bit PPC
  3. macx:CONFIG += ppc64   # 64 bit PPC
  4.  
  5. #or combined in one line:
  6. macx:CONFIG += x86_64 ppc ppc64

If you want to exclude one/more of those architectures, replace “+=” by “-=”.

May 12, 2011

Hedge Hedge
Lab Rat
191 posts

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.

May 12, 2011

Volker Volker
Ant Farmer
5428 posts

You should do this combo:

  1. make clean
  2. qmake
  3. make
  4. make install # if needed

The makefiles do not catch up the change to the .pro and thus the libs are not rebuilt.

May 12, 2011

Hedge Hedge
Lab Rat
191 posts

I did it and keep getting the same error while doing make.
styleitem is a nested project.
Do I have to add the macx:CONFIG += x86 line to the overlaying projects perhaps.

May 13, 2011

Volker Volker
Ant Farmer
5428 posts

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

May 13, 2011

Hedge Hedge
Lab Rat
191 posts

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

  1. QT_INSTALL_PREFIX:/usr/local/Trolltech/Qt-4.7.3
  2. QT_INSTALL_DATA:/usr/local/Trolltech/Qt-4.7.3
  3. QT_INSTALL_DOCS:/usr/local/Trolltech/Qt-4.7.3/doc
  4. QT_INSTALL_HEADERS:/usr/local/Trolltech/Qt-4.7.3/include
  5. QT_INSTALL_LIBS:/usr/local/Trolltech/Qt-4.7.3/lib
  6. QT_INSTALL_BINS:/usr/local/Trolltech/Qt-4.7.3/bin
  7. QT_INSTALL_PLUGINS:/usr/local/Trolltech/Qt-4.7.3/plugins
  8. QT_INSTALL_IMPORTS:/usr/local/Trolltech/Qt-4.7.3/imports
  9. QT_INSTALL_TRANSLATIONS:/usr/local/Trolltech/Qt-4.7.3/translations
  10. QT_INSTALL_CONFIGURATION:/Library/Preferences/Qt
  11. QT_INSTALL_EXAMPLES:/usr/local/Trolltech/Qt-4.7.3/examples
  12. QT_INSTALL_DEMOS:/usr/local/Trolltech/Qt-4.7.3/demos
  13. QMAKE_MKSPECS:/usr/local/Trolltech/Qt-4.7.3/mkspecs
  14. QMAKE_VERSION:2.01a
  15. QT_VERSION:4.7.3

Output of file QtCore:

  1. file QtCore
  2. QtCore: Mach-O dynamically linked shared library i386

Output of make:

  1. cd components/ && make -f Makefile
  2. cd styleitem/ && make -f Makefile
  3. rm -f libstyleplugin.dylib
  4. 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  
  5. Undefined symbols for architecture i386:
  6.   "StylePlugin::registerTypes(char const*)", referenced from:
  7.       vtable for StylePluginin moc_qstyleplugin.o
  8.   "StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
  9.       vtable for StylePluginin moc_qstyleplugin.o
  10.   "non-virtual thunk to StylePlugin::registerTypes(char const*)", referenced from:
  11.       vtable for StylePluginin moc_qstyleplugin.o
  12.   "non-virtual thunk to StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
  13.       vtable for StylePluginin moc_qstyleplugin.o
  14. ld: symbol(s) not found for architecture i386
  15. collect2: ld returned 1 exit status
  16. make[2]: *** [../plugin/libstyleplugin.dylib] Error 1
  17. make[1]: *** [sub-styleitem-make_default] Error 2
  18. make: *** [sub-components-make_default] Error 2

May 14, 2011

Hedge Hedge
Lab Rat
191 posts

Now I’ve got the same shit with a 64 bit Mac but with the error-message:

  1. symbol(s) not found for architecture x86_64

This is the compile output:

  1. Undefined symbols for architecture x86_64:
  2.   "StylePlugin::registerTypes(char const*)", referenced from:
  3.       vtable for StylePluginin moc_qstyleplugin.o
  4.   "StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
  5.       vtable for StylePluginin moc_qstyleplugin.o
  6.   "non-virtual thunk to StylePlugin::registerTypes(char const*)", referenced from:
  7.       vtable for StylePluginin moc_qstyleplugin.o
  8.   "non-virtual thunk to StylePlugin::initializeEngine(QDeclarativeEngine*, char const*)", referenced from:
  9.       vtable for StylePluginin moc_qstyleplugin.o
  10. 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.

May 15, 2011

Volker Volker
Ant Farmer
5428 posts
Hedge wrote:
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!

October 30, 2011

Deleted Member # 51dd Deleted Member # 51dd
Lab Rat
15 posts

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.

October 30, 2011

Deleted Member # 51dd Deleted Member # 51dd
Lab Rat
15 posts

I decided that….

TKS,

Tokunaga

October 30, 2011

Volker Volker
Ant Farmer
5428 posts

If you already tried everything, chances are bad that there are a solution. If you didn’t….. it would be helpful if you told us what you’ve done.

October 30, 2011

Deleted Member # 51dd Deleted Member # 51dd
Lab Rat
15 posts

Why Wolker??? Do u have a problem???

October 30, 2011

Volker Volker
Ant Farmer
5428 posts
Tokunaga wrote:
Why Wolker??? Do u have a problem???

Me? No. I think it’s you having a problem. At least that’s what you stated previously:

Tokunaga wrote:
I have the same problem

But it’s hard to know what you did decide, though:

Tokunaga wrote:
I decided that….

TKS,

Tokunaga

Can you elaborate a bit more precisely?

November 1, 2011

Deleted Member # 51dd Deleted Member # 51dd
Lab Rat
15 posts

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?

November 11, 2011

Deleted Member # 51dd Deleted Member # 51dd
Lab Rat
15 posts

Do you have msn or something??
my email hxcx_dod@hotmail.com

 
  ‹‹ Can’t load Qt-project created on Windows in Qt Creator on Mac OSX      SDK or the libraries ? What do i download ? ››

You must log in to post a reply. Not a member yet? Register here!