Author Topic: BASSenc_MP3 and BASS_OPUS loading-time errors on Linux x64  (Read 93 times)

TDDung

  • Posts: 19
Dear Ian,

I have finished the Delphi wrappers for BASS and add-ons but while my tests for most of them on 5 platforms (Windows x32/x64, MacOS 64, Android 32/64, iOS 64 and Linux x64) were satisfactory, only BASSenc_MP3 and BASS_OPUS have run-time error during dynamic loading on Linux x64 as followed:

- BASSenc_MP3: when running my test app in the Terminal (i.e. with command ./TestFMX), libbassenc_mp3.o will display "BASSenc_MP3: BASS must be loaded first" during dynamic loading but my app will still run and all functions inside libbassenc_mp3.o are accessible/functional. Although it therefore seems to be minor, I wish to know why and how to suppress that message :) Note: I am very sure libbass.o has been loaded and fully functional prior to loading libbassenc_mp3.o

- BASS_OPUS: when running my test app in the Terminal, during dynamic loading libbassopus.so will display "TestFMX: symbol lookup error: TestFMX/libbassopus.so: undefined symbol: BASS_GetVersion". Again I am very sure libbass.o has been loaded and fully functional in advance. After the message, however, my app will be terminated so I cannot do anything at all :( As long as my app doesn't load libassopus.o, all will be OK

Can I get some help, please?

PS: I used the .o files from official links http://www.un4seen.com/download.php?bassenc_mp324-linux and http://www.un4seen.com/download.php?bassopus24-linux

Ian @ un4seen

  • Administrator
  • Posts: 23656
The issue is that on Linux the add-on libraries historically don't link to libbass.so and instead depend on it already being loaded, but it needs to have been loaded with global scope to allow the add-ons to see the BASS functions. If you're sure that libbass.so has been loaded first then perhaps it was loaded without global scope? If you're using dlopen to load it, be sure to use the RTLD_GLOBAL flag in that call.

Recent (and future) add-on releases do link to libbass.so, so this won't be necessary for them. That currently includes all of the BASSenc add-ons except for BASSenc_MP3, but I have now put such a BASSenc_MP3 update on the BASS webpage, so you can re-download to get that.

TDDung

  • Posts: 19
Thank you so much, Ian :)

- The BASSenc_MP3 update now does not show that message anymore

- I 'dlopen' libbass.o with "RTLD_LAZY or RTLD_GLOBAL" flags and BASS_OPUS works, too

So happy, again thank you !

PS: Since your BASSenc_MP3 update links to libbass.o and works perfectly with libbass.o 'dlopen'ed without RTLD_GLOBAL flag, could you consider updating BASS_OPUS to work like that as well? The reason is that my wrapper uses Delphi's LoadLibrary (Which in Linux translates into dlopen with RTLD_LAZY flag) for all OS platforms (5) that Delphi supports, I have to make a work-around for Linux by overriding Delphi's LoadLibrary and replicate its code plus adding RTLD_GLOBAL flag).

Ian @ un4seen

  • Administrator
  • Posts: 23656
There have been some changes in BASSOPUS since the last release, so can't just replace the Linux version now (until the next release), but here's an update that you can use in the meantime:

   www.un4seen.com/stuff/bassopus-linux.zip

TDDung

  • Posts: 19
Thank you so much :)