upgrade to ubuntu 12.04 breaks compiling

A. Grigoryants ar.grig7 at gmail.com
Mon Sep 10 19:36:13 CEST 2012


On 09/10/2012 08:36 PM, Marc Glisse wrote:
> On Mon, 10 Sep 2012, A. Grigoryants wrote:
>
>> the code was compiled OK on Ubuntu 10.04 64-bit
>> when upgrading to 12.04 64-bit the error occurs :
>>
>>
>> In function `std::basic_istream<char, std::char_traits<char> >& 
>> operator>><__mpz_struct [1]>(std::basic_istream<char, 
>> std::char_traits<char>
>>> &, __gmp_expr<__mpz_struct [1], __mpz_struct [1]>&)':
>> /usr/include/gmpxx.h:2100: undefined reference to 
>> `operator>>(std::basic_istream<char, std::char_traits<char> >&, 
>> __mpz_struct*)'
>>
>> any direction to search, please .......
>
> Well, if you want help with code that fails to compile, it helps to 
> show the code, and the command you use to compile. Crystal ball says 
> you are missing -lgmpxx, but then it shouldn't have worked before either.
>
Well, your Crystal ball is wrong this time :-)  I saw the case when it 
was true :-) ... And you are true about "shouldn't have worked before" :-)

this is compilation string and compiler reply:
g++ -w -I.. -I. -o prog/fund_sys_chk.run  prog/fund_sys_chk.cpp -L. -L.. 
-lgmp -lgmpxx -lmy

./libmy.a(myvect.o): In function `std::basic_ostream<char, 
std::char_traits<char> >& operator<< <__mpz_struct 
[1]>(std::basic_ostream<char, std::char_traits<char> >&, 
__gmp_expr<__mpz_struct [1], __mpz_struct [1]> const&)':
/usr/include/gmpxx.h:2085: undefined reference to 
`operator<<(std::basic_ostream<char, std::char_traits<char> >&, 
__mpz_struct const*)'
./libmy.a(myvect.o): In function `std::basic_istream<char, 
std::char_traits<char> >& operator>><__mpz_struct 
[1]>(std::basic_istream<char, std::char_traits<char> >&, 
__gmp_expr<__mpz_struct [1], __mpz_struct [1]>&)':
/usr/include/gmpxx.h:2100: undefined reference to 
`operator>>(std::basic_istream<char, std::char_traits<char> >&, 
__mpz_struct*)'

it shows undefined reference in gmpxx.h line 2085 and 2100 which is 
something confusing ...
the error is from gmp code ... my code shows no errors ...
The bad news are that I am not professional programmer ...

but static library is in place :

  ar at masteralgebra:~/alg$ find /usr/lib/ -iname libgmp\*.a
/usr/lib/x86_64-linux-gnu/libgmpxx.a
/usr/lib/x86_64-linux-gnu/libgmp.a

and the path /usr/lib/x86_64-linux-gnu/ is in the default library path 
.... when this path is set explicitly by -L option the answer is the 
same ....

the gmp packages installed are :

ar at masteralgebra:~/alg$ dpkg -l | grep gmp | grep ii
ii  libgmp-dev 2:5.0.2+dfsg-2ubuntu1               Multiprecision 
arithmetic library developers tools
ii  libgmp10 2:5.0.2+dfsg-2ubuntu1               Multiprecision 
arithmetic library
ii  libgmp3-dev 2:5.0.2+dfsg-2ubuntu1               Multiprecision 
arithmetic library developers tools
ii  libgmpxx4ldbl 2:5.0.2+dfsg-2ubuntu1               Multiprecision 
arithmetic library (C++ bindings)






More information about the gmp-discuss mailing list