New nxweb 3.3 branch with focus on usability

92 views
Skip to first unread message

Yaroslav

unread,
Sep 22, 2014, 8:03:12 AM9/22/14
to nx...@googlegroups.com
Hi!

I've opened new 3.3 branch of nxweb by making some usability improvements:


1. Default config file

nxweb now installs global default config file (typically in /usr/local/etc/nxweb/nxweb_config.json), which allows launching nxweb from any directory.

Local nxweb_config.json (in current working directory) still takes priority so you can customize it to your needs.

Default config contains two basic rules which allow:

Python adapter is also installed globally now so you don't need one in every python project.


2. Dynamic loading of custom modules

Custom C modules can now be compiled into shared library (.so) and loaded via command line switch or config file.

Compile: gcc -shared -fPIC modules/*.c -o mymodules.so `pkg-config --cflags nxweb`

Load: nxweb -L ./mymodules.so

No need for custom nxweb executable anymore.


3. Sample config

nxweb distribution archive now contains folder sample_config with all files related to sample configuration (C modules compiled into .so, static files, Python app, etc.).


4. New nxweb home page

nxweb home page has moved to http://nxweb.org

You can find some useful HowTos in nxweb blog there.


I'd be glad to hear your comments and suggestions. Thanks for your interest in nxweb!

Yaroslav Stavnichiy

Hans

unread,
Dec 9, 2014, 2:10:55 PM12/9/14
to nx...@googlegroups.com
Hi,

The basic idea of putting the libs external is good. It is not really programer friendly yet however.

Having ported some code (mix of C and C++) from 3.2 to 3.3, I had some problems making nxweb run with modules in an external shared lib that has other dependencies.

The only message nxweb prints in those cases is "failed to load shared library {name of modules library}".

****** start of "how I solved it" section, may help others.. If not interested, fast forward 

ldd is of no help here, as it does not trace the dlopen calls.
Adding the external dependencies via -L does not seem to help (and is a pain, as that means having to specify the full path), as I probably set up a wrong the load sequence, and I do not even know if -L supports the loading of dependencies of dependencies.

So I linked the external dependencies (-lgcc -lgcc_s -lstdc++ and others) into the module (adding them into nxweb works also of course) and everything runs again. But it takes a lot of work to get there again. Static linking gives so much more feedback.

The only way to get something remotely useful (better than strace) is to use something like
LD_BIND_NOW=1 LD_WARN=1 LD_TRACE_LOADED_OBJECTS=1 LD_PRELOAD={module.so} nxweb -c nxweb_config.json

***** end of "how I solved it" section

My suggestion: please add a bit more debugging in nxweb around the library load process. Please use dlerror(). It will show only the first missing symbol, but it is a starter.

Do you think that is possible?

Kind regards,

Hans

Yaroslav

unread,
Dec 9, 2014, 2:51:29 PM12/9/14
to nx...@googlegroups.com
Hi Hans,

OK, I'll add dlerror() call to the next commit (might take a few days cause I'm quite busy at the moment).

Also I'd like to note that you can still statically compile your modules into nxweb as before. Using .so is an option but not a requirement in 3.3.

There is also a caveat when using .so modules. When you specify local path to such modules you have to include at least one slash in their path (eg ./mymodule.so) otherwise dlopen will look in standard libraries path, not in current working directory.

Yaroslav

--
You received this message because you are subscribed to the Google Groups "nxweb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nxweb+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hans

unread,
Dec 16, 2014, 2:22:51 AM12/16/14
to nx...@googlegroups.com
While you are at it, can you add the following in nxweb.h:

instead of 

#define _GNU_SOURCE

use:

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

as one would get compiler warnings under gcc otherwise.

Kind regards,
Hans

Yaroslav

unread,
Dec 16, 2014, 6:09:03 AM12/16/14
to nx...@googlegroups.com
Hi Hans,

It never gave me warnings but I can add that.

Yaroslav
Reply all
Reply to author
Forward
0 new messages