3

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.

0

2 Answers 2

4

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).

Sign up to request clarification or add additional context in comments.

Comments

1

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

10 Comments

Hmm, I don't even have the /usr/lib64/ folder (even though I'm on a 64-bit machine). I'm looking for liblapack.so right now.
I have: /usr/lib/liblapack.so.3gf. Should I put this in the Makefile somehow?
LINKFLAGS = -L MY_CUSTOM_LINK_PATH -lGVars3 -lcvd -L/usr/lib did not work, though I wouldn't be surprised if I made a syntax error here (not too sure what I'm doing tbh)
You should try LINKFLAGS = -L MY_CUSTOM_LINK_PATH -lGVars3 -lcvd -L/usr/lib -llapack. However, I don't really expect it to work. And please don't say "did not work" but report the problem. By the way, isn't there any missing $ in MY_CUSTOM_LINK_PATH ?
Just tried that, getting this error again: /usr/bin/ld: cannot find -llapack
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.