Boost logo

Ublas :

Subject: [ublas] lapack bindings - linker errors in windows but not linux
From: P.L.W. Man (plwm2_at_[hidden])
Date: 2010-04-21 05:39:40


Dear all,

I have a problem very similar to msg#00005 - I am using the numeric
bindings (v1) for lapack/atlas etc. I'm pretty much a newbie to
programming. My C++ program compiles (and links) perfectly on Fedora 12,
using g++. However, when I try to compile on windows (either using
Microsoft VS 9.0 or compiling directly using g++ in cygwin), it compiles
perfectly, but the following linker errors result:

Microsoft VS: mcmc_main.obj : error LNK2019: unresolved external symbol
_dgeqrf referenced in function "void __cdecl
boost::numeric::bindings::lapack::detail::geqrf(int,int,double *,int,double
*,double *,int,int &)"
(?geqrf_at_detail@lapack_at_bindings@numeric_at_boost@@YAXHHPANH00HAAH_at_Z)

g++ (cygwin):
obj/mcmc_main.o:mcmc_main.cpp:(.text$_ZN5boost7numeric8bindings6lapack5geqrfINS0_5ublas6matrixIdNS4_18basic_column_majorIjiEENS4_13bounded_arrayIdLj300ESaIdEEEEENS4_6vectorIdNS4_15unbounded_arrayIdS9_EEEENS1_6traits6detail5arrayIdEEEEiRT_RT0_RT1_[int
boost::numeric::bindings::lapack::geqrf<boost::numeric::ublas::matrix<double,
boost::numeric::ublas::basic_column_major<unsigned int, int>,
boost::numeric::ublas::bounded_array<double, 300u, std::allocator<double> >
>, boost::numeric::ublas::vector<double,
boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >,
boost::numeric::bindings::traits::detail::array<double>
>(boost::numeric::ublas::matrix<double,
boost::numeric::ublas::basic_column_major<unsigned int, int>,
boost::numeric::ublas::bounded_array<double, 300u, std::allocator<double> >
>&, boost::numeric::ublas::vector<double,
boost::numeric::ublas::unbounded_array<double, std::allocator<double> > >&,
boost::numeric::bindings::traits::detail::array<double>&)]+0xac): undefined
reference to `_dgeqrf_'

The msg#00014 seems to indicate that the problem was due to something
called name mangling but tantalisingly does not provide the solution.
Having read (a very little) about name mangling, i tried the following
commands on the object files created for each of the three methods of
compiling:

MSVC 9.0 - "nm mcmc_main.obj | grep dgeqrf" - which returns "U _dgeqrf"
           - "nm -C mcmc_main.obj | grep dgeqrf" - which returns "U dgeqrf"

g++ cygwin - "nm mcmc_main.o | grep dgeqrf" - which returns "U _dgeqrf_"
           - "nm -C mcmc_main.o | grep dgeqrf" - which returns "U dgeqrf_"

g++ linux - "nm mcmc_main.o | grep dgeqrf" - which returns "U dgeqrf_"
           - "nm -C mcmc_main.o | grep dgeqrf" - which returns "U dgeqrf_"

Oh, and just in case this is relevant, the flags i used to compile my
program using g++ (cygwin or linux) is "-llapack -lcblas -lf77blas -latlas
-lm".

I would be extremely grateful if someone could enlighten me as to what is
going on and how to solve it! I have already spent two whole days on this!
Perhaps I should just simply work on linux...

Peter