-
Notifications
You must be signed in to change notification settings - Fork 278
[WIP] Fix Cycle dependencies build error on macOS #4149
base: master
Are you sure you want to change the base?
[WIP] Fix Cycle dependencies build error on macOS #4149
Conversation
Issue #4067
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though your solution works well during the debugging session, but the absence of the Run Script (Fix dynamic library paths in Frameworks)
would cause more serious problems on the production build.
If you try to archive the build and open it. The app will get crashed immediately.
Crash logs
❯ /Users/nghiatran/Desktop/TogglDesktop\ 2020-06-08\ 13-59-51/TogglDesktop.app/Contents/MacOS/TogglDesktop ; exit;
dyld: Library not loaded: /usr/local/lib/libPocoXML.60.dylib
Referenced from: /Users/nghiatran/Desktop/TogglDesktop 2020-06-08 13-59-51/TogglDesktop.app/Contents/Frameworks/TogglDesktopLibrary.dylib
Reason: image not found
[1] 14708 abort
[Process completed]
Problem
- Linked paths of the Poco Libs and OpenSSL are invalid
$ otool -L /Users/nghiatran/Desktop/TogglDesktop/TogglDesktop.app/Contents/Frameworks/TogglDesktopLibrary.dylib
/Users/nghiatran/Desktop/TogglDesktop/TogglDesktop.app/Contents/Frameworks/TogglDesktopLibrary.dylib:
@executable_path/../../Contents/Frameworks/TogglDesktopLibrary.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/lib/libPocoXML.60.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libPocoFoundation.60.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 162.0.0)
/usr/local/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
/usr/local/lib/libPocoData.60.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 609.1.20)
/usr/local/lib/libPocoDataSQLite.60.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libPocoJSON.60.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libPocoNetSSL.60.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libPocoCrypto.60.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
/usr/local/lib/libPocoUtil.60.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libPocoNet.60.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1675.129.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 902.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
=> Poco libraries locates at usr/local/lib
, which is incorrect.
=> It should be point to the libraryes in the Framework folder.
Such as
otool -L /Applications/TogglDesktop.app/Contents/Frameworks/TogglDesktopLibrary.dylib
/Applications/TogglDesktop.app/Contents/Frameworks/TogglDesktopLibrary.dylib:
@loader_path/TogglDesktopLibrary.dylib (compatibility version 1.0.0, current version 1.0.0)
@loader_path/libPocoXML.60.dylib (compatibility version 0.0.0, current version 0.0.0)
@loader_path/libPocoFoundation.60.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 162.0.0)
@loader_path/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
@loader_path/libPocoData.60.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 609.1.20)
@loader_path/libPocoDataSQLite.60.dylib (compatibility version 0.0.0, current version 0.0.0)
@loader_path/libPocoJSON.60.dylib (compatibility version 0.0.0, current version 0.0.0)
@loader_path/libPocoNetSSL.60.dylib (compatibility version 0.0.0, current version 0.0.0)
@loader_path/libPocoCrypto.60.dylib (compatibility version 0.0.0, current version 0.0.0)
@loader_path/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
@loader_path/libPocoUtil.60.dylib (compatibility version 0.0.0, current version 0.0.0)
@loader_path/libPocoNet.60.dylib (compatibility version 0.0.0, current version 0.0.0)
Thus, removing the script is not a good idea. I suggest keeping the file and maybe find alternative solution
On the other hand, we should apply the fix on "TogglDesktop-AppStore" target too 👍 |
@AndrewVebster Maybe, the migration to Framework could fix this problem. Ticket: https://github.com/toggl-open-source/toggldesktop/issues/4152 |
📒 Description
We would see this build error only on incremental builds.
From the documentation:
Did some experiments and this combination fixed the issue:
Run Script (Fix dynamic library paths in Frameworks)
🕶️ Types of changes
Breaking change (fix or feature that would cause existing functionality to change)
👫 Relationships
Closes #4067
🔎 Review hints
To reproduce the compile error you would do next:
toggl_api.cc
)At step 5 you'll get compile error: Cycle in dependencies between targets 'TogglDesktop' and 'TogglDesktopLibrary'.
After applying changes from PR this error should go away.
TODO