Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

OSX .dylib integration - working in Editor, not in builds

Discussion in 'Editor & General Support' started by gregzo, Apr 3, 2014.

  1. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Hi to all,

    Integrating .dylib libraries is proving to be a bit of a nightmare so far... Here's my situation:

    1) I've created a .bundle in XCode whith the .dylib I'd like to integrate. 2 targets, 32 and 64 bits.

    2) I've got the 32 bit bundle up and running in the editor, not witohout pain: had to run
    Code (csharp):
    1. install_name_tool -id @loader_path/libMyLib.dylib libMyLib.dylib
    and to be careful to name the bundle MyLib.bundle, and to add an empty MyLib.c file to the project before building...

    When placed in the Plugins folder, it works.

    3) But in standalone OSX builds, the libary isn't found. Whatever the target architecture, the bundle IS present in the .app package, but calls to the wrapper fail miserably.

    This all seems very convoluted - and in the end fails. Universal bundles would be nice too, but first I'm trying to get architecture specific bundles to work, to no avail in builds.

    Any help much appreciated!

    Gregzo
     
    cdizz_ likes this.
  2. Kunani

    Kunani

    Joined:
    Apr 14, 2013
    Posts:
    16
    Greg, were you able to get any 64 bit bundles loading at all? Most of the documentation is a year old that states a universal binary is required on OSX.

    I'd like to know now that 64 bit mac player is now in the new update, if we can use 64 bit bundles now.
     
  3. gregzo

    gregzo

    Joined:
    Dec 17, 2011
    Posts:
    795
    Yep, got 64 bit bundles up and running, in builds of course( the editor doesn't support 64 bit yet ).

    I was tired, it was late in the night, I was trying too hard… And I forgot to set OSX 64 bit as output architecture for the unity build.

    Next I've got to get universal bundles up and running - still trying to figure out if lipo is the only way, and if I can have 2 different .dylib of the same name for 32 and 64 bit targets.

    One blog post helped a lot: http://www.tedlindstrom.se/how-to-link-dylibs-into-unity3d/

    It's all quite convoluted, really, especially when compared with the easy drag and drop handling of dlls.

    Anyway, do report here if you find anything, or need any help in replicating what I've just managed to do myself.

    Cheers,

    Gregzo