public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* undefined reference to libquadmath routines
@ 2011-06-07 11:17 Syed Bilal Mehdi
  2011-06-07 13:46 ` Ian Lance Taylor
  0 siblings, 1 reply; 6+ messages in thread
From: Syed Bilal Mehdi @ 2011-06-07 11:17 UTC (permalink / raw)
  To: gcc-help


I just got gcc 4.6 built successfully. I was trying libquadmath with the
following test code:

http://gcc.gnu.org/onlinedocs/libquadmath/quadmath_005fsnprintf.html#quadmath_005fsnprintf

but I get the following errors:

/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:13:
undefined reference to `sqrtq(__float128)'
/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:14:
undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
...)'
/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:18:
undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
...)'
/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:22:
undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
...)'
/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:28:
undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
...)'
/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:18:
undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
...)'

What am I missing here. I tried specifying -lquadmath but that didn't help!!
-- 
View this message in context: http://old.nabble.com/undefined-reference-to-libquadmath-routines-tp31790381p31790381.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined reference to libquadmath routines
  2011-06-07 11:17 undefined reference to libquadmath routines Syed Bilal Mehdi
@ 2011-06-07 13:46 ` Ian Lance Taylor
  2011-06-07 19:20   ` Syed Bilal Mehdi
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Lance Taylor @ 2011-06-07 13:46 UTC (permalink / raw)
  To: Syed Bilal Mehdi; +Cc: gcc-help

Syed Bilal Mehdi <bilal.mehdi87@gmail.com> writes:

> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:13:
> undefined reference to `sqrtq(__float128)'
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:14:
> undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
> ...)'
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:18:
> undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
> ...)'
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:22:
> undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
> ...)'
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:28:
> undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
> ...)'
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:18:
> undefined reference to `quadmath_snprintf(char*, unsigned int, char const*,
> ...)'
>
> What am I missing here. I tried specifying -lquadmath but that didn't help!!

The format of those errors tells me that you are calling these as C++
functions, but they are written in C.  There is a missing extern "C"
somewhere.

In fact, it's in quadmath.h.  That's a bug.  Please file a bug report
for it.  Thanks.

In the meantime, write this:

extern "C" {
#include "quadmath.h"
}

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined reference to libquadmath routines
  2011-06-07 13:46 ` Ian Lance Taylor
@ 2011-06-07 19:20   ` Syed Bilal Mehdi
  2011-06-07 19:58     ` Jeffrey Walton
  2011-06-08  0:00     ` Jonathan Wakely
  0 siblings, 2 replies; 6+ messages in thread
From: Syed Bilal Mehdi @ 2011-06-07 19:20 UTC (permalink / raw)
  To: gcc-help


That solved the problem. But now there is another problem. If I miss adding
-lfortran as external library, I get the following error during build of my
test code

/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:15:
undefined reference to `sqrtq'
/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:16:
undefined reference to `quadmath_snprintf'
/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:20:
undefined reference to `quadmath_snprintf'
/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:24:
undefined reference to `quadmath_snprintf'
/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:30:
undefined reference to `quadmath_snprintf'
/site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:20:
undefined reference to `quadmath_snprintf'

And when I do add  -lgfortran as external library, the build goes successful
but I get the following error during runtime

./test: error while loading shared libraries: libgfortran.so.3: cannot open
shared object file: No such file or directory

Is it a bug again? or am I missing something this time? and why is fortran
important here?


Ian Lance Taylor-3 wrote:
> 
> Syed Bilal Mehdi <bilal.mehdi87@gmail.com> writes:
> 
>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:13:
>> undefined reference to `sqrtq(__float128)'
>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:14:
>> undefined reference to `quadmath_snprintf(char*, unsigned int, char
>> const*,
>> ...)'
>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:18:
>> undefined reference to `quadmath_snprintf(char*, unsigned int, char
>> const*,
>> ...)'
>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:22:
>> undefined reference to `quadmath_snprintf(char*, unsigned int, char
>> const*,
>> ...)'
>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:28:
>> undefined reference to `quadmath_snprintf(char*, unsigned int, char
>> const*,
>> ...)'
>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:18:
>> undefined reference to `quadmath_snprintf(char*, unsigned int, char
>> const*,
>> ...)'
>>
>> What am I missing here. I tried specifying -lquadmath but that didn't
>> help!!
> 
> The format of those errors tells me that you are calling these as C++
> functions, but they are written in C.  There is a missing extern "C"
> somewhere.
> 
> In fact, it's in quadmath.h.  That's a bug.  Please file a bug report
> for it.  Thanks.
> 
> In the meantime, write this:
> 
> extern "C" {
> #include "quadmath.h"
> }
> 
> Ian
> 
> 

-- 
View this message in context: http://old.nabble.com/undefined-reference-to-libquadmath-routines-tp31790381p31794507.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined reference to libquadmath routines
  2011-06-07 19:20   ` Syed Bilal Mehdi
@ 2011-06-07 19:58     ` Jeffrey Walton
  2011-06-08  0:00     ` Jonathan Wakely
  1 sibling, 0 replies; 6+ messages in thread
From: Jeffrey Walton @ 2011-06-07 19:58 UTC (permalink / raw)
  To: Syed Bilal Mehdi; +Cc: gcc-help

On Tue, Jun 7, 2011 at 2:40 PM, Syed Bilal Mehdi
<bilal.mehdi87@gmail.com> wrote:
>
> That solved the problem. But now there is another problem. If I miss adding
> -lfortran as external library, I get the following error during build of my
> test code
>
> [SNIP]
> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:20:
> undefined reference to `quadmath_snprintf'
Then don't do that ;)

