[Qt-interest] "not of required architecture" error message on my own static library

Warren warren at wantonhubris.com
Tue Sep 8 18:42:10 CEST 2009


Thanks for the reply but I don't understand why the two projects are  
compiling to different architectures.  What is it in the .PRO files  
that I have set up wrong?  They are very basic projects at the moment  
(I'm just trying to learn QT at the moment).

- Warren
(warren at wantonhubris.com)




On Sep 8, 2009, at 11:10 AM, Mike Jackson wrote:

> On 2009-09-06 11:17:52 -0400, Warren <warren at wantonhubris.com> said:
>
>>
>> I'm working in OSX on an Intel Macbook Pro, for reference.  QT 4.5.3.
>>
>> I'm getting pretty frustrated here as this makes little sense to me.
>> I created a project in QT and built a static library.  That dropped a
>> ".a" file on my hard drive which is all good.  I then created a GUI
>> project in QT and cannot for the life of me get it to link to the
>> static library.
>>
>> Whenever I compile the GUI app, I get this error:
>>
>> "ld: warning: in ../CommonFramework/libCommonFramework.a, file is not
>> of required architecture"
>>
>> I'm brand new to the land of QT so be gentle.  Which idiotic newbie
>> mistake am I committing here?
>>
>>
>>
>> The .PRO file for the static library:
>>
>> # -------------------------------------------------
>> # Project created by QtCreator 2009-09-06T09:50:35
>> # -------------------------------------------------
>> QT -= gui
>> TARGET = CommonFramework
>> TEMPLATE = lib
>> CONFIG += staticlib x86
>> SOURCES += xmapreader.cpp
>> HEADERS += xmapreader.h \
>> CommonInclude.h
>> PRECOMPILED_HEADER += CommonInclude.h
>>
>> The .PRO file for the GUI app:
>>
>> # -------------------------------------------------
>> # Project created by QtCreator 2009-09-06T08:01:41
>> # -------------------------------------------------
>> QT += opengl \
>> webkit
>> TARGET = LevelEd
>> TEMPLATE = app
>> SOURCES += main.cpp \
>> leveledwindow.cpp
>> HEADERS += leveledwindow.h \
>> LevelEdInclude.h
>> FORMS += leveledwindow.ui
>> PRECOMPILED_HEADER += LevelEdInclude.h
>>
>> # HACK : This is the only way to get QT 4.5 to compile on Snow
>> Leopard. Should be removed once a better version of QT is released.
>> CONFIG += x86
>>
>> LIBS += ../CommonFramework/libCommonFramework.a
>>
>>
>>
>>
>> - Warren
>> (warren at wantonhubris.com)
>
> It would seem that your library and Qt are of different archs, ie, one
> of them is i386 and one of them is x86_64.
>
> You can use the "file" command to interrogate what archs are in the
> static library and what archs are in the Qt libraries.
>
> As far as the "only way to get Qt to compile on 10.6"..
>
> 10.6 is now compiling 64 bit binaries by _default_ which means when
> you compile Qt 4.5.2 you will probably have to be _very_ specific  
> about
> a few items:
>
>  ./configure -debug-and-release -shared -fast -exceptions -stl
> -no-qt3support -prefix /Users/Shared/Toolkits/Qt-4.5.2-Framework - 
> cocoa
> -arch x86 -largefile
>
> would be what I would use. Note that I don't actually have 10.6
> installed but looking else where on the internet it would seem you  
> just
> have to be more explicit about the configure options. Also, you would
> probably have to set the OS X SDK Root (-sdk) in order to compile for
> PPC machines as you will most likely need the 10.5SDK for that.
>
> Just some thoughts.
> Mike Jackson
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list