开发者

xcode 3.0 - file is not of required architecture

开发者 https://www.devze.com 2023-03-26 15:08 出处:网络
I am using Xcode 3.0 to compile a test C program using CFITSIO library. Following advice I have encountered from previous posts, I have built CFITSIO as a universal library, and added the fitsio.h and

I am using Xcode 3.0 to compile a test C program using CFITSIO library. Following advice I have encountered from previous posts, I have built CFITSIO as a universal library, and added the fitsio.h and libcfitsio.a files to my project. I have verified I am using the correct build (x86_64). I have verified the libcfitsio.a file is under the Target > Link Binary with Libraries tab. I continue to receive the following error.

A previously created project using cfitsio works - I wasn't the one to link the library. Also, I can link cfitsio successfully from terminal.

Any suggestions?

Building target “test1” of project “test1” with configuration “Release”

Checking Dependencies

ld /Users/jacqueline/test1/build/test1.build/Release/test1.build/Objects-normal/ppc/test1 normal ppc
    cd /Users/jacqueline/test1
    /Developer/usr/bin/gcc-4.0 -o /Users/jacqueline/test1/build/test1.build/Release/test1.build/Objects-normal/ppc/test1 -L/Users/jacqueline/test1/build/Release -L/Users/jacqueline/test1 -L/Users/jacqueline/test1/cfitsio/build/i386 -L/Users/jacqueline/test1/cfitsio/build/ppc -L/Users/jacqueline/test1/cfitsio/build/x86_64 -L/Users/jacqueline/test1/cfitsio/lib -L/Users/jacqueline/test1/cfitsio -F/Users/jacqueline/test1/build/Release -filelist /Users/jacqueline/test1/build/test1.build/Release/test1.build/Objects-normal/ppc/test1.LinkFileList -lcfitsio -arch ppc -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
ld: warning in /Users/jacqueline/test1/libcfitsio.a, file is not of required architecture
Undefined symbols:

  "_ffopentest", referenced from:
      _main in main.o

  "_ffclos", referenced from:
      _main in main.o

  "_ffgrec", referenced from开发者_如何学Python:
      _main in main.o

  "_ffghsp", referenced from:
      _main in main.o

  "_ffrprt", referenced from:
      _main in main.o

ld: symbol(s) not found
collect2: ld returned 1 exit status


It seems as though the library is not fully universal. Try building your project for just one of the architectures at a time (i.e., just ppc, ppc64, i386, and x86-64 separately). When (if) one of them fails, you know which architecture your library is missing so you can recompile it with that. (Or, alternatively, if you don't intend to deploy on that architecture, you can just not compile for it. For instance, there's no real point in building PPC 64 unless you really will benefit from it, as the only machines that will run it are G5s, and they'll run plain old PPC 32-bit code just fine.)


Once I edited Xcode

'Project' > 'Edit Project Settings' > 'Architecture' 

to not include PPC, which seemed to be there by default, the build succeeded. I am running OSX 10.5.8 on Intel Core 2 Duo.

Previously I had been using various builds of the cfitsio library itself, and not changing the default architecture on my Xcode project.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号