lua-users home
lua-l archive

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


On Thu, Dec 3, 2009 at 1:58 PM, Francesco Abbate <gslshell@gmail.com> wrote:
> 2009/12/3 Sam Roberts <vieuxtech@gmail.com>:
>> Do you expect the gsl module to be useable independently of your
>> shell? The graphing capability in particular caught my attention.
>
> ENABLE_COMPLEX = yes
> BUILD_LUA_DLL = no
>
> To have a 100% orthodox GSL module you should build it by disable the
> complex number support and enable the build as a Lua DLL.
> Unfortunately if you disable complex numbers you will miss important
> submodules like FFT but other functions will be available. I recommend
> anyway to enable at least support for complex numbers.

Sorry, I've had lots of problems with LNUM before. Maybe it's better,
now, but I'm no longer a fan of hacking the interpreter.

And we are thinking of moving to Mike Pall's JIT, I don't think LNUM
is going to work with it.

Would complex support with a more portable, userdata-based approach
(like http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#lcomplex) be too,
uh, complex?

There are some problems with the build system.

Empty strings are being passed on the g++ command line:

make DEFS='""' PLATFORM=linux -C agg-plot
make[1]: Entering directory `/home/sroberts/s/gslshell/trunk/agg-plot'
echo g++ -O2 "" -I.. -I../lua/src -I../lua/etc -I/usr/include/agg2 -c cplot.cpp
g++ -O2 "" -I.. -I../lua/src -I../lua/etc -I/usr/include/agg2
-Wp,-MMD,.deps/cplot.pp -c cplot.cpp

Root cause is your call to recursive make doesn't work with an empty
SUBDIRS_DEFS, which occurs in "DLL" builds (maybe rename this to
"MODULE", btw). I did this to fix it:

Index: Makefile
===================================================================
--- Makefile    (revision 35)
+++ Makefile    (working copy)
@@ -64,6 +64,7 @@
   CFLAGS += -fpic
   DEFS += -DUSE_SEPARATE_NAMESPACE
   TARGETS = $(LUA_DLL)
+  SUBDIRS_DEFS += -DNO_GSL_SHELL
 else
   SUBDIRS_DEFS += -DGSL_SHELL
   TARGETS = $(GSL_SHELL)

Personally, I wouldn't use a recursive make system:

http://miller.emu.id.au/pmiller/books/rmch/

Troubleshooting this was made more painful by the use of "@" in the
Makefiles, because the echoed cmd line looked fine, but the real one
wasn't fine. I did this:

Index: agg-plot/Makefile
===================================================================
--- agg-plot/Makefile   (revision 35)
+++ agg-plot/Makefile   (working copy)
@@ -64,18 +64,17 @@
        $(RANLIB) $@

 %.o: %.cpp
-       @echo $(CXXCOMPILE) -c $<
-       @$(CXXCOMPILE) -Wp,-MMD,.deps/$(*F).pp -c $<
-       @-cp .deps/$(*F).pp .deps/$(*F).P; \
+       $(CXXCOMPILE) -Wp,-MMD,.deps/$(*F).pp -c $<
+       -cp .deps/$(*F).pp .deps/$(*F).P; \
        tr ' ' '\012' < .deps/$(*F).pp \
           | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
             >> .deps/$(*F).P; \
        rm .deps/$(*F).pp


Also, there is an architecture assumption. I think better by default
not to assume architecture, let people add extra optimization flags if
they want to:

Index: lua/src/Makefile
===================================================================
--- lua/src/Makefile    (revision 35)
+++ lua/src/Makefile    (working copy)
@@ -7,7 +7,7 @@
 # Your platform. See PLATS for possible values.
 PLATFORM = none

-CC= gcc --std=c99 -march=i586
+CC= gcc --std=c99
 CFLAGS= -g $(DEFS) $(MYCFLAGS)
 AR= ar rcu
 RANLIB= ranlib


And at the end I got this:

% lua -l gsl
lua: error loading module 'gsl' from file './gsl.so':
        ./gsl.so: undefined symbol: xwin_thread_function

No time to look further right now.


> There is also the higher file 'igsl.lua' that gives access to some
> basic facilities functions and it does depends on the |x| syntax. This
> shouldn't be a problem because this module's purpose is to serve the
> final user in the interactive shell and it is not needed to have
> access to core GSL functionalities.

Seems reasonable.

Cheers,
Sam