On 13/09/15 17:17, Gavin Wraith wrote:
>> That means that either you have compiled one or more C source files
>> without the -fPIC option or some hand written assembler (sys.s?)
>
> Yes. I then put in the -fPIC flag for compiling the library and tried
> again. This time I get errors of the kind
>
> can't resolve symbol 'lua_setmetatable'
>
> for each of the functions imported into the library.
Are these functions defined in the Lua runtime? Is the runtime a shared
library or is it in the executable (where main() is)?
If the plugin "libriscos.so" directly calls functions from a
LUA runtime shared library, then you should add "-l<runtime library
soname>" to the link line of "libriscos.so".
For example, if the runtime is called "libLuaRT.so", add "-lLuaRT".
If the plugin calls functions from the executable, then the executable
should be linked using the "-rdynamic" option. This tells the linker to
add all symbols to the dynamic symbol table, so that they are visible
to libraries loaded by dlopen.
> So should I be using -fPIC also when compiling the interpreter?
> What about -shared?
If the interpreter is the exectuable containing main(), then no, it
should not be built with -fPIC or -shared.
> The interpreter uses the convention that, after a library 'foo'
> has been loaded, the symbol (i.e. function name) to pass to
> dlopen is 'luaopen_foo'.
Do you mean dlsym here?
> This means that library names have
> to be valid identifiers in C, so I have rearranged things a bit
> so that dots and backslashes can be avoided. Now I have
> LUA_CPATH set to "/lua600:solib/?". The error messages I am now
> getting are evidently about linking, so the problems of filenaming
> appear to have been surmounted; for which many thanks.
We'll get there in the end :-)
Lee.
_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK
No comments:
Post a Comment