public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Help needed with loading a gcc plugin
@ 2013-06-22  7:31 Sandeep K Chaudhary
  2013-06-22 22:02 ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Sandeep K Chaudhary @ 2013-06-22  7:31 UTC (permalink / raw)
  To: gcc-help

Hi guys,

I am trying to run a gcc plugin that I created. I have followed the
steps mentioned in the followiing tutorial to create the plugin

http://lwn.net/Articles/457543/

I am able to successfully build the plugin shared object. However, I
can not run the plugin. It gives errors related to undefined symbols.
Below is the terminal snippet.

sandeep@ubuntu:~/myplugin$ /usr/bin/gcc
-fplugin=/home/sandeep/myplugin/speller.so -c test.c
cc1: error: cannot load plugin /home/sandeep/myplugin/speller.so
/home/sandeep/myplugin/speller.so: undefined symbol: warning_at

I can see that the mentioned symbol is indeed undefined using following

sandeep@ubuntu:~/myplugin$ nm -D -C speller.so | grep warning_at
U warning_at

And I see that

sandeep@ubuntu:/usr/lib/gcc/x86_64-linux-gnu/4.7.2$ pwd
/usr/lib/gcc/x86_64-linux-gnu/4.7.2
sandeep@ubuntu:/usr/lib/gcc/x86_64-linux-gnu/4.7.2$ nm -D -C $(gcc
-print-file-name=cc1) | grep "warning_"
0000000000c1e5a0 T warning_at(unsigned int, int, char const*, ...)

What am I missing? How should I link the libraries correctly?

Please help.

Thanks,
Sandeep.

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

* Re: Help needed with loading a gcc plugin
  2013-06-22  7:31 Help needed with loading a gcc plugin Sandeep K Chaudhary
@ 2013-06-22 22:02 ` Ian Lance Taylor
  2013-06-23  4:11   ` Sandeep K Chaudhary
  2013-06-25  6:00   ` Sandeep K Chaudhary
  0 siblings, 2 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2013-06-22 22:02 UTC (permalink / raw)
  To: Sandeep K Chaudhary; +Cc: gcc-help

On Sat, Jun 22, 2013 at 12:31 AM, Sandeep K Chaudhary
<babbusandy2006@gmail.com> wrote:

> cc1: error: cannot load plugin /home/sandeep/myplugin/speller.so

> 0000000000c1e5a0 T warning_at(unsigned int, int, char const*, ...)

> What am I missing? How should I link the libraries correctly?

You need to compile your plugin with the C++ compiler.

Ian

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

* Re: Help needed with loading a gcc plugin
  2013-06-22 22:02 ` Ian Lance Taylor
@ 2013-06-23  4:11   ` Sandeep K Chaudhary
  2013-06-25  6:00   ` Sandeep K Chaudhary
  1 sibling, 0 replies; 4+ messages in thread
From: Sandeep K Chaudhary @ 2013-06-23  4:11 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Hi Lance,

Thanks for the reply ! I tried using C++ instead of C compiler but I
still got the same error. I don't know what is wrong with the way I'm
trying to build/load my plugin.

Regards,
Sandeep.

On Sat, Jun 22, 2013 at 6:02 PM, Ian Lance Taylor <iant@google.com> wrote:
> On Sat, Jun 22, 2013 at 12:31 AM, Sandeep K Chaudhary
> <babbusandy2006@gmail.com> wrote:
>
>> cc1: error: cannot load plugin /home/sandeep/myplugin/speller.so
>
>> 0000000000c1e5a0 T warning_at(unsigned int, int, char const*, ...)
>
>> What am I missing? How should I link the libraries correctly?
>
> You need to compile your plugin with the C++ compiler.
>
> Ian



-- 
Thanks and regards,
Sandeep K Chaudhary.

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

* Re: Help needed with loading a gcc plugin
  2013-06-22 22:02 ` Ian Lance Taylor
  2013-06-23  4:11   ` Sandeep K Chaudhary
@ 2013-06-25  6:00   ` Sandeep K Chaudhary
  1 sibling, 0 replies; 4+ messages in thread
From: Sandeep K Chaudhary @ 2013-06-25  6:00 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

I was making a mistake in the Makefile. And yes, g++ worked. Thanks a lot !

Regards,
Sandeep.

On Sat, Jun 22, 2013 at 6:02 PM, Ian Lance Taylor <iant@google.com> wrote:
> On Sat, Jun 22, 2013 at 12:31 AM, Sandeep K Chaudhary
> <babbusandy2006@gmail.com> wrote:
>
>> cc1: error: cannot load plugin /home/sandeep/myplugin/speller.so
>
>> 0000000000c1e5a0 T warning_at(unsigned int, int, char const*, ...)
>
>> What am I missing? How should I link the libraries correctly?
>
> You need to compile your plugin with the C++ compiler.
>
> Ian



-- 
Thanks and regards,
Sandeep K Chaudhary.

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

end of thread, other threads:[~2013-06-25  6:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-22  7:31 Help needed with loading a gcc plugin Sandeep K Chaudhary
2013-06-22 22:02 ` Ian Lance Taylor
2013-06-23  4:11   ` Sandeep K Chaudhary
2013-06-25  6:00   ` Sandeep K Chaudhary

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).