I have a compile error I cannot understand, I think it is complaining about a function in one of the libraries. I do not get this error if I compile on Windows or Redhat, only on my Ubuntu 12.04.
Please help me find the source of this problem, I've seen other posts on the net but no solution.
Here's the compiler output:
mpif90 -w -ffree-line-length-256 -c blah -I/usr/local/dislin/ifc/ -lm
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 10
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
1 errors, 0 warnings (0 minutes, 1 seconds)
The code itself is large so I cannot post it all, but anyway it seems the linking stage is the problem and I think it's my system, not the code.
I'm using the MPICH2 mpif90 1.4.1 wrapper, with gfortran 4.6.3
edit: here's what I send to the command line:
-------------- Build: Debug in K2 (compiler: mpif90 from GNU Fortran Compiler)---------------
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2common.F90 -o obj/Debug/Dropbox/Codes/K2/K2common.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2matrix.F90 -o obj/Debug/Dropbox/Codes/K2/K2matrix.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2common_parallel.F90 -o obj/Debug/Dropbox/Codes/K2/K2common_parallel.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2eispack.F90 -o obj/Debug/Dropbox/Codes/K2/K2eispack.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectxi.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectxi.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2collsee.F90 -o obj/Debug/Dropbox/Codes/K2/K2collsee.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2convertf.F90 -o obj/Debug/Dropbox/Codes/K2/K2convertf.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectyr.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectyr.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectpi.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectpi.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2timestep.F90 -o obj/Debug/Dropbox/Codes/K2/K2timestep.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2hydro.F90 -o obj/Debug/Dropbox/Codes/K2/K2hydro.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2tests.F90 -o obj/Debug/Dropbox/Codes/K2/K2tests.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2maxwell.F90 -o obj/Debug/Dropbox/Codes/K2/K2maxwell.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2parameters.F90 -o obj/Debug/Dropbox/Codes/K2/K2parameters.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2rotate.F90 -o obj/Debug/Dropbox/Codes/K2/K2rotate.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectp_VL.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectp_VL.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2correctE.F90 -o obj/Debug/Dropbox/Codes/K2/K2correctE.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectp.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectp.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2initialise.F90 -o obj/Debug/Dropbox/Codes/K2/K2initialise.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2collsie.F90 -o obj/Debug/Dropbox/Codes/K2/K2collsie.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2transport.F90 -o obj/Debug/Dropbox/Codes/K2/K2transport.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectyr4.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectyr4.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectxp.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectxp.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2fluxes.F90 -o obj/Debug/Dropbox/Codes/K2/K2fluxes.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2calcGHi.F90 -o obj/Debug/Dropbox/Codes/K2/K2calcGHi.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2output.F90 -o obj/Debug/Dropbox/Codes/K2/K2output.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2maxwell2.F90 -o obj/Debug/Dropbox/Codes/K2/K2maxwell2.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advecty.F90 -o obj/Debug/Dropbox/Codes/K2/K2advecty.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2gridi.F90 -o obj/Debug/Dropbox/Codes/K2/K2gridi.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2extras.F90 -o obj/Debug/Dropbox/Codes/K2/K2extras.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2magnetic.F90 -o obj/Debug/Dropbox/Codes/K2/K2magnetic.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2ohms.F90 -o obj/Debug/Dropbox/Codes/K2/K2ohms.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2collsee_ani.F90 -o obj/Debug/Dropbox/Codes/K2/K2collsee_ani.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectp_cubic.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectp_cubic.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectp_chang.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectp_chang.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2evolveEB.F90 -o obj/Debug/Dropbox/Codes/K2/K2evolveEB.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectx_ppm.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectx_ppm.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2smooth.F90 -o obj/Debug/Dropbox/Codes/K2/K2smooth.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2hybrid.F90 -o obj/Debug/Dropbox/Codes/K2/K2hybrid.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2grid.F90 -o obj/Debug/Dropbox/Codes/K2/K2grid.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectyr2.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectyr2.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2collsii.F90 -o obj/Debug/Dropbox/Codes/K2/K2collsii.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2unused.F90 -o obj/Debug/Dropbox/Codes/K2/K2unused.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2momentsi.F90 -o obj/Debug/Dropbox/Codes/K2/K2momentsi.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2colls_ee_gyor.F90 -o obj/Debug/Dropbox/Codes/K2/K2colls_ee_gyor.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2single.F90 -o obj/Debug/Dropbox/Codes/K2/K2single.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2initial_calcs.F90 -o obj/Debug/Dropbox/Codes/K2/K2initial_calcs.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2calcGH.F90 -o obj/Debug/Dropbox/Codes/K2/K2calcGH.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2moments.F90 -o obj/Debug/Dropbox/Codes/K2/K2moments.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advecty_rot.F90 -o obj/Debug/Dropbox/Codes/K2/K2advecty_rot.o
mpif90 -Jobj/Debug/ -w -ffree-line-length-256 -c /home/mark/Dropbox/Codes/K2/K2advectx.F90 -o obj/Debug/Dropbox/Codes/K2/K2advectx.o
mpif90 -o bin/Debug/K2 obj/Debug/Dropbox/Codes/K2/K2common.o obj/Debug/Dropbox/Codes/K2/K2matrix.o obj/Debug/Dropbox/Codes/K2/K2common_parallel.o
obj/Debug/Dropbox/Codes/K2/K2eispack.o obj/Debug/Dropbox/Codes/K2/K2advectxi.o
obj/Debug/Dropbox/Codes/K2/K2collsee.o obj/Debug/Dropbox/Codes/K2/K2convertf.o
obj/Debug/Dropbox/Codes/K2/K2advectyr.o obj/Debug/Dropbox/Codes/K2/K2advectpi.o
obj/Debug/Dropbox/Codes/K2/K2timestep.o obj/Debug/Dropbox/Codes/K2/K2hydro.o
obj/Debug/Dropbox/Codes/K2/K2tests.o obj/Debug/Dropbox/Codes/K2/K2maxwell.o
obj/Debug/Dropbox/Codes/K2/K2parameters.o obj/Debug/Dropbox/Codes/K2/K2rotate.o
obj/Debug/Dropbox/Codes/K2/K2advectp_VL.o obj/Debug/Dropbox/Codes/K2/K2correctE.o
obj/Debug/Dropbox/Codes/K2/K2advectp.o obj/Debug/Dropbox/Codes/K2/K2initialise.o
obj/Debug/Dropbox/Codes/K2/K2collsie.o obj/Debug/Dropbox/Codes/K2/K2transport.o
obj/Debug/Dropbox/Codes/K2/K2advectyr4.o obj/Debug/Dropbox/Codes/K2/K2advectxp.o
obj/Debug/Dropbox/Codes/K2/K2fluxes.o obj/Debug/Dropbox/Codes/K2/K2calcGHi.o
obj/Debug/Dropbox/Codes/K2/K2output.o obj/Debug/Dropbox/Codes/K2/K2maxwell2.o
obj/Debug/Dropbox/Codes/K2/K2advecty.o obj/Debug/Dropbox/Codes/K2/K2gridi.o
obj/Debug/Dropbox/Codes/K2/K2extras.o obj/Debug/Dropbox/Codes/K2/K2magnetic.o
obj/Debug/Dropbox/Codes/K2/K2ohms.o obj/Debug/Dropbox/Codes/K2/K2collsee_ani.o
obj/Debug/Dropbox/Codes/K2/K2advectp_cubic.o obj/Debug/Dropbox/Codes/K2/K2advectp_chang.o
obj/Debug/Dropbox/Codes/K2/K2evolveEB.o obj/Debug/Dropbox/Codes/K2/K2advectx_ppm.o
obj/Debug/Dropbox/Codes/K2/K2smooth.o obj/Debug/Dropbox/Codes/K2/K2hybrid.o
obj/Debug/Dropbox/Codes/K2/K2grid.o obj/Debug/Dropbox/Codes/K2/K2advectyr2.o
obj/Debug/Dropbox/Codes/K2/K2collsii.o obj/Debug/Dropbox/Codes/K2/K2unused.o
obj/Debug/Dropbox/Codes/K2/K2momentsi.o obj/Debug/Dropbox/Codes/K2/K2colls_ee_gyor.o
obj/Debug/Dropbox/Codes/K2/K2single.o obj/Debug/Dropbox/Codes/K2/K2initial_calcs.o
obj/Debug/Dropbox/Codes/K2/K2calcGH.o obj/Debug/Dropbox/Codes/K2/K2moments.o
obj/Debug/Dropbox/Codes/K2/K2advecty_rot.o obj/Debug/Dropbox/Codes/K2/K2advectx.o -I/usr/local/dislin/ifc/ -lm
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 10
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 10
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 20 has invalid symbol index 19
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 15 seconds)
1 errors, 0 warnings (0 minutes, 15 seconds)
This error I know from cases when I forgot to add the object file for the main program (the one that starts with program foo ;-) ). Could it be that you miss that one as well?
Related
I am trying to compile a cuda code that I have received from Github (https://github.com/exafmm/exafmm-alpha).
The Makefile.include contains:
.SUFFIXES: .cxx .cu .f90 .o
.PHONY: docs
CUDA_INSTALL_PATH = /usr/local/cuda
#DEVICE = cpu
DEVICE = gpu
CXX = mpicxx -g -O3 -lstdc++ -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include
NVCC = nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include
FC = mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include
FCC = mpif90 -c -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include
LFLAGS = -D$(DEVICE) -lstdc++ -ldl -lm
LFLAGS += -lmpi_cxx
LFLAGS += -lpthread
ifeq ($(DEVICE),gpu)
LFLAGS += -lcudart
endif
OBJECT = ../kernel/$(DEVICE)Laplace.o ../kernel/$(DEVICE)BiotSavart.o\
../kernel/$(DEVICE)Stretching.o ../kernel/$(DEVICE)Gaussian.o\
../kernel/$(DEVICE)CoulombVdW.o
.cxx.o:
$(CXX) -c $? -o $# $(LFLAGS)
.cu.o:
$(NVCC) -c $? -o $# $(LFLAGS)
.f90.o:
$(FC) -c $? -o $#
And the Makefile is:
include ../Makefile.include
lib_parallel_ij: parallel_wrapper_ij.o $(OBJECT)
ar -cr libfmm.a parallel_wrapper_ij.o $(OBJECT)
ranlib libfmm.a
test_parallel_ij: test_parallel_ij.o
make lib_parallel_ij
$(FC) $? -L. -lfmm $(LFLAGS)
mpirun -np 2 ./a.out
When I tried to compile the code, I get the following errors.
mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include -c test_parallel_ij.f90 -o test_parallel_ij.o
make lib_parallel_ij
make[1]: Entering directory '/home/bidesh/panelCode/UVLM/NVLM_FMM/solver_single_rotor_try/exafmm-alpha-vortex/wrapper'
mpicxx -g -O3 -lstdc++ -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c parallel_wrapper_ij.cxx -o parallel_wrapper_ij.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include -c ../kernel/gpuLaplace.cu -o ../kernel/gpuLaplace.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include -c ../kernel/gpuBiotSavart.cu -o ../kernel/gpuBiotSavart.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
../kernel/gpuBiotSavart.cu(542): warning #177-D: variable "SQRT4PI" was declared but never referenced
../kernel/gpuBiotSavart.cu(548): warning #550-D: variable "r" was set but never used
nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include -c ../kernel/gpuStretching.cu -o ../kernel/gpuStretching.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include -c ../kernel/gpuGaussian.cu -o ../kernel/gpuGaussian.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
nvcc -Xcompiler "-fopenmp -O3" -lstdc++ -use_fast_math -I../include -c ../kernel/gpuCoulombVdW.cu -o ../kernel/gpuCoulombVdW.o -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
ar -cr libfmm.a parallel_wrapper_ij.o ../kernel/gpuLaplace.o ../kernel/gpuBiotSavart.o ../kernel/gpuStretching.o ../kernel/gpuGaussian.o ../kernel/gpuCoulombVdW.o
ranlib libfmm.a
make[1]: Leaving directory '/home/bidesh/panelCode/UVLM/NVLM_FMM/solver_single_rotor_try/exafmm-alpha-vortex/wrapper'
mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include test_parallel_ij.o -L. -lfmm -Dgpu -lstdc++ -ldl -lm -lmpi_cxx -lpthread -lcudart
./libfmm.a(gpuLaplace.o): In function `LaplaceL2P_GPU(int*, int*, double*, double*)':
tmpxft_0000397c_00000000-6_gpuLaplace.cudafe1.cpp:(.text+0xc2): undefined reference to `__cudaPopCallConfiguration'
....
./libfmm.a(gpuLaplace.o): In function `Kernel::LaplaceL2P()':
tmpxft_0000397c_00000000-6_gpuLaplace.cudafe1.cpp:(.text+0x3e06): undefined reference to `__cudaPushCallConfiguration'
....
./libfmm.a(gpuCoulombVdW.o): In function `__sti____cudaRegisterAll()':
tmpxft_00003a87_00000000-6_gpuCoulombVdW.cudafe1.cpp:(.text.startup+0x189): undefined reference to `__cudaRegisterFatBinaryEnd'
....
I tried to find the installation of cuda:
whereis cuda
cuda: /usr/lib/cuda /usr/include/cuda.h /usr/local/cuda
I could not fix the error, can anyone give any hint to fix it?
Thank you.
I am trying to compile a code by Makefile. I received the code from github. I tried to implement the solution from links:
[https://github.com/LLNL/scr/issues/130][1]
[https://stackoverflow.com/questions/62461718/mpi-complile-error-undefined-reference-to-mpiwinfree][2], etc.
These solutions are not working for me or they are too technical. I am sorry to say as I am not from a programming background, it is difficult for me to understand.
The make file are as follows:
Makefile.include
.SUFFIXES: .cxx .cu .f90 .o
.PHONY: docs
CUDA_INSTALL_PATH = /usr/local/cuda
DEVICE = cpu
#~ DEVICE = gpu
CXX = mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include
NVCC = nvcc -Xcompiler "-fopenmp -O3" -std=c++11 -use_fast_math -I../include
FC = mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include
LFLAGS = -D$(DEVICE) -lstdc++ -ldl -lm
#~ LFLAGS += -lmpi_cxx
ifeq ($(DEVICE),gpu)
LFLAGS += -lcudart
endif
OBJECT = ../kernel/$(DEVICE)Laplace.o ../kernel/$(DEVICE)BiotSavart.o\
../kernel/$(DEVICE)Stretching.o ../kernel/$(DEVICE)Gaussian.o\
../kernel/$(DEVICE)CoulombVdW.o
.cxx.o:
$(CXX) -c $? -o $# $(LFLAGS)
.cu.o:
$(NVCC) -c $? -o $# $(LFLAGS)
.f90.o:
$(FC) -c $? -o $#
and Makefile:
include ../Makefile.include
lib_parallel_ij: parallel_wrapper_ij.o $(OBJECT)
ar -cr libfmm.a parallel_wrapper_ij.o $(OBJECT)
ranlib libfmm.a
test_parallel_ij: test_parallel_ij.o
make lib_parallel_ij
$(FC) $? -L. -lfmm $(LFLAGS)
mpirun -np 2 ./a.out
clean:
make -C .. clean
When I am trying to compile it. It gives me the following errors:
mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include -c test_parallel_ij.f90 -o test_parallel_ij.o
make lib_parallel_ij
make[1]: Entering directory '/home/bidesh/panelCode/UVLM/NVLM_FMM/solver_single_rotor_try/exafmm-alpha-vortex/wrapper'
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c parallel_wrapper_ij.cxx -o parallel_wrapper_ij.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuLaplace.cxx -o ../kernel/cpuLaplace.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuBiotSavart.cxx -o ../kernel/cpuBiotSavart.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuStretching.cxx -o ../kernel/cpuStretching.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuGaussian.cxx -o ../kernel/cpuGaussian.o -Dcpu -lstdc++ -ldl -lm
mpicxx -g -O3 -std=c++11 -fPIC -fopenmp -ffast-math -funroll-loops -rdynamic -Wfatal-errors -I../include -c ../kernel/cpuCoulombVdW.cxx -o ../kernel/cpuCoulombVdW.o -Dcpu -lstdc++ -ldl -lm
ar -cr libfmm.a parallel_wrapper_ij.o ../kernel/cpuLaplace.o ../kernel/cpuBiotSavart.o ../kernel/cpuStretching.o ../kernel/cpuGaussian.o ../kernel/cpuCoulombVdW.o
ranlib libfmm.a
make[1]: Leaving directory '/home/bidesh/panelCode/UVLM/NVLM_FMM/solver_single_rotor_try/exafmm-alpha-vortex/wrapper'
mpif90 -g -O3 -fPIC -fopenmp -funroll-loops -rdynamic -I../include test_parallel_ij.o -L. -lfmm -Dcpu -lstdc++ -ldl -lm
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Op::Init(void (*)(void const*, void*, int, MPI::Datatype const&), bool)':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/op_inln.h:121: undefined reference to `ompi_mpi_cxx_op_intercept'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Intracomm::Clone() const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm_inln.h:23: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Graphcomm::Clone() const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Cartcomm::Sub(bool const*) const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Intracomm::Create_graph(int, int const*, int const*, bool) const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o): In function `MPI::Cartcomm::Clone() const':
/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: undefined reference to `MPI::Comm::Comm()'
./libfmm.a(parallel_wrapper_ij.o):/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/ompi/mpi/cxx/intracomm.h:25: more undefined references to `MPI::Comm::Comm()' follow
./libfmm.a(parallel_wrapper_ij.o):(.data.rel.ro._ZTVN3MPI8DatatypeE[_ZTVN3MPI8DatatypeE]+0x78): undefined reference to `MPI::Datatype::Free()'
./libfmm.a(parallel_wrapper_ij.o):(.data.rel.ro._ZTVN3MPI3WinE[_ZTVN3MPI3WinE]+0x48): undefined reference to `MPI::Win::Free()'
collect2: error: ld returned 1 exit status
Makefile:48: recipe for target 'test_parallel_ij' failed
make: *** [test_parallel_ij] Error 1
I am unable to solve the error. I couldn't compile the code. I will be greatly helped if I can get some clue to compile it.
Thanks a lot.
[1]: https://github.com/LLNL/scr/issues/130
[2]: MPI complile error, undefined reference to `MPI::Win::Free()
I tried to add -lpthread but it didn't work. here is my makefile:
mpi_bench: mpbench.o flushall.o timer.o my_send.o mem_manager.o
$(MP_MPI_CC) $(MP_LDFLAGS) mpbench.o flushall.o timer.o my_send.o mem_manager.o -o $# $(MPI_LIBS) $(MP_LIBS)
mpbench.o: mpbench.c
$(MP_MPI_CC) $(MP_CFLAGS) $(MPI_INC) -DMPI -I.. -c mpbench.c -o mpbench.o
timer.o: ../timer.c
$(MP_MPI_CC) -c -I.. ../timer.c -o $#
flushall.o: ../flushall.c
$(MP_MPI_CC) -c -I.. ../flushall.c -o $#
my_send.o: my_send.cpp
$(MP_MPI_CC) -c -I.. my_send.cpp -o my_send.o -lrt
mem_manager.o: mem_manager.cpp
$(MP_MPI_CC) -c -I.. mem_manager.cpp -o mem_manager.o -lrt -lpthread
here is the error information
mpicc mpbench.o flushall.o timer.o my_send.o mem_manager.o -o mpi_bench -lrt
/usr/bin/ld: mem_manager.o: undefined reference to symbol 'pthread_mutexattr_setpshared##GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
can anyone a help me out? thank you so much
Trying to build SDL2-2.0.14 on Windows with latest MSYS.
If i try to build with the minimal makefile in the root SDL directory i get the following error:
cc -g -O2 -I./include -c -o src/timer/dummy/SDL_systimer.o src/timer/dummy/SDL_systimer.c
cc -g -O2 -I./include -c -o src/video/SDL_RLEaccel.o src/video/SDL_RLEaccel.c
cc -g -O2 -I./include -c -o src/video/SDL_blit.o src/video/SDL_blit.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_0.o src/video/SDL_blit_0.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_1.o src/video/SDL_blit_1.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_A.o src/video/SDL_blit_A.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_N.o src/video/SDL_blit_N.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_auto.o src/video/SDL_blit_auto.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_copy.o src/video/SDL_blit_copy.c
cc -g -O2 -I./include -c -o src/video/SDL_blit_slow.o src/video/SDL_blit_slow.c
cc -g -O2 -I./include -c -o src/video/SDL_bmp.o src/video/SDL_bmp.c
cc -g -O2 -I./include -c -o src/video/SDL_clipboard.o src/video/SDL_clipboard.c
cc -g -O2 -I./include -c -o src/video/SDL_egl.o src/video/SDL_egl.c
src/video/SDL_egl.c:25:2: error: #error this should be not defined
25 | #error this should be not defined
| ^~~~~
In file included from src/video/SDL_egl_c.h:28,
from src/video/SDL_egl.c:36:
./include/SDL_egl.h:29:10: fatal error: EGL/egl.h: No such file or directory
29 | #include <EGL/egl.h>
| ^~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: src/video/SDL_egl.o] Error 1
Solved it removing OPENGL support in include/SDL_config_windows.h:269:
#ifndef SDL_VIDEO_OPENGL_EGL
/* #define SDL_VIDEO_OPENGL_EGL 1 commented for wind64 build */
#endif
Now i've got the libSDL.a file, but if i try to build a test from the test folder:
Alessandro#DESKTOP-954PK5R MINGW64 /c/WORK/sdl_latest/SDL2-2.0.14/test
$ cc -g testkeys.c ../libSDL.a -I../include -o testkeys.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccSosm3W.o: in function `SDL_main':
C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:28: undefined reference to `SDL_LogSetPriority'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:30: undefined reference to `SDL_Init'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:31: undefined reference to `SDL_GetError'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:31: undefined reference to `SDL_LogError'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:35: undefined reference to `SDL_GetScancodeName'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:35: undefined reference to `SDL_Log'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\WORK\sdl_latest\SDL2-2.0.14\test/testkeys.c:38: undefined reference to `SDL_Quit'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): in function `main':
C:/_/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
Do i have to link something else?
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I'm going to use webdis but get and error on linking stage. Webdis is a web face for redis database. You can find it here: http://webd.is .
My system configuration is:
* Ubuntu Oneiric Ocelot (11.10 Alpha)
* Gcc 4.6
* Linux kernel 3.0.0-7
When I do make I get the next output:
krolik#krolik-PC:~/Projects/webdis$ make
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o webdis.o webdis.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o cmd.o cmd.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o worker.o worker.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o slog.o slog.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o server.o server.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o libb64/cencode.o libb64/cencode.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o acl.o acl.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o md5/md5.o md5/md5.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o http.o http.c
http.c: In function ‘http_response_write’:
http.c:138:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o client.o client.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o websocket.o websocket.c
websocket.c: In function ‘ws_handshake_reply’:
websocket.c:76:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o pool.o pool.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o conf.o conf.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/json.o formats/json.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/raw.o formats/raw.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/common.o formats/common.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/custom-type.o formats/custom-type.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o formats/bson.o formats/bson.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/hiredis.o hiredis/hiredis.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/sds.o hiredis/sds.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/net.o hiredis/net.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/async.o hiredis/async.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o hiredis/dict.o hiredis/dict.c
hiredis/dict.c:53:21: warning: ‘dictGenHashFunction’ defined but not used [-Wunused-function]
hiredis/dict.c:73:14: warning: ‘dictCreate’ defined but not used [-Wunused-function]
hiredis/dict.c:160:12: warning: ‘dictReplace’ defined but not used [-Wunused-function]
hiredis/dict.c:182:12: warning: ‘dictDelete’ defined but not used [-Wunused-function]
hiredis/dict.c:238:13: warning: ‘dictRelease’ defined but not used [-Wunused-function]
hiredis/dict.c:258:22: warning: ‘dictGetIterator’ defined but not used [-Wunused-function]
hiredis/dict.c:268:19: warning: ‘dictNext’ defined but not used [-Wunused-function]
hiredis/dict.c:288:13: warning: ‘dictReleaseIterator’ defined but not used [-Wunused-function]
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/dump.o jansson/src/dump.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/error.o jansson/src/error.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/hashtable.o jansson/src/hashtable.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/load.o jansson/src/load.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/strbuffer.o jansson/src/strbuffer.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/utf.o jansson/src/utf.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/value.o jansson/src/value.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o jansson/src/variadic.o jansson/src/variadic.c
cc -c -O3 -Wall -Wextra -I. -Ijansson/src -Ihttp-parser -o http-parser/http_parser.o http-parser/http_parser.c
cc -levent -pthread -o webdis webdis.o cmd.o worker.o slog.o server.o libb64/cencode.o acl.o md5/md5.o http.o client.o websocket.o pool.o conf.o formats/json.o formats/raw.o formats/common.o formats/custom-type.o formats/bson.o hiredis/hiredis.o hiredis/sds.o hiredis/net.o hiredis/async.o hiredis/dict.o jansson/src/dump.o jansson/src/error.o jansson/src/hashtable.o jansson/src/load.o jansson/src/strbuffer.o jansson/src/utf.o jansson/src/value.o jansson/src/variadic.o http-parser/http_parser.o
worker.o: In function `worker_main':
worker.c:(.text+0xd): undefined reference to `event_base_new'
worker.c:(.text+0x29): undefined reference to `event_set'
worker.c:(.text+0x35): undefined reference to `event_base_set'
worker.c:(.text+0x3f): undefined reference to `event_add'
worker.c:(.text+0x6b): undefined reference to `event_base_dispatch'
worker.o: In function `worker_can_read':
worker.c:(.text+0xd2): undefined reference to `event_set'
worker.c:(.text+0xe5): undefined reference to `event_base_set'
worker.o: In function `worker_on_new_client':
worker.c:(.text+0x1f5): undefined reference to `event_set'
worker.c:(.text+0x208): undefined reference to `event_base_set'
worker.c:(.text+0x212): undefined reference to `event_add'
worker.o: In function `worker_monitor_input':
worker.c:(.text+0x2b8): undefined reference to `event_set'
worker.c:(.text+0x2cb): undefined reference to `event_base_set'
worker.o: In function `worker_can_read':
worker.c:(.text+0xf5): undefined reference to `event_add'
worker.o: In function `worker_monitor_input':
worker.c:(.text+0x2e3): undefined reference to `event_add'
server.o: In function `server_start':
server.c:(.text+0x217): undefined reference to `event_reinit'
server.c:(.text+0x338): undefined reference to `event_base_new'
server.c:(.text+0x35a): undefined reference to `event_set'
server.c:(.text+0x369): undefined reference to `event_base_set'
server.c:(.text+0x373): undefined reference to `event_add'
server.c:(.text+0x37f): undefined reference to `event_base_dispatch'
http.o: In function `http_can_write':
http.c:(.text+0x63): undefined reference to `event_set'
http.c:(.text+0x76): undefined reference to `event_base_set'
http.o: In function `http_schedule_write':
http.c:(.text+0x3f1): undefined reference to `event_set'
http.c:(.text+0x404): undefined reference to `event_base_set'
http.o: In function `http_response_write':
http.c:(.text+0x6b1): undefined reference to `event_set'
http.c:(.text+0x6c4): undefined reference to `event_base_set'
http.c:(.text+0x6ce): undefined reference to `event_add'
http.o: In function `http_response_write_chunk':
http.c:(.text+0xc36): undefined reference to `event_set'
http.c:(.text+0xc49): undefined reference to `event_base_set'
http.c:(.text+0xc53): undefined reference to `event_add'
http.o: In function `http_can_write':
http.c:(.text+0x84): undefined reference to `event_add'
http.o: In function `http_schedule_write':
http.c:(.text+0x40f): undefined reference to `event_add'
pool.o: In function `redisLibeventCleanup':
pool.c:(.text+0x89): undefined reference to `event_del'
pool.c:(.text+0x95): undefined reference to `event_del'
pool.o: In function `pool_on_disconnect':
pool.c:(.text+0x179): undefined reference to `event_set'
pool.c:(.text+0x189): undefined reference to `event_base_set'
pool.o: In function `redisLibeventAttach':
pool.c:(.text+0x266): undefined reference to `event_set'
pool.c:(.text+0x281): undefined reference to `event_set'
pool.c:(.text+0x28c): undefined reference to `event_base_set'
pool.c:(.text+0x297): undefined reference to `event_base_set'
pool.o: In function `pool_can_connect':
pool.c:(.text+0x3dd): undefined reference to `event_set'
pool.c:(.text+0x3ed): undefined reference to `event_base_set'
pool.o: In function `pool_connect':
pool.c:(.text+0x595): undefined reference to `event_set'
pool.c:(.text+0x5a5): undefined reference to `event_base_set'
pool.c:(.text+0x5b6): undefined reference to `event_add'
pool.o: In function `redisLibeventAddWrite':
pool.c:(.text+0x6a): undefined reference to `event_add'
pool.o: In function `redisLibeventAddRead':
pool.c:(.text+0x77): undefined reference to `event_add'
pool.o: In function `redisLibeventDelWrite':
pool.c:(.text+0xb8): undefined reference to `event_del'
pool.o: In function `redisLibeventDelRead':
pool.c:(.text+0xc5): undefined reference to `event_del'
pool.o: In function `pool_on_disconnect':
pool.c:(.text+0x19e): undefined reference to `event_add'
pool.o: In function `pool_can_connect':
pool.c:(.text+0x402): undefined reference to `event_add'
collect2: ld returned 1 exit status
make: *** [webdis] Помилка 1
I have libevent.so and libevent-dev headers installed in my /usr/lib directory and I also tried -levent2 instead of -levent in LDFLAGS variable of Makefile but still didn't got any progress. What can be the solution for my issue?
Thank you.
You need to put the -levent command line option after the names of the object files in the linker command line. From the GCC documentation on the -l flag:
-llibrary
-l library
Search the library named library when linking. (The second
alternative with the library as a separate argument is only for
POSIX compliance and is not recommended.)
It makes a difference where in the command you write this option;
the linker searches and processes libraries and object files in the
order they are specified. Thus, foo.o -lz bar.o searches library z
after file foo.o but before bar.o. If bar.o refers to functions in
z, those functions may not be loaded.