2013-08-26 342 views
4

當我運行make文件我得到這個錯誤文件無法識別:文件格式無法識別

「OBJ/viojournal.o:文件無法識別:文件格式無法識別 collect2:LD返回1個退出狀態」

和make文件如下

如何解決這個問題。 我在centos 5.4 linx 64位機器上使用gcc編譯器。

all: libvioft.so fdump syncer 

CPPFLAGS = -I/usr/include/libxml2 -I../clogger -I../marshall -I../ddp \ 
    -I../http -I../xml -I../nfsop -I../include/common -I../restful \ 
    -I../include/oneGrid 

CFLAGS = -g3 -Wall -Wextra -fPIC -DREPLICATION_ENABLED -DJOURNALING_ENABLED 

#CFLAGS = -g3 -Wall -Wextra -fPIC 

LDFLAGS = -Wl,-rpath=\$$ORIGIN -Wl,-rpath=\$$ORIGIN/../clogger \ 
    -Wl,-rpath=\$$ORIGIN/../marshall -Wl,-rpath=\$$ORIGIN/../ddp \ 
    -Wl,-rpath=\$$ORIGIN/../http -Wl,-rpath=\$$ORIGIN/../xml \ 
    -Wl,-rpath=\$$ORIGIN/../restful 

LIBS = -lpthread -lssl -lxml2 -lbz2 -L../clogger -lclogger \ 
    -L../marshall -lmarshall -L../ddp -lddp -L../nfsop -lnfsop 

libsources = filefs.c viojournal.c recvReplicaUpdate.c syncer.c hostops.c filetable.c updateRemoteFT.c checkpoint.c 
#libsources = filefs.c viojournal.c hostops.c filetable.c checkpoint.c container.c locks.c 

libobjects = $(libsources:%.c=obj/%.o) 

fttestsources = fttest2.c 
fttestobjects = $(fttestsources:%.c=obj/%.o) 

syncersources = syncer.c 
syncerobjects = $(syncersources:%.c=obj/%.o) 

#dmpsources = viodump.c hostops.c 
#dmpobjects = $(dmpsources:%.c=obj/%.o) 

libvioft.so: $(libobjects) 
    $(CC) $(CFLAGS) -shared -o libvioft.so $(libobjects) 

fdump: $(fttestobjects) libvioft.so 
    $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o fdump $(fttestobjects) 

syncer: $(syncerobjects) libvioft.so 
    $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o syncer $(syncerobjects) 

viodump: $(dmpobjects) 
    $(CC) $(CFLAGS) $(LDFLAGS) -lpthread -o viodump $(dmpobjects) 

clean: 
    rm -rf fttest viodump atar syncer libvioft.so obj 

install: 
    cp -f libvioft.so ../package/lib  
# cp -f syncer ../package/bin 

obj/%.d: %.c 
    $(SHELL) -ec 'mkdir -p obj && $(CC) -MM $(CPPFLAGS) $(CFLAGS) -MT $(@:.d=.o) -MT [email protected] $< > [email protected]' 

obj/%.o: %.c 
    $(CC) -c $(CPPFLAGS) $(CFLAGS) -o [email protected] $< 

include $(libsources:%.c=obj/%.d) 
include $(tstsources:%.c=obj/%.d) 
include $(atrsources:%.c=obj/%.d) 
#include $(dmpsources:%.c=obj/%.d) 
+2

您是否首先嚐試「make clean」? – devnull

回答

8

看起來好像目標文件被損壞了。嘗試刪除它來強制它被重建或者@devnull建議,做一個make clean

+0

感謝您的建議是否有任何問題,使文件...? – harish013

+0

@ harish013我不會說'Makefile',對不起。我使用CMake這樣的東西來「讓我的生活變得更容易」;-)' – rubenvb