alexflint/gallium

MacOS Termination Reason: DYLD, [0x1] Library missing

artvel opened this issue · 7 comments

Hi guys,

embedded Chromium with Gallium is working great so far on the development machine but as soon as I run the app bundle on a different Mac it can't find the library.
Am I missing some build or bundle parameter here?

This is how I did the build:

go build -o example main.go
gallium-bundle example

Took the example.app and tried it on a different Mac.

Error:

...
Termination Reason: DYLD, [0x1] Library missing
...
Dyld Error Message:
Library not loaded: @rpath/Gallium.framework/Gallium
Referenced from: /Applications/example.app/Contents/MacOS/example
Reason: image not found
...

can you run tree example.app and post the result here?

(FYI this project is actually not based on CEF. It is based on brightray: https://github.com/electron-archive/brightray)

Ah, thx for the clarification of the fundamentals!
This is the tree:

example.app/
└── Contents
    ├── Frameworks
    │   └── Gallium.framework
    │       ├── Frameworks -> Versions/Current/Frameworks
    │       ├── Gallium -> Versions/Current/Gallium
    │       ├── Libraries -> Versions/Current/Libraries
    │       ├── Resources -> Versions/Current/Resources
    │       └── Versions
    │           ├── A
    │           │   ├── Gallium
    │           │   ├── Libraries
    │           │   │   ├── ffmpegsumo.so
    │           │   │   └── libchromiumcontent.dylib
    │           │   └── Resources
    │           │       ├── MainMenu.nib
    │           │       ├── WindowController.nib
    │           │       ├── content_shell.pak
    │           │       └── icudtl.dat
    │           └── Current -> A
    ├── Info.plist
    ├── MacOS
    │   └── example
    └── PkgInfo

11 directories, 12 files

hmm that looks fine, can you run otool -L example.app/Contents/MacOS/example?

example.app/Contents/MacOS/example:
	@rpath/Gallium.framework/Gallium (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1445.12.0)
	/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 58286.20.16)

Hmm looks like the @rpath line is wrong. That is set up from somewhere within the gallium-bundle binary. Unfortunately I probably won't have time to dig into this in the near term but if you're interested in debugging it directly then I'm happy to support however I can.

Yes, I knew that already.
But what I don't know is how to tell MacOS where to find the Library in he's own .app structure...
I tried to find the solution over the documentation.
https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW1

https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/RunpathDependentLibraries.html#//apple_ref/doc/uid/TP40008306-SW1

But can't tell for sure what might work.

If you could tell me what to change around @rpath. I could implement the fix easily on gallium-bundle.

It works if I move the libs up to Frameworks so it looks like there is an issue with the current version link.

example.app/
└── Contents
    ├── Frameworks
    │   └── Gallium.framework
    │       ├── Gallium
    │       ├── Libraries
    │       │   ├── ffmpegsumo.so
    │       │   └── libchromiumcontent.dylib
    │       └── Resources
    │        │       ├── MainMenu.nib
    │        │       ├── WindowController.nib
    │        │       ├── content_shell.pak
    │        │       └── icudtl.dat
    ├── Info.plist
    ├── MacOS
    │   └── example
    └── PkgInfo

11 directories, 12 files