Forum OpenACS Q&A: fail modload

Collapse
Posted by Tyge Cawthon on
First and foremost, thank you for all the improvements to OpenACS. Each release gets more amazing. I only wish I could contribute more to the cause.

Any help would be greatly appreciated.

Background: Refresh install using https://github.com/gustafn/install-ns install scripts.
Arch Linux
Edit config-5-10-0.tcl updated the following
hostname
ipaddress
httpport
httpsport
server
changed "proxy_mode" to "reverseproxymode" to match variable in code.
serverprettyname
uncommneted ns_param letsencrypt tcl
updated ns_param domains {celtic-arts.org}
updated ns_param certification path

Error message below.
path /var/www/oacs-5-10-0/log/error.log

[17/Feb/2025:16:25:04][917989.7d4125ccb840][-main:oacs-5-10-0-] Notice: modload: loading module libthread from file /usr/local/ns/lib/thread2.8.9/libthread2.
8.9.so
[17/Feb/2025:16:25:04][917989.7d4125ccb840][-main:oacs-5-10-0-] Error: modload: /usr/local/ns/lib/thread2.8.9/libthread2.8.9.so: cannot find symbol "Ns_Modul
eInit": /usr/local/ns/lib/thread2.8.9/libthread2.8.9.so: undefined symbol: _Ns_ModuleInit
[17/Feb/2025:16:25:04][917989.7d4125ccb840][-main:oacs-5-10-0-] Fatal: modload: failed to load module '/usr/local/ns/lib/thread2.8.9/libthread2.8.9.so'

Collapse
2: Re: fail modload (response to 1)
Posted by Gustaf Neumann on

The error indicates that NaviServer is trying to load Tcl's libthread, but that the loaded .so file wasn’t compiled with the AOLserver/NaviServer compile flag. When you use install-ns (always use the latest version), this flag is set automatically.

Please verify which Tcl version you are using. To help diagnose the issue, it’s most useful if you post the output of the "SETTINGS" section from install-ns.

It’s also possible that you have multiple versions of libthread installed on your system, and NaviServer is picking up the wrong binary (.so file). The configuration file in use determines which .so file is selected. For example, you can run the following command to list the available thread libraries.

ls -ltr `find  /usr/local/ns/lib/thread* -type f`

changed ...

If you continue to experience issues, we recommend starting with the unmodified configuration file to verify that the base setup works correctly before applying any custom modifications.

All the best
-g

Collapse
3: Re: fail modload (response to 1)
Posted by Tyge Cawthon on

Thank you for the fast response and pointing me into the right direction.

Summary:

ns_install_dir = /usr/local/ns
config variable dir = /usr/local/ns/lib
file = /usr/local/ns/lib/nsConfig.sh

Edit the nsConfig.sh file and changed version_thread from blank to 2.8.9. Re-ran the install-ns.sh. The value for version_thread is still bank.

Looking at the code more closely to understand why the changed variable in the nsConfig.sh are not showing up in the install-ns.sh

I do not want to waste yours or anyone else's time. I will read up on how and where the nsConfig.sh data comes from and how to force the version_thread to be some value.

Thanks again the response.

What I discovered I see the version_thread (Version Tcl thread library) is blank.

install-ns.sh settings
SETTINGS   build_dir              (Build directory)                 /usr/local/src
           ns_install_dir         (Installation directory)          /usr/local/ns
           version_ns             (Version of NaviServer)           4.99.31
           git_branch_ns          (Branch for git checkout of ns)   main
           version_modules        (Version of NaviServer Modules)   4.99.31
           version_tcllib         (Version of Tcllib)               1.20
           version_thread         (Version Tcl thread library)      
           version_xotcl          (Version of NSF/NX/XOTcl)         2.4.0
           version_tcl            (Version of Tcl)                  8.6.16
           version_tdom           (Version of tDOM)                 0.9.5
           ns_user                (NaviServer user)                 nsadmin
           ns_group               (NaviServer group)                nsadmin
                                  (Make command)                    make
                                  (Type command)                    type -p
           ns_modules             (NaviServer Modules)              nsdbpg
           with_mongo             (Add MongoDB client and server)   0
           with_postgres          (Install PostgreSQL DB server)    1
           with_postgres_driver   (Add PostgreSQL driver support)   1
           with_ns_deprecated     (NaviServer with deprecated cmds) 1
           with_system_malloc     (Tcl compiled with system malloc) 0
           with_debug_flags       (Tcl and nsd compiled with debug) 0
           with_ns_doc            (NaviServer documentation)        1

           pg_user                (PostgreSQL user)                 postgres
                                  (PostgreSQL include)              /usr/include/postgresql
                                  (PostgreSQL lib)                  /usr/lib
                                  (PostgreSQL Packages)             postgresql libpq

