I have been stuck for a long time now and am getting really frustrated...someone help me please.
I am using openSuse 10.3 and using gcc ofcourse.
I have built a small test file to try and call one of the CLAPACK function "spotrf".
I have already built all the libraries(BLAS, F2C, LAPACK) as describes in the install file over netlib.
I am using the included standard BLAS library.
I have included all the .h files in my test program and all the includes and the libs in the make file as well.
Problem is it compiles successfully yet at the linking phase it logs error:
spotrftest.o: In function `main':
/home/mfahmy/Documents/SatoLabProj/SPOTRF_C2D/spotrftest.c:74: undefined reference to `spotrf_'
collect2: ld returned 1 exit status
# --error 0x100 --
make: *** [build] Error 255
here is only the important part of my sample test file:
#include "inputs.h"
#include "f2c.h"
#include "blaswrap.h"
#include "clapack.h"
//#include "cblas.h"
#include <stdio.h>
//#include <stdlib.h>
#include <time.h>
extern int spotrf_(char *uplo, integer *n, real *a, integer *lda, integer *info);
int main(void)
{
/* SPOTRF */
spotrf_(&uplo, &n, a, &lda, &info);
}
here is my make file:
all: build
CUDA_LIB_PATH = /usr/local/cuda/lib
CUDA_INC_PATH = /usr/local/cuda/include
CUDA_BIN_PATH = /usr/local/cuda/bin
OTHER_INCS_PATH1 = ./CLAPACK/INCLUDE
OTHER_INCS_PATH2 = ./CLAPACK/BLAS/WRAP
OTHER_INCS_PATH3 = ./CLAPACK/F2CLIBS
OTHER_INCS_PATH4 = ./CLAPACK/F2CLIB/libf2c
OTHER_INCS_PATH5 = ./CLAPACK/F2CLIB/BLAS
OTHER_INCS_PATH6 = ./CLAPACK/BLAS/SRC
OTHER_INCS_PATH7 = ./CLAPACK/SRC
CBLAS_LIB_PATH = ./CLAPACK/BLAS/WRAP
F2C_LIB_PATH = ./CLAPACK/F2CLIBS
LINUX_LIBS_PATH = ./CLAPACK
F2C_LIB = libf2c.a
BLAS_LIB = libcblaswr.a
LIN_BLAS_LIB = blas_LINUX.a
LIN_LAPACK_LIB = lapack_LINUX.a
#LIN_OTHER_LIB = tmglib_LINUX.a
NVCC = $(CUDA_BIN_PATH)/nvcc
LINK_FLAGS = -link -v -o test -L/usr/lib-llapack-lblas-lg2c-lm-lstdc++ -I$(CUDA_INC_PATH) -I$(OTHER_INCS_PATH1) -L$(F2C_LIB_PATH)-l$(F2C_LIB) -L$(CBLAS_LIB_PATH)-l$(BLAS_LIB) -L$(LINUX_LIBS_PATH)-l$(LIN_LAPACK_LIB) -L$(LINUX_LIBS_PATH )-l$(LIN_BLAS_LIB)
COMPILE_FLAGS = -c -v -g -use_fast_math -O0 -L/usr/lib-llapack-lblas-lg2c-lm-lstdc++ -I$(CUDA_INC_PATH) -I$(OTHER_INCS_PATH1) -L$(CUDA_LIB_PATH) -L$(CBLAS_LIB_PATH) -L$(F2C_LIB_PATH) -L$(LINUX_LIBS_PATH)-l$(LIN_LAPACK_LIB) -L$(LINUX_LIBS_PATH )-l$(LIN_BLAS_LIB) -L$(LINUX_LIBS_PATH)-l$(LIN_OTHER_LIB)
build: spotrftest.o
$(NVCC) $(LINK_FLAGS) spotrftest.o
spotrftest.o: spotrftest.c
$(NVCC) $(COMPILE_FLAGS) spotrftest.c
clean:
rm test spotrf.o spotrftest.o
Thanks a million

