How to troubleshoot “Undefined symbols for architecture i386”

十年热恋 提交于 2019-12-11 23:27:10

问题


I'm trying to run an Xcode project developed by someone else and I keep getting the following error. Googling it suggests that I'm missing some dependency but if so I don't know which one. Supposedly the project already has all "Link Binary With Libraries" configured. I've tried different versions of Xcode and target devices and I get the same error. How can I narrow the problem down further?

Undefined symbols for architecture i386:
  "___gl_pqSortExtractMin", referenced from:
      ___gl_computeInterior in sweep.o
  "___gl_pqSortMinimum", referenced from:
      ___gl_computeInterior in sweep.o
  "___gl_pqSortNewPriorityQ", referenced from:
      _InitPriorityQ in sweep.o
  "___gl_pqSortInsert", referenced from:
      _InitPriorityQ in sweep.o
      _CheckForIntersect in sweep.o
  "___gl_pqSortInit", referenced from:
      _InitPriorityQ in sweep.o
  "___gl_pqSortDeletePriorityQ", referenced from:
      _InitPriorityQ in sweep.o
      _DonePriorityQ in sweep.o
      _CheckForIntersect in sweep.o
  "___gl_pqSortDelete", referenced from:
      _CheckForRightSplice in sweep.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

回答1:


That means that even if the compiler has the header file, when it actually linked them, it didn't find the real implementation of this code. So maybe you didn't linked your static library (only included the header file), or this static library hasn't been compiled for i386 architecture. So you can't make it work on simulator. You should check with lipo -info libMylib.a on what kind of architecture it has been compiled (armv6 - armv7 - armv7s, or whatever else)

Ok here what i have found: This is the sweep file you are using.

http://oss.sgi.com/cgi-bin/cvsweb.cgi/projects/ogl-sample/main/gfx/lib/glu/libtess/sweep.c?annotate=1.2

Inside

static int CheckForRightSplice( GLUtesselator *tess, ActiveRegion *regUp )

there is

pqDelete( tess->pq, eUp->Org->pqHandle ); /* __gl_pqSortDelete */

By the way into the include file in sweep there is:

#include "priorityq.h"

So it let you compile because you have the header definition of the function, but you don't have the binary implementation. So you get linker error. I dunno if you need to instal openGl in your mac ( i though it was already included), by the way i'm sure you don't have the (opengl/glu/libtess) libtess library, this is where there is the "priority.h" definition.

Here is the glu lib if found: http://svn.netlabs.org/repos/gl2/opengl/glu/libtess/

So you should ask your friend if he has compiled himself the framework or not. Maybe you forget to add some link into your Xcode project, or the binary is missing from your mac, or not compiled into the i386 (even if i doubt of this). By the way i'm really not an openGl expert, but if you ask anyone into an openGl forum, they surely can help you.



来源:https://stackoverflow.com/questions/12927854/how-to-troubleshoot-undefined-symbols-for-architecture-i386

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!