cat nsConfig.sh

build_dir="/usr/local/src"
ns_install_dir="/usr/local/ns"
version_ns=4.99.31
version_modules=4.99.31
version_tcl=8.6.16
version_tcllib=1.20
version_thread=
version_xotcl=2.4.0
version_tdom=0.9.5
ns_user=nsadmin
pg_user=postgres
ns_group=nsadmin
with_mongo=0
with_postgres=1
with_postgres_driver=1
with_ns_deprecated=1
with_system_malloc=0
pg_incl="/usr/include/postgresql"
pg_lib="/usr/lib"
make="make"
type="type -p"
debian=0
redhat=0
macosx=0
sunos=0
freebsd=0
archlinux=0
alpine=0
wolfi=1

I edited the file nsConfig.sh changed version_thread from blank to 2.8.9 and re-ran the install-ns.sh script, but results are still blank.

ls -ltr `find  /usr/local/ns/lib/thread* -type f`
/usr/local/ns/lib/thread2.8.8/libthread2.8.8.so
/usr/local/ns/lib/thread2.8.8/ttrace.tcl
/usr/local/ns/lib/thread2.8.8/pkgIndex.tcl
/usr/local/ns/lib/thread2.8.9/libthread2.8.9.so
usr/local/ns/lib/thread2.8.9/ttrace.tcl
/usr/local/ns/lib/thread2.8.9/pkgIndex.tcl
/usr/local/ns/lib/thread2.8.10/libthread2.8.10.so
/usr/local/ns/lib/thread2.8.10/ttrace.tcl
/usr/local/ns/lib/thread2.8.10/pkgIndex.tcl
/usr/local/ns/lib/thread3.0.0/libtcl9thread3.0.0.so
/usr/local/ns/lib/thread3.0.0/pkgIndex.tcl
/usr/local/ns/lib/thread2.8.11/libthread2.8.11.so
/usr/local/ns/lib/thread2.8.11/ttrace.tcl
/usr/local/ns/lib/thread2.8.11/pkgIndex.tcl
Collapse
4: Re: fail modload (response to 3)
Posted by Gustaf Neumann on
The value for versionthread is still bank.

The empty value for "version_thread" is intentional. It indicates that install‑ns.sh should automatically select the correct version for your Tcl installation, as different Tcl versions require different thread libraries.

Edit the nsConfig.sh file
I am not aware of any situation, where there is need to edit the file nsConfig.sh

and re-ran the install-ns.sh and version_thread is still blank.

Regarding editing nsConfig.sh: there is generally no need to modify that file. In fact, install‑ns.sh does not read nsConfig.sh at all. If you want to override default settings, you can specify non-default values directly on the command line [1]. For example, you can run:

version_thread=2.8.9 bash install-ns.sh

However, in your case, the issue likely stems from multiple versions of libthread being installed in /usr/local/ns/lib. OpenACS uses alphabetical sorting to pick the newest version, which means that "libthread2.8.9" comes before "libthread2.8.10" or "libthread2.8.11."

Additionally, there appears to be a thread library for Tcl9 in your listing, but Tcl9 requires unreleased versions of NaviServer and OpenACS and involves numerous migration challenges. There is a long list with required migration activities on the Tcl pages, there was as well a talk from Rolf on the last OpenACS/Tcl conferences on his experiences with porting tcllib). My recommendation: don't use it for now.

To resolve the issue, the simplest approach is to remove the extra thread libraries and then rerun install‑ns.sh:

rm -rf  /usr/local/ns/lib/thread*

This should allow install‑ns.sh to detect and use the appropriate thread library version, and OpenACS will pick it up.

All the best
-g
[1] https://github.com/gustafn/install-ns

Collapse
5: Re: fail modload (response to 1)
Posted by Tyge Cawthon on
Your suggestions worked. Thank you very much.
Big improvements with OACS-5-10-1 too.

One simple question: Should the nssmtpd.so module be part of a "new" install?

I noticed the module missing when I tried to implement OpenACS Mail service lite. I am only using only the SMTP function with port 587.

Collapse
6: Re: fail modload (response to 1)
Posted by Gustaf Neumann on
The nssmtpd module is recommended (see e.g. https://openacs.org/xowiki/outgoing_email), but is not required. We experienced various problems using the mail delivery from tcllib (such as invalid mail-encoding, crashes when more than 1024 file descriptors open, problems with tcltls). I think, these problems can be addressed with the right version combination of tcl, tcllib and tclltls, but i can't give you a recommendation what exactly avoids the problems wem had. We switched on our high mail traffic NaviServer site to the nssmptd module many years ago and our problems disappeared.