Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

file not recognized: File format not recognized

Tags:

c

makefile

when i run a make file i get this error

"obj/viojournal.o: file not recognized: File format not recognized collect2: ld returned 1 exit status"

and the make file is as follows

how to fix this problem. i am using gcc compiler on centos 5.4 linx 64bit machine.

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 $@ $< > $@'

obj/%.o: %.c
    $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<

include $(libsources:%.c=obj/%.d)
include $(tstsources:%.c=obj/%.d)
include $(atrsources:%.c=obj/%.d)
#include $(dmpsources:%.c=obj/%.d)
like image 579
harish013 Avatar asked Dec 20 '22 01:12

harish013


1 Answers

It seems like the object file is corrupted somehow. Try deleting it to force it to be rebuilt or as @devnull suggests, do a make clean.

like image 149
rubenvb Avatar answered Jan 04 '23 04:01

rubenvb