MacOS X application codesign gets failed if it has symlink folders

Hello,


My application uses multiple frameworks (in ‘MyApp.app/Frameworks’ directory). Each framework in turn is dependent on one or more other frameworks (inside ‘MyApp.app/Frameworks’ directory). This is achieved using symbolic links.

See MyApp.app bundle structure as below :

myApp.app / Contents /

Frameworks/

ABC.framework /

ABC (symlink to current version)

Resources (symlink to current version)

Versions/

A /

ABC

Resources/

Current / (symlink to A)

Frameworks / (symlink to myApp.app 's Framework folder)

XYZ.framework/

ABC (symlink to current version)

Resources (symlink to current version)

Versions/

A /

ABC

Resources/

Current / (symlink to A)

Frameworks / (symlink to myApp.app 's Framework folder)

info.plist

MacOS/

pkgInfo

Resoures/


When I code sign MyApp.app and validate with command :

" codesign -vv / Path_To_Application_Bundle "


It gives below error all the time :

"unsealed contents present in the root directory of an embedded framework"


My Queries :

1. How to code sign application if application has Framework with symlink outside its bundle?

2. I used this structure to reduce application's size, If above case is not valid for code sign then what is alternative?

3. In my other framework I have Resource folder symlink to some Directory, which is validate on Installation but while code signing that Directory may not be there, in that case how to code sign framework.


Please provide solution to code sign my MyApp.app .


Thank you !

Replies

Looks like a duplicate of MacOS X application code sign issue

A bundle should be self-contained – it shouldn't contain symbolic links outside the bundle. Even more so are bundles that with well-defined structure such as framework bundles.


It looks like your frameworks would need to dynamically link to other frameworks within the same application bundle. That is,

ABC.framework
need to access
XYZ.framework
or vice-versa. To achieve this, you can configure the Runpath Search Path in those frameworks to search for libraries or frameworks within the application's
framework
directory.


To do this, configure those frameworks'

LD_RUNPATH_SEARCH_PATHS
to have
@executable_path/../Frameworks
as one of the designated search paths. Then install/copy those frameworks into the
Contents/Frameworks
directory of the application as per normal. This directs the framework to look for other frameworks or libraries relative to the application (executable) which loads it.


For more information you can type

man dyld
in the Terminal and then search for
@executable_path
inside the manual page.