1. download from http://www.ics.forth.gr/~lourakis/levmar/ At the time that I am writing this blog, current version is levmar-2.4 and ubuntu 9.04. 2. $ make NOTE : - you have to install " liblapack-dev " to prevent /usr/bin/ld: cannot find -llapack - install " libf2c2-dev " to prevent /usr/bin/ld: cannot find -lf2c but you also have a problem with f2c anyway /usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/libf2c.so: undefined reference to `MAIN__' following suggestion here . Just add "-u MAIN__" to Makefile. So change from lmdemo: $(DEMOBJS) liblevmar.a $(CC) $(LDFLAGS) $(DEMOBJS) -o lmdemo -llevmar $(LIBS) -lm to lmdemo: $(DEMOBJS) liblevmar.a $(CC) $(LDFLAGS) $(DEMOBJS) -o lmdemo -llevmar $(LIBS) -lm -u MAIN__ 3. Test by compile demo $ gcc lmdemo.c -o lmdemo1 -L/mnt/disk/AIT/OpenCV/levmar-2 -lm -llapack -llevmar NOTE : dlevmar_dif(costFunc, p0, x0, mlevmar, nlevmar, 1000, opts, info, NULL, NULL, NULL); // no Jacobian void costFunc( double *p , dou...