lt_dlopen doesn't use itself for supporting libraries

Roland Hughes via Discussion list for the GNU libtool shared library maintenance tool <[email protected]> Fri, 13 Feb 2026 10:18:34 -0600
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <[email protected]>
All,

Been looking for a discussion forum where I could search because this 
had to have come up before. It appears lt_dlopen() uses straight 
dlopen() for additional library loads instead of using itself and the 
user search path. Admittedly this could be user error, but so far the 
documentation doesn't point to that. I'm going by the doc found here:

https://www.gnu.org/software/libtool/manual/

RPATH isn't allowed in secured environments. The .conf file has been a 
legacy Qt bug since 4.x and probably earlier. It is definitely still 
there. They used to hack in an RPATH to get around the local build 
problem. Actually they hacked it into the system installed builds too, 
but that has all been fixed. I will eventually use SDL3 as the base for 
this, completely removing the plugins.

The fork of Qt begat Copperspice begat LsCs is here

https://github.com/RolandHughes/ls-cs/tree/ls-cs-0.2.1

If people wish to look at source, the file in question is 
ls-cs/src/core/plugin/qlibrary_unix.cpp. I'm currently only working in 
Ubuntu 18.04 so the shell scripts for RPM and other platforms probably 
are no longer correct.

In the code starting at 192 I insert the the prefixed library and plugin 
paths gleaned from

developer@developer-u18-VirtualBox:~/github_projects/LsCs_local_release$ 
cat share/LsCs/lscs.conf
[Paths]
Prefix = /home/developer/github_projects/LsCs_local_release
Headers = include/LsCs
Libraries = lib/LsCs
Binaries = bin
Plugins = lib/LsCs/plugins
Data = share/LsCs
Translations = share/LsCs/translations

At line 264 I call lt_dlopen. (Sorry, I did not clean up all of the 
dlopen and flags stuff yet. Trying to get this to work first.) Oh, the 
lt_dlinit() call is at line 98 and lt_dlexit() is at 323.

For decades now Qt and the forks of it have had this tree structure.

developer@developer-u18-VirtualBox:~/github_projects/LsCs_local_release$ 
tree lib
lib
└── LsCs
     ├── cmake
     │   ├── LsCsBinaryTargets.cmake
     │   ├── LsCsBinaryTargets-debug.cmake
     │   ├── LsCsConfig.cmake
     │   ├── LsCsConfigVersion.cmake
     │   ├── LsCsLibraryTargets.cmake
     │   ├── LsCsLibraryTargets-debug.cmake
     │   └── LsCsMacros.cmake
     ├── libLsCsCore.so -> libLsCsCore.so.0
     ├── libLsCsCore.so.0 -> libLsCsCore.so.0.2.1
     ├── libLsCsCore.so.0.2.1
     ├── libLsCsGui.so -> libLsCsGui.so.0
     ├── libLsCsGui.so.0 -> libLsCsGui.so.0.2.1
     ├── libLsCsGui.so.0.2.1
     ├── libLsCsMultimedia.so -> libLsCsMultimedia.so.0
     ├── libLsCsMultimedia.so.0 -> libLsCsMultimedia.so.0.2.1
     ├── libLsCsMultimedia.so.0.2.1
     ├── libLsCsNetwork.so -> libLsCsNetwork.so.0
     ├── libLsCsNetwork.so.0 -> libLsCsNetwork.so.0.2.1
     ├── libLsCsNetwork.so.0.2.1
     ├── libLsCsOpenGL.so -> libLsCsOpenGL.so.0
     ├── libLsCsOpenGL.so.0 -> libLsCsOpenGL.so.0.2.1
     ├── libLsCsOpenGL.so.0.2.1
     ├── libLsCsSql.so -> libLsCsSql.so.0
     ├── libLsCsSql.so.0 -> libLsCsSql.so.0.2.1
     ├── libLsCsSql.so.0.2.1
     ├── libLsCsSvg.so -> libLsCsSvg.so.0
     ├── libLsCsSvg.so.0 -> libLsCsSvg.so.0.2.1
     ├── libLsCsSvg.so.0.2.1
     ├── libLsCsXcbSupport.so -> libLsCsXcbSupport.so.0
     ├── libLsCsXcbSupport.so.0 -> libLsCsXcbSupport.so.0.2.1
     ├── libLsCsXcbSupport.so.0.2.1
     ├── libLsCsXmlPatterns.so -> libLsCsXmlPatterns.so.0
     ├── libLsCsXmlPatterns.so.0 -> libLsCsXmlPatterns.so.0.2.1
     ├── libLsCsXmlPatterns.so.0.2.1
     ├── libLsCsXml.so -> libLsCsXml.so.0
     ├── libLsCsXml.so.0 -> libLsCsXml.so.0.2.1
     ├── libLsCsXml.so.0.2.1
     ├── libltdl.a
     ├── libltdl.la
     ├── libltdl.so -> libltdl.so.7.3.3
     ├── libltdl.so.7 -> libltdl.so.7.3.3
     ├── libltdl.so.7.3.3
     ├── LsCsPrinterDriverCups.so
     └── plugins
         ├── imageformats
         │   └── LsCsImageFormatsSvg.so
         ├── mediaservices
         │   ├── LsCsMultimedia_gst_audiodecoder.so
         │   ├── LsCsMultimedia_gst_camerabin.so
         │   └── LsCsMultimedia_gst_mediaplayer.so
         ├── platforms
         │   └── LsCsGuiXcb.so
         ├── playlistformats
         │   └── LsCsMultimedia_m3u.so
         ├── sqldrivers
         │   ├── LsCsSqlMySql.so
         │   ├── LsCsSqlOdbc.so
         │   └── LsCsSqlPsql.so
         └── xcbglintegrations
             └── LsCsGuiXcb_Glx.so

