Rust cdylib in a iOS app crashes on app start

I have a Rust crate that I have compiled as a cdylib. I have created a xcframework with two frameworks inside. One for iOS device and one for the simulator. Then linked the xcframework with Cocoapods.

When I run my app in the simulator it works fine. I can call my rust functions. However, when I try to run on the device I get the following crash upon app start:

dyld[673]: Library not loaded: /Users/osp/Developer/notary-core/target/aarch64-apple-ios/release/deps/libnotary.dylib
  Referenced from: <9FE91A07-F954-36AA-8F9E-0BA14E473913> /private/var/containers/Bundle/Application/7DA323A5-0E86-409A-8516-B42240426377/Clip.app/Clip
  Reason: tried: '/usr/lib/system/introspection/libnotary.dylib' (no such file, not in dyld cache), '/Users/osp/Developer/notary-core/target/aarch64-apple-ios/release/deps/libnotary.dylib' (no such file), '/private/preboot/Cryptexes/OS/Users/osp/Developer/notary-core/target/aarch64-apple-ios/release/deps/libnotary.dylib' (no such file), '/Users/osp/Developer/notary-core/target/aarch64-apple-ios/release/deps/libnotary.dylib' (no such file)

It seems somehow it is trying to point to my original crate output folder. Which is not correct, I thought the dylib should be able to be loaded without other dependencies.

In order to create the xcframework I have the following makefile:

ARCH_IOS_SIM = aarch64-apple-ios-sim
ARCHS_IOS = x86_64-apple-ios aarch64-apple-ios aarch64-apple-ios-sim
IOS_LIB = libnotary.dylib
XCFRAMEWORK = NotaryLib.xcframework
HEADER = notary.h

export IPHONEOS_DEPLOYMENT_TARGET = 14.0

.PHONY: clean ios android $(ARCH_IOS_SIM) $(ARCHS_IOS) $(ARCHS_ANDROID) sim nuke 

nuke:
    rm -rf ./target

clean:
    # rm -rf generated
    rm -rf generated/device_framework
    rm -rf generated/sim_framework
    rm -rf generated/NotaryLib.xcframework
    mkdir -p generated/simulator_fat
    mkdir -p generated/device_framework/NotaryLib.framework/Headers
    mkdir -p generated/device_framework/NotaryLib.framework/Modules
    mkdir -p generated/sim_framework/NotaryLib.framework/Headers
    mkdir -p generated/sim_framework/NotaryLib.framework/Modules


################# iOS #################
ios: clean ios-build ios-package nocap-package ios-build-full ios-package

sim: clean
    cargo build --target $(ARCH_IOS_SIM)
    xcodebuild -create-xcframework -library target/$(ARCH_IOS_SIM)/debug/$(IOS_LIB) -headers include -output ios/$(XCFRAMEWORK)

nocap-package:
# Copy to nocap app
    cp -R generated/$(XCFRAMEWORK) ../nocap/tm
# XCode is absolutely retarded and picks up the wrong headers if we don't do this
    cp generated/include/notary.h ../nocap/tm

ios-package:
    rm -rf generated/notary.xcframework
    lipo -create target/x86_64-apple-ios/release/$(IOS_LIB) target/aarch64-apple-ios-sim/release/$(IOS_LIB) -output generated/simulator_fat/$(IOS_LIB)

# Create device framework
    cp target/aarch64-apple-ios/release/$(IOS_LIB) generated/device_framework/NotaryLib.framework/NotaryLib
    cp templates/Info.plist generated/device_framework/NotaryLib.framework/Info.plist
    cp templates/module.modulemap generated/device_framework/NotaryLib.framework/Modules/module.modulemap
    cp generated/include/$(HEADER) generated/device_framework/NotaryLib.framework/Headers/$(HEADER)

# Create sim framework
    cp target/aarch64-apple-ios-sim/release/$(IOS_LIB) generated/sim_framework/NotaryLib.framework/NotaryLib
    cp templates/Info.plist generated/sim_framework/NotaryLib.framework/Info.plist
    cp templates/module.modulemap generated/sim_framework/NotaryLib.framework/Modules/module.modulemap
    cp generated/include/$(HEADER) generated/sim_framework/NotaryLib.framework/Headers/$(HEADER)

# Combine into a single xcframework
    xcodebuild -create-xcframework -framework generated/device_framework/NotaryLib.framework -framework generated/sim_framework/NotaryLib.framework -output generated/$(XCFRAMEWORK)


ios-build-full: $(ARCHS_IOS:%=ios-build-full-%)
ios-build: $(ARCHS_IOS:%=ios-build-base-%)

ios-build-full-%:
    cargo build --release --target $* --all-features

ios-build-base-%:
    cargo build --release --target $*

Any idea what might be wrong?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật