Static library built for archive which is not the architecture being linked (x86_64)

后端 未结 5 842
终归单人心
终归单人心 2021-02-04 03:20

I am experiencing what seems to be the same problem when I try to compile two different programs. Each of them creates first a static library and then the main application linki

5条回答
  •  Happy的楠姐
    2021-02-04 04:22

    I had the problem of getting the wrong architecture error message. It said the following:

     ld: warning: ignoring file blah/lib/blahblah.a, file was built for archive which is not the architecture being linked (i386)
    

    lipo gives: Non-fat file: ../lib/blahblah.a is architecture: x86_64

    in the makefile it said the following: ARCH_FLAG = -arch x86_64 -arch i386

    I commented out the i386 part and the error disappeared. ARCH_FLAG = -arch x86_64 #-arch i386

    So, I think it is possible you are getting the error for the same reason. Maybe you just need to set the architecture class to match your library.

    By the way, my makefile was generated by swig, and I had not set any switches for the compiler.

提交回复
热议问题