Tôi đang cố gắng triển khai chương trình Qt trên máy Mac theo this link. Sau khi đi qua với otool -L trên thực thi của tôi và tất cả các thư viện mà nó phụ thuộc vào, mà tôi đã sao chép vào gói ứng dụng, tôi nhận được lỗi này trong đầu ra ứng dụng của QtCreator khi tôi cố gắng chạy nó.Qt5 không thể tìm thấy plugin nền tảng Mac OS X
This application failed to start because it could not find or load the Qt platform plugin "cocoa".
Reinstalling the application may fix this problem. The program has unexpectedly finished.
tôi đã cố gắng sao chép các plugins nền tảng qt libqcocoa.dylib và thay đổi thư mục plugins trong qt.conf, according to this, nhưng nó vẫn bị lỗi.
Ngoài giá trị chỉ ra, đầu tiên tôi đã cố gắng để sử dụng công cụ macdeployqt qt, nhưng nó không thành công với thông báo này, mặc dù là lần đầu tiên tôi chạy nó trên các thực thi:
ERROR: Could not find bundle binary for "MyProgram.app/Contents/MacOS/MyProgram" ERROR: "otool: can't open file: (No such file or directory)"
WARNING:
WARNING: Could not find any external Qt frameworks to deploy in "MyProgram.app/Contents/MacOS/MyProgram"
WARNING: Perhaps macdeployqt was already used on "MyProgram.app/Contents/MacOS/MyProgram" ?
WARNING: If so, you will need to rebuild "MyProgram.app/Contents/MacOS/MyProgram" before trying again. ERROR: Could not find bundle binary for "MyProgram.app/Contents/MacOS/MyProgram"
ERROR: file copy failed from "/Developer/Applications/Qt/plugins/platforms/libqcocoa.dylib"
ERROR: to "MyProgram.app/Contents/MacOS/MyProgram/Contents/PlugIns/platforms/libqcocoa.dylib"
ERROR: file copy failed from "/Developer/Applications/Qt/plugins/printsupport/libcocoaprintersupport.dylib"
ERROR: to "MyProgram.app/Contents/MacOS/GraphiteMiniEditor/Contents/PlugIns/printsupport/libcocoaprintersupport.dylib"
Khi bạn đã biên dịch chương trình và có gói ứng dụng, nếu bạn nhấp chuột phải vào gói và chọn "Hiển thị Nội dung gói", bạn có thể xem liệu nhị phân có tồn tại ở "MyProgram.app/Contents/MacOS/ hay không MyProgram "Bạn có thể xác nhận nó ở đó không? – TheDarkKnight
Có, nó ở đó và đó là tập tin mà tôi chạy tất cả các lệnh install_name_tool trên. Tôi đã kết thúc trở lại Qt4.8, và nó hoạt động ngay bây giờ. –
Có lẽ bạn có thể thử phiên bản sửa đổi này của macdeployqt: https://github.com/MaximAlien/macdeployqt Tôi thấy nó thực sự không thẳng thắn để triển khai Qt5 trên Mac, phiên bản macdeployqt này đã giúp tôi. – danielfranca