Menu

#83 undefined symbol: _Ns_DbDriverInit when including PostgreSQL driver

Bug
closed
nobody
None
5
2019-01-16
2019-01-13
No

When I try to load nsdbipg.so I get the following error

Error: modload: /usr/local/ns/bin/nsdbipg.so: cannot find symbol "Ns_DbDriverInit": /usr/local/ns/bin/nsdbipg.so: undefined symbol: _Ns_DbDriverInit

I tried to complie nsdbipg with -Wl,--no-as-needed flag and I got the same error

Discussion

  • gustafn

    gustafn - 2019-01-14

    What exact version of NaviServer, nsdbi and nsdbipg are you using? One should always use matching versions from the version numbered subdriectories (or tip, when development versions are needed).

    Note as well that there are two families of db drivers, both containing a PostgreSQL driver:

    • nsdb (pg driver: nsdbpg), and
    • nsdbi (pg driver: nsdbipg).

    Both driver families consist of a generic part and a db specific part.

     
  • Ayman Idries

    Ayman Idries - 2019-01-14

    Thanks for your reply.

    I was trying the following versions :

    1. naviserver-4.99.17
    2. nsdbi-0.2
    3. nsdbipg-0.2

    I tried the latest version "nsdbpg", the naviserver loaded it successfully.

    Currently, I'm facing the same issue with the mySQL and memcache drivers nsdbmysql and nsmemcache respectively (latest for both from https://bitbucket.org/account/user/naviserver/projects/PROJ).

    the erorr for nsdbmysql is cannot find symbol Ns_TclDbGetHandle
    the error for nsmemcache is cannot find symbol Ns_ModuleVersion

     
  • gustafn

    gustafn - 2019-01-14

    when using naviserver-4.99.17, one should use the modules from naviserver-4.99.17-modules.tar.gz, which includes nsdbi and nsdbipg in version 0.3. As a reference, below is a sample config file and sample query,

    If this still does not work, please report OS version and compiler.

    Do you need nsdbmysql and nsmemcache? AFIKT, both of these modules are not widely in use.
    -gn

    Config file simple-config.tcl :

    ns_section "ns/servers"
    ns_param default         NaviServer
    
    ns_section "ns/server/default/adp"
    ns_param enabletclpages true
    
    ns_section "ns/server/default/modules"
    ns_param pool1         nsdbipg.so
    ns_param nssock        nssock.so
    
    ns_section "ns/server/default/module/nssock"
    ns_param port 8000
    
    ns_section "ns/server/default/module/pool1"
    ns_param default true
    ns_param datasource "dbname=postgres user=nsadmin"
    

    The example script (e.g. in /usr/local/ns/pages/nsdbi.tcl)

    ns_return 200 text/plain [dbi_rows {select count(*) from pg_stat_activity}] 
    

    Start server:

     /usr/local/ns/bin/nsd -u nsadmin -g nsadmin -t simple-config.tcl -f
    
     

    Last edit: gustafn 2019-01-14
  • gustafn

    gustafn - 2019-01-15

    I have added the missing symbol to nsmemcached (available via https://bitbucket.org/naviserver/nsmemcache/)

     
  • Ayman Idries

    Ayman Idries - 2019-01-16

    thanks

     
  • gustafn

    gustafn - 2019-01-16
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB