Using external library? [bungee]

Hello- I’m trying to make use of the recently released time-stretch/repitch library, bungee, in a juce plugin project.

Following their instructions for recursively cloning with dependencies & using cmake to build the bungee executable worked fine for me, but I’m having a hard time figuring out how to make use of it in a JUCE project.

Going by the advice of this post here, in my projucer project, I have added the path ‘/Users/lyra/Documents/development/libraries/bungee/bungee’ to my Header Search Paths, and ‘/Users/lyra/Documents/development/libraries/bungee/build/’ to External Libraries to Link for xcode.

However, when I try to build in xcode, I get the error

Library '/Users/lyra/Documents/development/libraries/bungee/build/' not found

I have tried adding a ‘~’ to the front of that path & removing the /build/ to no avail. Also tried …/…/libraries/bungee/build/bungee which should describe its location relative to the .jucer I’m editing but that didn’t work.

How can I either make my xcode project see the pre-built executable or get it to build the library I want to use and all its dependencies?

Thanks for your help.

1 Like

Well, /Users/lyra/Documents/development/libraries/bungee/build/ seems to be a folder, what the linker expects is that you specify the actual library file which might be located in that folder. Usually libraries are prefixed with the lib on unix systems, so look e.g. for libbungee.a or libbungee.dylib in that folder – could also be some different name though. Did you already build the library as described in the projects Readme?

1 Like

thanks for the help. actually I’d tried the path I mentioned to /bungee first (forgot I’d changed it before I wrote my thread here), which was a unix executable with no extension.

I did follow the build instructions and there is ‘libbungee.a’. Unfortunately xcode still gives me the same error when I put its address into the External Libraries to Link, though-

Library '/Users/lyra/Documents/development/libraries/bungee/build/libbungee.a' not found

Same for if I add ~ in front.

I notice in the information for the External Libraries to Link field, it advises to “not add any platform specific declarations to these names.” What is the External Libraries to Link address field actually relative to? It seems that I can’t get xcode to know where libbungee.a is regardless of if I’m going from the root directory or relative to the .jucer file, at least not via the External Libraries to Link field for the xcode exporter.

Going all CMake for years I haven’t worked with the Projucer for quite a long time, so I might be missing something specific to the Projucer. Generally, I’m used to two different ways of linking libraries. If a librarie’s directory is in the library search path, you usually specify the library name without any decorations, which would simply mean bungee in your case. The linker would then look for libbungee.a and libbungee.dylib in your search path and pick the first one it finds there. You could try that by adding /Users/lyra/Documents/development/libraries/bungee/build/ to the library search path field and then just put bungee in the external libraries to link field.

Still, it should also be possible to link against a specific library file by passing an absolute path to a library file, so I’m surprised it does not work for you. Are you sure that the path is correct, did you try to execute

ls /Users/lyra/Documents/development/libraries/bungee/build/

in a terminal and successfully see the expected library listed there?

~ should usually just expand to the user directory of the currently active user, so if you have logged in to the lyra user, ~ will expand to Users/lyra, so you could also write ~/Documents/development/libraries/bungee/build/ – but I’d suggest to always go for absolute paths if possible.

1 Like

Yes indeed, the ~ can be treacherous.

Since you already figured out Cmake for the external lib, you might try going all the way and using cmake to build your plugin. Then you might be able to add_subdirectory since the external library already has a cmakelists.

It does sound like you’re almost there though!

1 Like

This is a ‘best practices’ thing, but I would advise you to put your external third-party libraries IN your project under a directory named “third/”, and not have them littered elsewhere in the filesystem. The reason for this is obvious: they’ll always be there when you need to build the project, in the future. And, the added benefit is that you don’t need to use tilde (~), ever again - and should never use it in the first place - as developers you should be using explicit paths to a well-populated directory structure that has good long term integrity because you can copy the entire project in a single directory and carry all its dependencies along with it …

1 Like