How to know, whether our Qt 5 C++ projects make use of dynamically-loaded plug-ins.

I have used Qt Creator, with Qt version 5.7.1, to create some simplistic GUI applications as exercises. And then, I used the tool named ‘linuxdeployqt’, in order to bundle those (compiled) applications into AppImage’s, which should, in principle, run on other users’ Linux computers. (:4)  But, when using these tools, a question arose in my head, which I was also able to deduce the answer to quickly, in the form of, ‘Why does linuxdeployqt exist separately from linuxdeploy? Why does the developer need a tool which bundles library files, but which exists separately, just for C++ Qt applications? Obviously, some AppImages are not even based on that GUI library.’

And the short answer to that question is, ‘Because unlike some other application frameworks, Qt is based heavily on plug-ins, which none of my simpler exercises required explicitly.’ And, what’s so special about plug-ins? Aside from the fact that they extend the features of the application framework, plug-ins have as special property, that the application can decide to load them at run-time, and not with static awareness, at build-time. What this means is that a tool such as ‘linuxdeploy’ will scan the executable, which has been built by whichever compiler and/or IDE the developer used, will find that this executable is linked to certain shared libraries (with static awareness), but will not recognize some of the libraries which that executable needs to run, just because those are plug-ins, which the application will only decide to load at run-time.

Hence, to get the full benefit of using ‘linuxdeployqt’, the developer ‘wants to’ end up in a situation similar to the situation described Here. Granted, the person in question had run in to a bug, but his usage of the feature was correct.

This usage differs from my earlier usage, in that I never fed any ‘extra-plugins’ list to ‘linuxdeployqt’, yet, when I used the tool for creating the AppImage, my (project’s) plug-ins folder was populated with certain libraries, that were also plug-ins. And so, a legitimate question which an aspiring developer could ask would be, ‘How do I know, whether my Qt application loads plug-ins dynamically at run-time, so that I’ll know, whether I also need to specify those when bundling my AppImage?’ After all, it would seem that in certain cases, the plug-ins are in fact loaded with static awareness, which means that ‘linuxdeployqt’ can just recognize that the application is loading them, without the developer having had to make any special declaration of the fact.

One possible answer to that question might be ‘Test the AppImage, and see if it runs.’ But one problem with that answer would be, that if the executable cannot find certain plug-ins as bundled with the AppImage, the danger exists, that it may find those on the Host Machine, and that the application will end up running on some hosts, but not on other hosts, depending on what version of Qt the recipient has installed, and, depending on which plug-ins that recipient also has installed. And so, a better way must exist, for the developer to know the answer to this question.

(Updated 4/05/2021, 8h55… )

Continue reading How to know, whether our Qt 5 C++ projects make use of dynamically-loaded plug-ins.

Maintaining My Ability to View VRML 2.0 on the Web

What some modern readers may not realize, is that even before the Shockwave Flash plug-in allowed it, and before WebGL inherited the responsibility of displaying 3D content in a Web-browser, there existed A more-straightforward way to display 3D scenes within our Web-browser, which was referred to as “VRML”.

Most browsers today lack the ability to display this format of content, but I usually make sure to custom-compile a version of the plug-in which does this, which is named “FreeWRL”.

When doing so, I need to set up the configuration of the source-tree with the following line:

 


./configure --enable-plugin --with-plugindir=/usr/lib/mozilla/plugins --with-target=motif --with-imageconvert=/usr/bin/convert --with-unzip=/usr/bin/unzip --enable-libeai --enable-docs --with-wget=/usr/bin/wget


 

And, even if I give this command, often, the Firefox plug-in will not be built, because an additional dependency which I may not have installed, would be

‘npapi-sdk-dev’

This build-dependency gives our computers the header files necessary, to compile old-fashion plug-ins, which ‘Netscape’ and ‘Firefox’ allowed as add-ons, to view additional content-types embedded within the browser. And, Mozilla recently gave notice, that they would be dropping support for this plug-in API shortly. However, ‘firefox-esr’, available under Linux, still supports this plug-in API.

