Re: linking error when using geev function

Peter Gottschling <[email protected]> Mon, 16 Apr 2007 09:06:37 -0400
Newsgroups gmane.comp.lib.mtl.devel
Message-ID <[email protected]>
--===============0534090551==
Content-Type: multipart/alternative; boundary=Apple-Mail-14-853102073


--Apple-Mail-14-853102073
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed

Hi Nadir,

I looked into the configuration and source files and got the  
impression that it might take some time to fix this cleanly.

The build system has a compiler-dependent support of single and  
double trailing underscores in Fortran function names in libraries.   
Right now there seems to be no support  for a leading underscore.

A way that might fix your problem (although not very elegantly) could  
be to

1.) replace in mtl2lapack.h

#define MTL_FCALL(x) x##_

with

#define MTL_FCALL(x) _##x##_

2.) replace in lapack_interface.h

   void dgeev_(const char& jobvl, const char& jobvr,

with

   void _dgeev_(const char& jobvl, const char& jobvr,

I hope this works.

Best,
Peter


On Apr 14, 2007, at 10:02 AM, CIHAN NADIR KAPLAN wrote:

> Hi,
>
> On cygwin (gcc 3.4.4), using MTL 2.1.2-23, I succesfully compiled  
> all of the test programs.
>
> In my own program, however, I use geev function, and I realized  
> that even if the program is compiled, there is a link error. The  
> same error arises in the geev.cc example program as well. When  
> configuring MTL, I used the --with-lapack="-llapack -lblas -lg2c",  
> too, but this didn't solve my problem (lapack libraries are  
> properly seen when running ./configure).
>
> How can I solve this problem? Any help will be greatly appreciated...
>
> Following lines are the error in question:
>
> CIKAPLAN@noooo /cygdrive/d/downloads/c++/mtl/mtl-2.1.2-23.tentative/ 
> mtl-2.1.2-23/contrib/examples
> $ g++ geev.cc
> /cygdrive/c/DOCUME~1/CIKAPLAN/LOCALS~1/Temp/cc5eR3QS.o:geev.cc: 
> (.text 
> $_ZN19mtl_lapack_dispatch4geevERKcS1_RKiPdS3_PSt7complexIdES4_S3_S4_S3 
> _Ri[mtl_lapack_dispatch::geev(char const&, char const&, int const&,  
> double*, int const&, std::complex<double>*, double*, int const&,  
> double*, int const&, int&)]+0xad): undefined reference to `_dgeev_'
> collect2: ld returned 1 exit status
>
> Regards
> Nadir
>
>
>
>
> _______________________________________________
> This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/

------------
Peter Gottschling
Research Associate
Open Systems Laboratory
Indiana University
135 Lindley Hall
Bloomington, IN 47405
Tel.: +1 812 855-3608   Fax: +1 812 856 0853
http://www.osl.iu.edu/~pgottsch



--Apple-Mail-14-853102073
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=ISO-8859-1

<HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; =
-khtml-line-break: after-white-space; ">Hi Nadir,<DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>I looked into the =
configuration and source files and got the impression that it might take =
some time to fix this cleanly.=A0</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>The build system has a =
compiler-dependent support of single and double trailing underscores in =
Fortran function names in libraries.=A0 Right now there seems to be no =
support=A0 for a leading underscore.=A0</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>A way that might fix your =
problem (although not very elegantly) could be to=A0</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>1.) replace in =
mtl2lapack.h</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>#define MTL_FCALL(x) =
x##_</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>with=A0</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>#define MTL_FCALL(x) =
_##x##_</DIV><DIV><BR class=3D"khtml-block-placeholder"></DIV><DIV>2.) =
replace in lapack_interface.h</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>=A0 void dgeev_(const =
char&amp; jobvl, const char&amp; jobvr,</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>with=A0</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>=A0 void _dgeev_(const =
char&amp; jobvl, const char&amp; jobvr,</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>I hope this =
works.</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Best,</DIV><DIV>Peter</DIV><D=
IV><BR class=3D"khtml-block-placeholder"></DIV><DIV><BR><DIV><DIV>On Apr =
14, 2007, at 10:02 AM, CIHAN NADIR KAPLAN wrote:</DIV><BR =
class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite"><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">Hi,</DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: =
14px; "><BR></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">On cygwin (gcc 3.4.4), using MTL =
2.1.2-23, I succesfully compiled all of the test programs.</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">In my =
own program, however, I use geev function, and I realized that even if =
the program is compiled, there is a link error. The same error arises in =
the geev.cc example program as well. When configuring MTL, I used the =
--with-lapack=3D"-llapack -lblas -lg2c", too, but this didn't solve my =
problem (lapack libraries are properly seen when running =
./configure).</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">How can I solve this problem? Any help will be =
greatly appreciated...</DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; =
"><BR></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">Following lines are the error in =
question:</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">CIKAPLAN@noooo =
/cygdrive/d/downloads/c++/mtl/mtl-2.1.2-23.tentative/mtl-2.1.2-23/contrib/=
examples</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">$ g++ geev.cc<SPAN =
class=3D"Apple-converted-space">=A0 =A0</SPAN></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; =
">/cygdrive/c/DOCUME~1/CIKAPLAN/LOCALS~1/Temp/cc5eR3QS.o:geev.cc:(.text$_Z=
N19mtl_lapack_dispatch4geevERKcS1_RKiPdS3_PSt7complexIdES4_S3_S4_S3_Ri[mtl=
_lapack_dispatch::geev(char const&amp;, char const&amp;, int const&amp;, =
double*, int const&amp;, std::complex&lt;double&gt;*, double*, int =
const&amp;, double*, int const&amp;, int&amp;)]+0xad): undefined =
reference to `_dgeev_'</DIV><DIV style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; ">collect2: ld returned 1 =
exit status</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">Regards</DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; =
">Nadir</DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; =
min-height: 14px; "><BR></DIV><DIV style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: =
14px; "><BR></DIV><DIV style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; =
">_______________________________________________</DIV><DIV =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">This list is archived at <A =
href=3D"http://www.osl.iu.edu/MailArchives/mtl-devel/">http://www.osl.iu.e=
du/MailArchives/mtl-devel/</A></DIV> </BLOCKQUOTE></DIV><BR><DIV> <SPAN =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><SPAN =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; =
"><DIV>------------</DIV><DIV>Peter Gottschling</DIV><DIV>Research =
Associate</DIV><DIV>Open Systems Laboratory</DIV><DIV>Indiana =
University</DIV><DIV>135=A0Lindley Hall</DIV><DIV>Bloomington, IN =
47405</DIV><DIV>Tel.: +1 812 855-3608=A0 =A0Fax: +1 812 856 =
0853</DIV><DIV><A =
href=3D"http://www.osl.iu.edu/~pgottsch">http://www.osl.iu.edu/~pgottsch</=
A></DIV><BR class=3D"Apple-interchange-newline"></SPAN></SPAN> =
</DIV><BR></DIV></BODY></HTML>=

--Apple-Mail-14-853102073--

--===============0534090551==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/
--===============0534090551==--