[ofa-general] makefile problem in using librdmacm and libverbs

yangdong yangdong at ncic.ac.cn
Wed Oct 24 09:50:15 PDT 2007



I have some troubles when i was use libverbs and rdmacm. I make a
makefile for my amp subsystem,
you can see my makefile as follows. The key is LDFLAGS = -lm -lpthread
-libverbs -lrdmacm, i make
my makefile following Makefile in perftest, this is different from
makefile in librdmacm
(~/OFED-1.2/SOURCES/ofa_user-1.2/src/userspace/librdmacm). I adopt this
style, but my problem came,
that is after i do:
rdma_create_event_channel,rdma_create_id, rdma_resolve_addr,
rdma_resolve_route, ibv_alloc_pd, ibv_create_cq,
when i invoke ibv_req_notify_cq, Segmentation fault occur, because
cm_id->verbs->ops.req_notify_c is not exist.

who can give me some advice, how write my makefile to use librdmacm and
libverbs correctly, thanks a lot!




Makefile in amp

CC = cc
RM = rm -f
AR = ar rvs
MV = mv -f
RANLIB = ranlib
TOP_DIR = /home/yd/OFED-1.2/SOURCES/ofa_user-1.2/src/userspace
INC_VERBS = ${TOP_DIR}/libibverbs/include/
INC_RDMACM = ${TOP_DIR}/librdmacm/include/
INC_THIS = ./
CFLAGS = -DHAVE_CONFIG_H -I../../include/ -I${INC_VERBS} -I${INC_RDMACM}
-I${INC_THIS} -Wall -g -D_GNU_SOURCE -O2 -D__RDMA__

LDFLAGS = -lm -lpthread -libverbs -lrdmacm
LIBPATH = ../../lib/

OBJS = amp_interface.o amp_conn.o amp_utcp.o amp_uopenib.o amp_protos.o
amp_request.o \
amp_uthread.o amp_help.o
LIB = libamp.a

.c.o:
${CC} ${CFLAGS} ${EXTRA_CFLAGS} -c $*.c


lib: ${OBJS}
${AR} ${LIB} ${OBJS}
${RANLIB} ${LIB}
${MV} ${LIB} ${LIBPATH}

clean:
${RM} *.o core ~* *.cpp
~


Makefile in perftest:

TESTS = write_bw_postlist rdma_lat rdma_bw send_lat send_bw write_lat
write_bw read_lat read_bw
UTILS = clock_test

all: ${TESTS} ${UTILS}

CFLAGS += -Wall -g -D_GNU_SOURCE -O2
EXTRA_FILES = get_clock.c
EXTRA_HEADERS = get_clock.h
#The following seems to help GNU make on some platforms
LOADLIBES +=
LDFLAGS +=

${TESTS}: LOADLIBES += -libverbs -lrdmacm

${TESTS} ${UTILS}: %: %.c ${EXTRA_FILES} ${EXTRA_HEADERS}
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $< ${EXTRA_FILES} $(LOADLIBES)
$(LDLIBS) -o ib_$@
clean:
$(foreach fname,${TESTS}, rm -f ib_${fname})
rm -f ${UTILS}
.DELETE_ON_ERROR:
.PHONY: all clean
~



More information about the general mailing list