Trouble building/loading shared libraries

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble building/loading shared libraries

Paul Chiusano
Hi,

I'm having problems loading a shared library, and I'm sure it is just
something really simple!

I followed the instructions at:
http://lua-users.org/wiki/BuildingModules to create the shared
library. This is on mac OS 10.4. When I go to load it from lua via
require 'numvector' (it's a numeric vector), I get the following
error:

lua: error loading module 'numvector' from file
'/Users/Paul/development/numeric/numvector.so':
       /Users/Paul/development/numeric/numvector.so:1: unexpected
symbol near 'þ'
stack traceback:
       [C]: ?
       [C]: in function 'require'
       (command line):1: in main chunk
       [C]: ?

Strange! I thought this might be something peculiar about my mac
setup, so I tried moving to linux and rebuilding the library. But I
get a similar error:

error loading module 'numvector' from file './numvector.so':
       ./numvector.so:1: unexpected symbol near 'char(127)'
stack traceback:
       [C]: ?
       [C]: in function 'require'
       stdin:1: in main chunk
       [C]: ?

Any help would be greatly appreciated!

-Paul


Reply | Threaded
Open this post in threaded view
|

Re: Trouble building/loading shared libraries

Romulo Bahiense
Check if your .so is located at the package.cpath and not package.path.
Probably, you are trying to load a c module instead of a Lua script file.

--rb

Reply | Threaded
Open this post in threaded view
|

Re: Trouble building/loading shared libraries

Fabian Peña
In reply to this post by Paul Chiusano
Have your module embedded lua code  in plain or precompiled format ?.
Please review as they are being loaded, or verifies that the carriage
returns are according to their platform.


Paul Chiusano wrote:
> Hi,
> 
> I'm having problems loading a shared library, and I'm sure it is just
> something really simple!
> 
> I followed the instructions at:
> http://lua-users.org/wiki/BuildingModules to create the shared
> library. This is on mac OS 10.4. When I go to load it from lua via
> require 'numvector' (it's a numeric vector), I get the following
> error:
> 
> lua: error loading module 'numvector' from file
> '/Users/Paul/development/numeric/numvector.so':
>        /Users/Paul/development/numeric/numvector.so:1: unexpected
> symbol near 'þ'
> stack traceback:
>        [C]: ?
>        [C]: in function 'require'
>        (command line):1: in main chunk
>        [C]: ?
> 
> Strange! I thought this might be something peculiar about my mac
> setup, so I tried moving to linux and rebuilding the library. But I
> get a similar error:
> 
> error loading module 'numvector' from file './numvector.so':
>        ./numvector.so:1: unexpected symbol near 'char(127)'
> stack traceback:
>        [C]: ?
>        [C]: in function 'require'
>        stdin:1: in main chunk
>        [C]: ?
> 
> Any help would be greatly appreciated!
> 
> -Paul
>