2013-05-19 2 views
1

C++ 및 OpenGL을 사용하는 다음 makefile이 있습니다. 컴파일 중 이었기 때문에 -m32 행을 추가하여 x86_64에서 컴파일하려고 시도했습니다. 이제 동일한 오류가 발생하지만 대신 i386을 말합니다.OSX : 아키텍처 i386에 대한 기호가 없습니다.

이 프로그램을 컴파일하려면 어떻게해야합니까?

차이가 나는 경우를 대비하여 OSX 10.8을 실행 중입니다.

감사합니다.

.SUFFIXES: .cpp 


#Change the following two lines to reflect the locations 
# of the GLUT library (.a) and includes on your system 

#TOP = /pool/u/class/cs520/Mesa-7.0.3 
CFLAGS = -w -s -O2 -ansi -DSHM 
XLIBS = -lX11 -lXext -lXmu -lXext -lXmu -lXt -lXi -lSM -lICE 
LIBS = -lglut -lGLU -lGL 
#INCLS = -I/usr/X11R/include -I/share/mesa/include #-I$(TOP)/include 
INCLS = -I/usr/X11R6/include -I/usr/X11/include/GL 
LIBDIR = -L/usr/X11/lib -L/usr/X11R6/lib #-L$(TOP)/lib 

#GLUT_LIB_LOCATION=/usr/X11R6/lib 
#GLUT_INC_LOCATION=/usr/X11R6/include 

#CC=gcc 
CC=g++ 
#CPPFLAGS=-I${GLUT_INC_LOCATION} #-w 
#GLLIBS=-L${GLUT_LIB_LOCATION} -lglut -lGL -lGLU 
#LPATH=${GLUTPATH} 
INCS= 

libs =  ${GLLIBS} -lm 

All: terrain 

terrain: tg.o tga.o terrain.o 
    $(CC) $(LPATH) tg.o tga.o terrain.o -m32 ./glui/libglui.a $(libs) -o terrain $(LIBDIR) $(LIBS) $(XLIBS) 

.cpp.o: 
    $(CC) -c -D_LINUX_ $(INCS) $*.cpp $(INCLS) 

clean: 
    rm *.o 

tg.o: tg.cpp terrain.h tga.h glui.h 
tga.o: tga.cpp tga.h 
terrain.o : terrain.cpp terrain.h 

그리고 다음 오류가 발생합니다.

g++ -c -D_LINUX_ tga.cpp -I/usr/X11R6/include -I/usr/X11/include/GL 
g++ -c -D_LINUX_ terrain.cpp -I/usr/X11R6/include -I/usr/X11/include/GL 
g++ tg.o tga.o terrain.o -m32 ./glui/libglui.a -lm -o terrain -L/usr/X11/lib -L/usr/X11R6/lib -lglut -lGLU -lGL -lX11 -lXext -lXmu -lXext -lXmu -lXt -lXi -lSM -lICE 
ld: warning: ld: warning: ld: warning: ignoring file tg.o, file was built for unsupported file format (0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0) which is not the architecture being linked (i386): tg.oignoring file terrain.o, file was built for unsupported file format (0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0) which is not the architecture being linked (i386): terrain.oignoring file tga.o, file was built for unsupported file format (0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0) which is not the architecture being linked (i386): tga.o 


ld: warning: ignoring file ./glui/libglui.a, file was built for archive which is not the architecture being linked (i386): ./glui/libglui.a 
Undefined symbols for architecture i386: 
    "_main", referenced from: 
     start in crt1.10.6.o 
ld: symbol(s) not found for architecture i386 
collect2: ld returned 1 exit status 
make: *** [terrain] Error 1 
+0

"lipo -info path/to/libglui.a"는 i386 및 x86이 실제로 포함되어 있는지 알려줍니다. 이 라이브러리 중 하나가 그렇지 않은 것 같습니다. –

+0

libolu.a (아키텍쳐를 결정할 수 없음)'libolu.a. – UndefinedReference

+0

아마도 동적 라이브러리 및 실행 파일 일뿐입니다 ... –

답변

1

MacOS X 용으로 컴파일 중이므로 X11이 아니라 기본 OpenGL Framework를 사용하십시오. 컴파일러/링커 옵션은 -framework OpenGL입니다.

그리고 MacOS X의 특정 버전에 맞게 컴파일되지 않은 사전 컴파일 된 라이브러리를 사용했을 가능성이 있습니다. 컴파일러 스위치가 도움이되지 않습니다.

관련 문제