> And when I do add  -lgfortran as external library, the build goes successful
> but I get the following error during runtime
>
> ./test: error while loading shared libraries: libgfortran.so.3: cannot open
> shared object file: No such file or directory
>
> Is it a bug again? or am I missing something this time? and why is fortran
> important here?
Is libgfortran.so installed and available? `whereis libgfortran.so` or
`file libgfortran.so` should let you know if its installed. `ldconfig
-p | grep -i libgfortran` should tell you if its available.

Jeff

>
> Ian Lance Taylor-3 wrote:
>>
>> Syed Bilal Mehdi <bilal.mehdi87@gmail.com> writes:
>>
>>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:13:
>>> undefined reference to `sqrtq(__float128)'
>>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:14:
>>> undefined reference to `quadmath_snprintf(char*, unsigned int, char
>>> const*,
>>> ...)'
>>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:18:
>>> undefined reference to `quadmath_snprintf(char*, unsigned int, char
>>> const*,
>>> ...)'
>>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:22:
>>> undefined reference to `quadmath_snprintf(char*, unsigned int, char
>>> const*,
>>> ...)'
>>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:28:
>>> undefined reference to `quadmath_snprintf(char*, unsigned int, char
>>> const*,
>>> ...)'
>>> /site/ae/shares/MotionLab/papers/pingpong/examples/LongDoublePrecisionTests/test.cpp:18:
>>> undefined reference to `quadmath_snprintf(char*, unsigned int, char
>>> const*,
>>> ...)'
>>>
>>> What am I missing here. I tried specifying -lquadmath but that didn't
>>> help!!
>>
>> The format of those errors tells me that you are calling these as C++
>> functions, but they are written in C.  There is a missing extern "C"
>> somewhere.
>>
>> In fact, it's in quadmath.h.  That's a bug.  Please file a bug report
>> for it.  Thanks.
>>
>> In the meantime, write this:
>>
>> extern "C" {
>> #include "quadmath.h"
>> }
>>
>> Ian
>>
>>
>
> --
> View this message in context: http://old.nabble.com/undefined-reference-to-libquadmath-routines-tp31790381p31794507.html
> Sent from the gcc - Help mailing list archive at Nabble.com.
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined reference to libquadmath routines
  2011-06-07 19:20   ` Syed Bilal Mehdi
  2011-06-07 19:58     ` Jeffrey Walton
@ 2011-06-08  0:00     ` Jonathan Wakely
  2011-06-09  4:52       ` Syed Bilal Mehdi
  1 sibling, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2011-06-08  0:00 UTC (permalink / raw)
  To: Syed Bilal Mehdi; +Cc: gcc-help

On 7 June 2011 19:40, Syed Bilal Mehdi wrote:
>
> And when I do add  -lgfortran as external library, the build goes successful
> but I get the following error during runtime
>
> ./test: error while loading shared libraries: libgfortran.so.3: cannot open
> shared object file: No such file or directory

See http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths
and the page it links to.

That is talking about the C++ runtime library but the same rules apply
to the other GCC runtime libraries.

> Is it a bug again? or am I missing something this time? and why is fortran
> important here?

I think libquadmath was added for gfortran and I assume it has a
dependency on it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: undefined reference to libquadmath routines
  2011-06-08  0:00     ` Jonathan Wakely
@ 2011-06-09  4:52       ` Syed Bilal Mehdi
  0 siblings, 0 replies; 6+ messages in thread
From: Syed Bilal Mehdi @ 2011-06-09  4:52 UTC (permalink / raw)
  To: gcc-help


libgfortran was installed with gcc 4.6, I just needed to add the path to
LD_LIBRARY_PATH.

Thanks


Jonathan Wakely-4 wrote:
> 
> On 7 June 2011 19:40, Syed Bilal Mehdi wrote:
>>
>> And when I do add  -lgfortran as external library, the build goes
>> successful
>> but I get the following error during runtime
>>
>> ./test: error while loading shared libraries: libgfortran.so.3: cannot
>> open
>> shared object file: No such file or directory
> 
> See http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths
> and the page it links to.
> 
> That is talking about the C++ runtime library but the same rules apply
> to the other GCC runtime libraries.
> 
>> Is it a bug again? or am I missing something this time? and why is
>> fortran
>> important here?
> 
> I think libquadmath was added for gfortran and I assume it has a
> dependency on it.
> 
> 

-- 
View this message in context: http://old.nabble.com/undefined-reference-to-libquadmath-routines-tp31790381p31804950.html
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-06-08 22:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-07 11:17 undefined reference to libquadmath routines Syed Bilal Mehdi
2011-06-07 13:46 ` Ian Lance Taylor
2011-06-07 19:20   ` Syed Bilal Mehdi
2011-06-07 19:58     ` Jeffrey Walton
2011-06-08  0:00     ` Jonathan Wakely
2011-06-09  4:52       ` Syed Bilal Mehdi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).