What I find additionally, is that even if I get the most-recent versions of ‘FreeWRL’ to compile, the resulting program does not work correctly, and that I need to compile an older version instead.

Well on the box which I name ‘Plato’, I just recently compiled and tested v2.3.3 of ‘FreeWRL’ and found that it still works. What I was also reminded of, was that support for VRML 1.0 was dropped a long time ago, and that only VRML97 / VRML 2.0 is still supported for on-line viewing. Thus, VRML 2.0 was already defined, in 1997.

Content can still be found on the Web, even though the examples are sparse. Other examples, not linked to here, such as the NASA examples, were simply hosted on a non-NASA computer, and then abandoned, which means that most NASA VRML-links are broken links. Further, some graphics students will display their VRML-worlds, as proof that they’ve achieved some level of competency in graphics in general, but will fail to publish a URL.

screenshot_20180525_130723

 

Continue reading Maintaining My Ability to View VRML 2.0 on the Web

Music Visualization Plugins Under Linux

It is only very recently, that I have looked at an aspect of my Linux computers, which certain mainstream users would appreciate more than I, usually, which is to set them up, just for listening to music.

A part of music appreciation, can be to have visualizations display, that respond in some way, however minimalistic that may be, to the ‘mood’, the general spectral composition and rhythms. And so if we are used to Windows and its Media Player, we already know about such plugins as ‘Goom‘… And when we are using “Amarok” to listen to music under Linux, we may find ourselves missing such niceties.

There is a comment which I must make about such plugins as Goom though. This type of content is considered to be intellectual property, and the authors wish to be paid, for the numbers of users who view their art while listening. And so one thing which Linux cannot do, would be just to copy each of these plugins. I think that in the past, doing so caused some disputes somewhere.

But that does not mean, that the world of Linux may not have visualization plugins of its own. Hence, the question does arise, as to where those might be.

And the answer for some time has been disappointing. While the sound system on Linux computers has shifted from OSS, ALSA and ESOUND to such standards as ‘Pulse Audio‘ and ‘Phonon‘, this has thrown a bit of a monkey-wrench into the availability of visualizations. Those used to exist specifically for ‘Amarok‘ and ‘Kaffeine‘, but actually do not because of the versions having progressed to a state of incompatibility.

It used to be, that installing such additional packages as ‘libvisual‘, would mean that a visualization panel would become available within Amarok itself. For now this does not happen. And so I have found another way. I would say that the following packages need to be installed:


libvisual
libvisual-dev
libvisual-lugins
libvisual-projectm

libprojectm2
libprojectm-dev
libprojectm-qt1
libprojectm-qt-dev
projectm-data
projectm-dbg

projectm-pulseaudio

I am going whole hog here, and pretending that some of us might actually want to write some of our own visualizations at some point in time, but also that we would want the collections to be available to us, which have already been written by Debian devs. There is a new player on this list, which is known as ‘projectM‘. This is a framework for visualizations to be displayed with OpenGL, GPU acceleration (unlike how ‘libvisual‘ used to work). And a key package I have just now recommended is ‘projectm-pulseaudio‘.

What this does, is put an entry into our application menus, which opens a window, which displays those visuals, for whatever sound sources are in fact playing, through pulseaudio.

So we do not have to use Amarok necessarily. We can use some other music player, and as long as the music is being piped through pulseaudio, the visuals will try to adapt to it.

The only downside to this platform, is the fact that the projectM window sometimes needs a few extra seconds, to detect shifts in the mood of the music, and to select a new theme of visuals to keep up with that. Also, even though some of this is GPU-accelerated, the CPU-load of all that is still quite high, especially if we have Amarok displaying as a full window, and not as a notification tray icon.

But the whole thing works! And I did suppose, that I should add the ‘mood bar’ to Amarok as well…

Dirk