Jacks_Missing Type Information

Posted: 2014-08-06 07:31:24.267000

This error took me several days to solve, not having the best understanding of C++. Hopefully I can save someone else the trouble.

/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libskia_helper.so: undefined reference to `typeinfo for SkOSWindow'
collect2: error: ld returned 1 exit status
make: *** [goskia-install] Error 2

Here is an overview of what I am trying to do

Going from right to left, I am trying to get Skia into the project code named Funnel.

Skia is a Google project for hardware accelerated 2d graphics. The project builds into several archive files by default.

Skia_helper is a project I created to mask the C++ functions behind C functions. This is just a layer to do bindings.

Goskia is the heart of this effort. The Go compiler only builds libraries as archives. Not a bad idea, but it does make things slightly complicated. That's why skia_helper is a shared object while goskia is an archive.

Funnel is the program I am using to test. The result of everything done in the process. It's the only one that produces an executable program.

The Solution

The build tool they're using with skia seems to compile everything with the -fno-rtti argument. An explanation of what it does from gcc man page.

Disable generation of information about every class with virtual functions for use by the C++ run-time type identification features (dynamic_cast and typeid). If you don't use those parts of the language, you can save some space by using this flag. Note that exception handling uses the same information, but G++ generates it as needed. The dynamic_cast operator can still be used for casts that do not require run-time type information, i.e. casts to "void *" or to unambiguous base classes.

Summary put, it disables some runtime functionality built into C++. When I built the skia_helper project, I did not include this argument, not knowing what it did. Since the Go compiler is were all the linking is done, I didn't see any error until building the goskia project.

Simply add the -fno-rtti argument to all C++ projects after the first time it is used, and the error goes away.