Skip to content

Instantly share code, notes, and snippets.

@Xliff
Created April 15, 2019 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xliff/2cb5ae39efaf14a88e83d56960c03332 to your computer and use it in GitHub Desktop.
Save Xliff/2cb5ae39efaf14a88e83d56960c03332 to your computer and use it in GitHub Desktop.
NativeCall Can't Find My Function!

I recently compiled a shared lib from a directory of object fules, using the following invocation:

gcc -shared -fPIC -o libgtksourceview-core.so *.o `pkg-config gtk+-3.0 --libs` -lxml2`

This gave me a .so file that I was going to use with some NativeCall code. Well! Long story short: It didn't work:

Cannot locate symbol '_gtk_source_iter_forward_full_word_end' in native library '/home/cbwood/Projects/p6-SourceViewGTK/t/lib/libgtksourceview-core.so'
  in method setup at

This is a bit confusing, since I can see the symbol just fine via readelf:

$ readelf -s --wide *.so | grep _gtk | grep word_end
  1704: 0000000000046d30   630 FUNC    LOCAL  DEFAULT   12 _gtk_source_iter_forward_visible_word_end
  1714: 0000000000046290   273 FUNC    LOCAL  DEFAULT   12 _gtk_source_iter_forward_full_word_end
  1764: 0000000000046740   378 FUNC    LOCAL  DEFAULT   12 _gtk_source_iter_forward_extra_natural_word_end
  1776: 0000000000047300   200 FUNC    LOCAL  DEFAULT   12 _gtk_source_iter_forward_visible_word_ends

My NativeCall definition is clear enough:

sub _gtk_source_iter_forward_full_word_end (GtkTextIter $iter)
  is native(sourceview_core)
  is export
  { * }

What am I doing wrong? Do I need to recompile my shared library again?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment