Share 
Follow 
AboutDownloadsDocumentsForumsSource CodeIssues
Date:
2017-01-25 23:14
Priority:
3
State:
Open
Submitted by:
Nobody
Assigned to:
Nobody (None)
Summary:
linking problem with undefined reference to dgesvn

Detailed description
Anonymous message posted by gschenk@stanford.edu

I am posting my email conversation with Rasmus here, so that people with the same issue can benefit, hopefully. Read bottom up.

Hi Rasmus,

I have found a way to change the link command to the correct order. I simply
added
link_libraries( libKGS )
before the GSL and MKL libraries are added in CMakeLists.txt (see attachment).

I suppose then one could also simplify the executables' definitions further
down. Hope this doesn't break anything on some other platform. For me it seems
to work.

Cheers,
Gundolf.


On Wednesday, January 25, 2017 1:37:12 PM PST Gundolf Schenk wrote:
> Dear Rasmus,
>
> I think I have found the bug:
> Somehow the order of the libraries matter when linking. For example, the
> original command in the Makefile is:
> /usr/bin/c++ -std=c++11 -D__INTEL_MKL -O3 -DNDEBUG CMakeFiles/
> kgs_rmsd.dir/applications/MainRmsd.cpp.o -o kgs_rmsd -rdynamic -
> lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread libKGS.a -L/
> usr/lib -lgsl -lgslcblas -lm
>
> This produces the error. But when I changed the command to:
> /usr/bin/c++ -std=c++11 -D__INTEL_MKL -O3 -DNDEBUG CMakeFiles/
> kgs_rmsd.dir/applications/MainRmsd.cpp.o -o kgs_rmsd -rdynamic libKGS.a -
> lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -L/usr/lib -
> lgsl -lgslcblas -lm
>
> the linking works. Since the Makefile is produced by cmake, we would need to
> change the Cmake script somehow. Do you have any clue how to do this?
>
> Cheers,
> Gundolf.
>
> On Wednesday, January 25, 2017 11:50:36 AM PST Gundolf Schenk wrote:
> > Dear Rasmus,
> >
> > thanks for your quick reply. I have sourced the file that you pointed out,
> > but no success. Do you know where the dgesvd function is implemented?
> > Also,
> > which version of MKL was KGS tested with?
> >
> > Cheers,
> > Gundolf.
> >
> > On Tuesday, January 24, 2017 4:53:01 PM PST you wrote:
> > > Hi Gundolf.
> > >
> > > Did you fully set up the MKL libraries before running make? The
> > > LD_LIBRARY_PATH variable needs to contain the directory with libmkl.so
> > > etc.
> > > and this is most conveniently done by
> > >
> > > $ source /path/to/mklOrIntel/bin/compilervars.sh intel64
> > >
> > > which can also be added to your .bashrc. This is my best guess right
> > > now.
> > >
> > > Rasmus
> > >
> > > 2017-01-24 23:25 GMT+01:00 Gundolf Schenk <gschenk@stanford.edu>:
> > > > Dear Rasmus,
> > > >
> > > > hope this email finds you well. I am trying to build KGS on our
> > > > group's
> > > > server
> > > > (Ubuntu 14.04.5 LTS). Do you think you could help me with the
> > > > following
> > > > problem?
> > > >
> > > > I get an undefined reference to dgesvd when I do this:
> > > >
> > > > ~/src/KGS/build$ make
> > > > [ 88%] Built target libKGS
> > > > Linking CXX executable kgs_ensemble_pca
> > > > libKGS.a(SVDMKL.cpp.o): In function `SVDMKL::UpdateFromMatrix()':
> > > > SVDMKL.cpp:(.text+0x211): undefined reference to `dgesvd'
> > > > SVDMKL.cpp:(.text+0x2c3): undefined reference to `dgesvd'
> > > > collect2: error: ld returned 1 exit status
> > > > make[2]: *** [kgs_ensemble_pca] Error 1
> > > > make[1]: *** [CMakeFiles/kgs_ensemble_pca.dir/all] Error 2
> > > > make: *** [all] Error 2
> > > > ~/src/KGS/build$
> > > >
> > > > Do you have any idea of what is causing the error? I have tried
> > > > linking
> > > > explicitly to the MKL library but no success so far. Maybe something
> > > > went
> > > > wrong during cmake?
> > > >
> > > > Many thanks,
> > > > Gundolf.

Add A Comment: Notepad

Comments:

No Comments Have Been Posted

Attached Files:

Attachments:
Size Name Date By Download
8.26 KBCMakeLists.txt2017-01-25 23:14NoneCMakeLists.txt

Changes

Field Old Value Date By
File Added623: CMakeLists.txt2017-01-25 23:14None
Feedback