Author Topic: Bass OSX: error during runtime  (Read 319 times)

Nuno

  • Posts: 17
Bass OSX: error during runtime
« on: 25 Jul '22 - 13:43 »
Hello,
I am trying to use the Un4Seen BASS library in my Swift (MacOS) project. I have. To acheieve this, I have created a new bridging header from XCode and imported the BASS.h header file. Then I have added the libbass.dylib under the libraries & frameworks section, and finally I have added a new build phase that copies the BASS library to the product location. Andnow I getthefollowing error
dyld`:
    0x236dd1c18 <+0>:  mov    x16, #0x209
    0x236dd1c1c <+4>:  svc    #0x80
->  0x236dd1c20 <+8>:  b.lo   0x236dd1c40               ; <+40>
    0x236dd1c24 <+12>: pacibsp
    0x236dd1c28 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x236dd1c2c <+20>: mov    x29, sp
    0x236dd1c30 <+24>: bl     0x236d64e68               ; cerror_nocancel
    0x236dd1c34 <+28>: mov    sp, x29
    0x236dd1c38 <+32>: ldp    x29, x30, [sp], #0x10
    0x236dd1c3c <+36>: retab 
    0x236dd1c40 <+40>: ret   

Ian @ un4seen

  • Administrator
  • Posts: 24589
Re: Bass OSX: error during runtime
« Reply #1 on: 25 Jul '22 - 16:04 »
Is there any message in the console, eg. about being unable to find libbass.dylib? If you check the built app's contents, do you see the libbass.dylib file in the "Contest/MacOS" folder? If not, check that you have set the Xcode project to embed it in the "Executables" destination (not "Frameworks").

Nuno

  • Posts: 17
Re: Bass OSX: error during runtime
« Reply #2 on: 25 Jul '22 - 16:15 »
Oh, thats the error I have in the console
dyld[25995]: Library not loaded: @loader_path/libbass.dylib
  Referenced from: <06A4C67C-C4D4-3CAE-A178-5174E5142BA8> /Users/nuno/Library/Developer/Xcode/DerivedData/SwiftieTest-eoowmatplsclcleulfnosvrotika/Build/Products/Debug/SwiftieTest.app/Contents/MacOS/SwiftieTest
  Reason: tried: '/Users/nuno/Library/Developer/Xcode/DerivedData/SwiftieTest-eoowmatplsclcleulfnosvrotika/Build/Products/Debug/libbass.dylib' (no such file), '/usr/lib/system/introspection/libbass.dylib' (no such file, not in dyld cache), '/Users/nuno/Library/Developer/Xcode/DerivedData/SwiftieTest-eoowmatplsclcleulfnosvrotika/Build/Products/Debug/SwiftieTest.app/Contents/MacOS/libbass.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS@loader_path/libbass.dylib' (no such file), '/Users/nuno/Library/Developer/Xcode/DerivedData/SwiftieTest-eoowmatplsclcleulfnosvrotika/Build/Products/Debug/SwiftieTest.app/Contents/MacOS/libbass.dylib' (no such file), '/usr/local/lib/libbass.dylib' (no such file), '/usr/lib/libbass.dylib' (no such file, not in dyld cache)
(lldb)
Sorry, I come from Windows background and I am not quite sure how to link that library appropriately. Could you please point me in the right direction?

Ian @ un4seen

  • Administrator
  • Posts: 24589
Re: Bass OSX: error during runtime
« Reply #3 on: 25 Jul '22 - 17:38 »
Yes, that looks like the libbass.dylib file isn't where it needs to be. To confirm that, try right-clicking on your built app in Finder and choose "Show Package Contents" to see if/where the libbass.dylib file is inside it. It should be "Contents/MacOS" but Xcode may default to putting it in "Contents/Frameworks". If it is in the latter then you can fix that by changing the "Destination" to "Executables" in the project's "Build Phases" options page. Note if you are also using other libraries/frameworks then you probably shouldn't move them too - add a separate "Copy Files" phase for the BASS library(s) in that case.

Nuno

  • Posts: 17
Re: Bass OSX: error during runtime
« Reply #4 on: 25 Jul '22 - 18:37 »
Thank you! I can now use the audio library I know and love also on MacOS. Many thanks again.