so they either hack with RPATH or they use a "deployqt"-like script that 
copies all of the object libraries and all of the plugins into a single 
directory with the executable you wrote.

Even when you do the "script hack"

developer@developer-u18-VirtualBox:~/github_projects/LsCs_examples_install/gui-hello$ 
cat g.sh
#!/bin/bash
#
export 
LD_LIBRARY_PATH="/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins:/home/developer/github_projects/LsCs_local_release/lib/LsCs"
export 
LTDL_LIBRARY_PATH="/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins:/home/developer/github_projects/LsCs_local_release/lib/LsCs"
export 
LT_LIBRARY_PATH="/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins:/home/developer/github_projects/LsCs_local_release/lib/LsCs"

./gui-hello


you still end up with a stack dump because it is using dlopen for all of 
the dependencies, or at least it appears to be.

developer@developer-u18-VirtualBox:~/github_projects/LsCs_examples_install/gui-hello$ 
./g.sh
QSettings:
      key:  Paths/Binaries    value:  bin
      key:  Paths/Data    value:  share/LsCs
      key:  Paths/Headers    value:  include/LsCs
      key:  Paths/Libraries    value:  lib/LsCs
      key:  Paths/Plugins    value:  lib/LsCs/plugins
      key:  Paths/Prefix    value: 
/home/developer/github_projects/LsCs_local_release
      key:  Paths/Translations    value:  share/LsCs/translations
pluginKey:   xcb
QFactoryLoader::setup()  libDirs: 
(/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/xcbglintegrations, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/xcbglintegrations/LsCsGuiXcb_Glx.so, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/sqldrivers, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/sqldrivers/LsCsSqlOdbc.so, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/sqldrivers/LsCsSqlMySql.so, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/sqldrivers/LsCsSqlPsql.so, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/mediaservices, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/mediaservices/LsCsMultimedia_gst_audiodecoder.so, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/mediaservices/LsCsMultimedia_gst_camerabin.so, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/mediaservices/LsCsMultimedia_gst_mediaplayer.so, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/playlistformats, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/playlistformats/LsCsMultimedia_m3u.so, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/imageformats, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/imageformats/LsCsImageFormatsSvg.so, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/platforms, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/platforms/LsCsGuiXcb.so, 
/home/developer/github_projects/LsCs_examples_install/gui-hello, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs, 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins)
looking for: 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/platforms/LsCsGuiXcb.so
lscs_findLibrary() looking for: 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/platforms/LsCsGuiXcb.so
prefixStr:     /home/developer/github_projects/LsCs_local_release
librariesStr: /home/developer/github_projects/LsCs_local_release/lib/LsCs
pluginsStr: 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins
search path after changes: 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins:/home/developer/github_projects/LsCs_local_release/lib/LsCs
search path: 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins:/home/developer/github_projects/LsCs_local_release/lib/LsCs
attempt: 
/home/developer/github_projects/LsCs_local_release/lib/LsCs/plugins/platforms/LsCsGuiXcb.so
./g.sh: line 7: 29748 Segmentation fault      (core dumped) ./gui-hello

So, is there a legitimate non-RPATH work around for this?

Is there an lt_ library function I have not found which will give me a 
list of all dependencies for a given .so so those can be loaded first?

Thanks,

-- 
Roland Hughes, President
Logikal Solutions
(630)-205-1593  (cell)
https://theminimumyouneedtoknow.com
https://infiniteexposure.net
https://johnsmith-book.com