Question

I have an error making a code project because of what I believe is a missing routine from lapack:

HomographyInit.cc:(.text+0x385): undefined reference to `dgesvd_'

I think I need to add lapack library somehow to my Makefile. Here is part of my Makefile:

CC = g++
COMPILEFLAGS = -I MY_CUSTOM_INCLUDE_PATH -D_LINUX -D_REENTRANT -Wall  -O3 -march=nocona -msse3
LINKFLAGS = -L MY_CUSTOM_LINK_PATH -lGVars3 -lcvd 

I tried doing the following to no avail:

CC = g++
COMPILEFLAGS = -I MY_CUSTOM_INCLUDE_PATH -D_LINUX -D_REENTRANT -Wall  -O3 -march=nocona -msse3
LINKFLAGS = -L MY_CUSTOM_LINK_PATH -lGVars3 -lcvd **-llapack** 

Result:

make
...
/usr/bin/ld: cannot find -llapack
collect2: ld returned 1 exit status

How can I add lapack to my project? I am pretty sure I installed it correctly, though would be willing to double-check that somehow.

Was it helpful?

Solution

It looks like liblapack isn't in the path that ld can find. I would suggest two things:

  1. Establish a symbolic link manually. It is possible (and sometimes common) that ld cannot recognize liblapack.so.3gf or liblapack.so.3.0.1 or so are essentially liblapack.so. You can set up a link by ln -s liblapack.so.3gf liblapack.so
  2. Install liblapack-dev package instead if you're using ubuntu or debian repos. For some unclear reasons, liblapack3gf is not the same as liblapack-dev. I am not sure if in any circumstances, both will do or not do the same thing.

I think the first item should be able to resolve your problem (hopefully).

OTHER TIPS

On my computer the dynamic library is in /usr/lib64/liblapack.so.3.4.1 and contains the requested symbol:

$ nm -D /usr/lib64/liblapack.so.3.4.1 | grep dgesvd
0000000000189200 T dgesvd_

So I would guess that the place where your lapack is installed is not in the linker search path. You should add the flag -L/path/to/the/lapackdir to LINKFLAGS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top