lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I finally been able to demonstrate that have Lua 5.1 running with dynamic
loading on AIX 5.2.  With Lua in a nonstandard directory "/mydirectory",
the correct command to compile dummy.c (specified below) was:

xlc -I/mydirectory/include -L/mydirector/lib -llua -lm -o dummy.so
-qmkshrobj dummy.c

It was necessary to link libm to get some math functions.  Running "lua -v
-ldummy" then produced the desired "hello from dummy" message.  Yippee.

To compile Lua 5.1 on AIX 5.2, it is first necessary to edit /src/Makefile
to set CC = xlc and to delete "-Wall" from CFLAGS.  It is then sufficient
to go "make solaris", "make test", "make install".

So.  Lua 5.1 compiles with dynamic loading on AIX 5.2.

Mark F. Morss
Principal Analyst, Market Risk
American Electric Power



                                                                           
             mfmorss@aep.com                                               
             Sent by:                                                      
             lua-bounces@bazar                                          To 
             2.conectiva.com.b         Lua list                            
             r                         <lua@bazar2.conectiva.com.br>       
                                                                        cc 
                                       Lua list                            
             02/14/2006 12:29          <lua@bazar2.conectiva.com.br>,      
             PM                        lua-bounces@bazar2.conectiva.com.br 
                                                                   Subject 
                                       Re: installing Lua 5.1 on AIX 5.2   
             Please respond to                                             
                 Lua list                                                  
             <lua@bazar2.conec                                             
               tiva.com.br>                                                
                                                                           
                                                                           




I would like to return to this issue, which is to test dynamic loading
after an apparently successful Lua 5.1 installation on AIX.

I created "dummy.c" as specified below in .../lua-5.1/src, and with that as
the current directory, I issued the command:

cc -qmkshrobj -o dummy.so dummy.c

which is how, to the best of my knowledge, to translate "gcc -o dummy.so
-shared dummy.c" (suggested below) to the AIX xlc compiler which I have
here on my machine.

The result was that ".lua_pushnil" was unrecognized during "ld".  I am not
expert at all in C, but I do not understand how the "lua_pushnil" is seen
as undefined, given that its template appears in the included file, lua.h.

Adding "-bnoquiet" to the above command, the output I obtained was:

(ld): halt 4
(ld): lrgpage 0
(ld): savename dummy.so
(ld): filelist 2 2
(ld): setopt noprogram
(ld): noentry
NOENTRY: There is no entry point.
(ld): i dummy.o
(ld): lib /usr/lib/libc.a
LIBRARY: Shared object libc.a[shr.o]: 2562 symbols imported.
LIBRARY: Shared object libc.a[meth.o]: 2 symbols imported.
LIBRARY: Shared object libc.a[posix_aio.o]: 17 symbols imported.
LIBRARY: Shared object libc.a[aio.o]: 11 symbols imported.
LIBRARY: Shared object libc.a[pse.o]: 5 symbols imported.
LIBRARY: Shared object libc.a[dl.o]: 4 symbols imported.
LIBRARY: Shared object libc.a[pty.o]: 1 symbols imported.
FILELIST: Number of previously inserted files processed: 2
(ld): exports /tmp/xlcSEP4yaUe
EXPORTS: Symbols exported: 1
(ld): resolve
RESOLVE: 7 of 2978 symbols were kept.
(ld): addgl /usr/lib/glink.o
ADDGL: Glink code added for 2 symbols.
(ld): er full
ld: 0711-318 ERROR: Undefined symbols were found.
             The following symbols are in error:
 Symbol                    Inpndx  TY CL Source-File(Object-File) OR
Import-File{Shared-object}
                              RLD: Address  Section  Rld-type Referencing
Symbol

----------------------------------------------------------------------------------------------


 .lua_pushnil              [26]    ER PR dummy.c(dummy.o)
                                   00000028 .text    R_RBR    [12]
.luaopen_dummy
ER: The return code is 8.


Mark F. Morss
Principal Analyst, Market Risk
American Electric Power



             Luiz Henrique de
             Figueiredo
             <lhf@tecgraf.puc-                                          To
             rio.br>                   Lua list
             Sent by:                  <lua@bazar2.conectiva.com.br>
             lua-bounces@bazar                                          cc
             2.conectiva.com.b
             r                                                     Subject
                                       Re: installing Lua 5.1 on AIX 5.2

             02/01/2006 10:03
             AM


             Please respond to
                 Lua list
             <lua@bazar2.conec
               tiva.com.br>






> Is there something in particular to do to test this?  Lua comes up fine
> interractively; I'm not sure how to tell if the dynamic loading is
enabled,
> but I did notice that the correct options were used during the
compilation.

If the linking went ok then at least dlopen and friends were found.
The question is whether dynamic loading is working, not merely enabled.
So try this in src/:

% cat >dummy.c

#include <stdio.h>
#include "lua.h"

int luaopen_dummy (lua_State *L) {
  puts("hello from dummy");
  lua_pushnil(L);
  return 0;
}

(hit ^D here)

% gcc -o dummy.so -shared dummy.c
% lua -v -ldummy

If you see "hello from dummy", all is well.
If you see "undefined symbol: lua_pushnil", then dynamic loading is not
working.

--lhf