# Framework generated by cmake for catalyst don't work

**URL:** https://discourse.cmake.org/t/framework-generated-by-cmake-for-catalyst-dont-work/3926
**Category:** Usage
**Tags:** os:macos, gen:xcode
**Created:** [August 12, 2021, 11:56pm UTC](https://discourse.cmake.org/t/framework-generated-by-cmake-for-catalyst-dont-work/3926 "2021-08-12T23:56:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![paulocoutinho](https://discourse.cmake.org/user_avatar/discourse.cmake.org/paulocoutinho/32/1697_2.png) [@paulocoutinho](https://discourse.cmake.org/u/paulocoutinho)
#### Post date: [August 12, 2021, 11:56pm UTC](https://discourse.cmake.org/t/framework-generated-by-cmake-for-catalyst-dont-work/3926/1 "2021-08-12T23:56:34Z")

</div>

Hi guys,

Im trying use a framework generated by cmake for mac catalyst, but it is not working when try use on xcode:

```auto
mkdir -p /Users/paulo/Library/Developer/Xcode/DerivedData/Sample-abxdtyhuvlqxbfhcnvbmzhxhtwjl/Build/Products/Debug-maccatalyst/Sample.app/Contents/Frameworks
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/paulo/Library/Developer/Xcode/DerivedData/Sample-abxdtyhuvlqxbfhcnvbmzhxhtwjl/Build/Products/Debug-maccatalyst/XCFrameworkIntermediates/ezored/ezored.framework" "/Users/paulo/Library/Developer/Xcode/DerivedData/Sample-abxdtyhuvlqxbfhcnvbmzhxhtwjl/Build/Products/Debug-maccatalyst/Sample.app/Contents/Frameworks"
building file list ... done
ezored.framework/
ezored.framework/Resources -> Versions/Current/Resources
ezored.framework/ezored
ezored.framework/Versions/
ezored.framework/Versions/Current -> A
ezored.framework/Versions/A/
ezored.framework/Versions/A/ezored
ezored.framework/Versions/A/Resources/
ezored.framework/Versions/A/Resources/Info.plist

sent 14834067 bytes received 122 bytes 29668378.00 bytes/sec
total size is 14831824 speedup is 1.00
Code Signing /Users/paulo/Library/Developer/Xcode/DerivedData/Sample-abxdtyhuvlqxbfhcnvbmzhxhtwjl/Build/Products/Debug-maccatalyst/Sample.app/Contents/Frameworks/ezored.framework with Identity Apple Development: Paulo Coutinho (Z65H7K3Q57)
/usr/bin/codesign --force --sign E8448F0FCA295D97E6B8ECBC76998F0E33701438 --preserve-metadata=identifier,entitlements '/Users/paulo/Library/Developer/Xcode/DerivedData/Sample-abxdtyhuvlqxbfhcnvbmzhxhtwjl/Build/Products/Debug-maccatalyst/Sample.app/Contents/Frameworks/ezored.framework'
/Users/paulo/Library/Developer/Xcode/DerivedData/Sample-abxdtyhuvlqxbfhcnvbmzhxhtwjl/Build/Products/Debug-maccatalyst/Sample.app/Contents/Frameworks/ezored.framework: bundle format is ambiguous (could be app or framework)
Command PhaseScriptExecution failed with a nonzero exit code

```

The main error is:

```auto
ezored.framework: bundle format is ambiguous (could be app or framework)

```

The project iOS sample can be downloaded and executed from my project ezored ([GitHub - ezored/ezored at version-3](https://github.com/ezored/ezored/tree/version-3)). The folder is “projects/ios/Sample”. To fast open, execute:

```auto
cd projects/ios/Sample
make pods-update
open Sample.xcworkspace

```

But if only want the framework, it can be downloaded from here:  
[https://ezored.s3.amazonaws.com/dist/ios/1.0.0/dist.tar.gz](https://ezored.s3.amazonaws.com/dist/ios/1.0.0/dist.tar.gz)

Can anyone help me what is wrong?

---

<div class="post-metadata">

### Author: ![paulocoutinho](https://discourse.cmake.org/user_avatar/discourse.cmake.org/paulocoutinho/32/1697_2.png) [@paulocoutinho](https://discourse.cmake.org/u/paulocoutinho)
#### Post date: [August 13, 2021, 2:11am UTC](https://discourse.cmake.org/t/framework-generated-by-cmake-for-catalyst-dont-work/3926/2 "2021-08-13T02:11:26Z")

</div>

Hi,

One problem was solved. Symbolic link of generated framework was replaced. Now it is what xcode generated.

Now it is compiling, but when application is executed, i got this error:

```auto
dyld: Library not loaded: @loader_path/Frameworks/ezored.framework/Versions/A/ezored
  Referenced from: /Users/ubookmobile/Library/Developer/Xcode/DerivedData/Sample-gvonzehujbqswscwyybqaryywain/Build/Products/Debug-maccatalyst/Sample.app/Contents/MacOS/Sample
  Reason: image not found

```

The strange part is that for iOS, Simulator etc it is working, but only for macOS that is not working.

My CMakeLists.txt is here:

> <https://github.com/ezored/ezored/blob/version-3/files/targets/ios/cmake/CMakeLists.txt>

And the relevant part appear be here:

```auto
# Project
include_directories(${PROJECT_HEADER_SEARCH_PATHS})
link_directories(${PROJECT_LIBRARY_SEARCH_PATHS})

add_library(${PROJECT_CONFIG_NAME} SHARED ${PROJECT_SOURCE_FILES_MERGED})

target_link_libraries(${PROJECT_CONFIG_NAME} "${PROJECT_LIBRARY_LINKS}")
target_link_libraries(${PROJECT_CONFIG_NAME} "${PROJECT_FRAMEWORK_LINKS}")
target_link_libraries(${PROJECT_CONFIG_NAME} "${CONAN_LIBS}")

set_target_properties(
    ${PROJECT_CONFIG_NAME}
    PROPERTIES CXX_STANDARD "${PROJECT_CONFIG_CXX_STANDARD}"
               CXX_STANDARD_REQUIRED YES
               CXX_EXTENSIONS NO
               CXX_VISIBILITY_PRESET default
               FRAMEWORK TRUE
               FRAMEWORK_VERSION A
               MACOSX_FRAMEWORK_IDENTIFIER "${FRAMEWORK_BUNDLE_IDENTIFIER}"
               MACOSX_FRAMEWORK_BUNDLE_VERSION "${PROJECT_CONFIG_VERSION}"
               MACOSX_FRAMEWORK_SHORT_VERSION_STRING "${PROJECT_CONFIG_VERSION}"
               XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${FRAMEWORK_BUNDLE_IDENTIFIER}"
               XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}"
               XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${CODE_SIGN_IDENTITY}"
               XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO
               XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${DEVELOPMENT_TEAM_ID}"
               XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "${DEVICE_FAMILY}"
               XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH YES
               XCODE_ATTRIBUTE_SKIP_INSTALL YES
               XCODE_ATTRIBUTE_INSTALL_PATH "@loader_path/Frameworks"
               VERSION "${PROJECT_CONFIG_VERSION}"
               SOVERSION "${PROJECT_CONFIG_VERSION}"
)

# Adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle
set_target_properties(${PROJECT_CONFIG_NAME} PROPERTIES INSTALL_NAME_DIR "@rpath")

if(NOT CMAKE_SKIP_BUILD_RPATH)
    set_target_properties(${PROJECT_CONFIG_NAME} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE)
endif()

target_compile_options(${PROJECT_CONFIG_NAME} PUBLIC "${PROJECT_COMPILE_OPTIONS}")

target_compile_definitions(${PROJECT_CONFIG_NAME} PRIVATE PROJECT_CONFIG_VERSION="${PROJECT_CONFIG_VERSION}" HAS_UNCAUGHT_EXCEPTIONS=0)

```
