OK, good to know. I will have a go than at trying to fix some of the more offending errors (I get some errors/warnings that some files are not found).
Where I have troubles is at signing the package. I assume I need to use an apple developer account with a valid key in my keychain so this works? Or is it another more âgeneralâ user that the build system is using?
At least on my system, the packaging script seems to have a problem copying the files linked by homebrew in â/opt/homebrew/libâ. I get a lot of errors like:
Copying Resources directory.
ditto: Cannot get the real path for source '/opt/homebrew/lib/liblensfun.2.dylib'
ditto: Cannot get the real path for source '/opt/homebrew/lib/libomp.dylib'
If i modify their path in the packaging script to the real files (in /opt/homebrew/opt/lib/lib/âŚ) than the errors disappear.
@Daniel_Catalina
Codesign can be done âad hocâ with no identity needed. To do this, sign it with a minus: -DCODESIGNID="-" On most systems now ad hoc signatures only run on a single machine, and bundling homebrew libraries requires --force --deep due to existing code signature pages.
There are myriad warnings generated by the packaging script, which is iterative is some places. Most of the ignorable warning messages are being redirected to /dev/null. Over time different classes of warning messages develop and appear in the output. Other commands in the script which for example generate helper files are not redirected.
There are also times when libraries move or have more than one standard location, like /opt/homebrew/lib/mylib.dylib vs /usr/local/opt/mylib/lib/mylib.dylib etc, which cause errors, and in most cases handling must be individuated in the script. Those libraries may be missed by the iterative handler, but copied in later by another command.
So I managed to build it and even if the bundle script had all kinds of errors and warnings I ended up with an APP, DMG and other fancy things in the âbuildâ folder.
Currently I have the following situation:
running directly from â./build/release/Macos/ARTâ works fine
running the APP installed in /Applications using the generated DMG works fine
running in the terminal from /Applications/ART/Contents/MacOS/ART shows some errors and warnings in the console and crashes
% /Applications/ART.app/Contents/MacOS/ART
(ART:3747): Gtk-CRITICAL **: 10:58:18.346: gtk_window_add_accel_group: assertion 'GTK_IS_WINDOW (window)' failed
objc[3747]: Class GNotificationCenterDelegate is implemented in both /Applications/ART.app/Contents/Frameworks/libgio-2.0.0.dylib (0x1053e86b0) and /opt/homebrew/Cellar/glib/2.78.3/lib/libgio-2.0.0.dylib (0x111a106b0). One of the two will be used. Which one is undefined.
(ART:3747): GdkPixbuf-CRITICAL **: 10:58:18.788: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(ART:3747): GdkPixbuf-CRITICAL **: 10:58:18.788: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(ART:3747): GdkPixbuf-CRITICAL **: 10:58:18.788: gdk_pixbuf_set_option: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(ART:3747): GdkPixbuf-CRITICAL **: 10:58:18.788: gdk_pixbuf_set_option: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(ART:3747): GdkPixbuf-CRITICAL **: 10:58:18.788: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(ART:3747): GdkPixbuf-CRITICAL **: 10:58:18.788: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(ART:3747): GdkPixbuf-CRITICAL **: 10:58:18.788: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(ART:3747): GdkPixbuf-CRITICAL **: 10:58:18.788: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(ART:3747): GdkPixbuf-CRITICAL **: 10:58:18.788: gdk_pixbuf_scale_simple: assertion 'GDK_IS_PIXBUF (src)' failed
(ART:3747): Gtk-WARNING **: 10:58:18.788: Could not load a pixbuf from /org/gtk/libgtk/theme/Adwaita/assets/bullet-symbolic.svg.
This may indicate that pixbuf loaders or the mime database could not be found.
(ART:3747): GLib-CRITICAL **: 10:58:18.788: g_propagate_error: assertion 'src != NULL' failed
zsh: segmentation fault /Applications/ART.app/Contents/MacOS/ART
I do not know how to test if my build has the same resources problem as @HIRAMâs has.
i renamed âbuildâ into âbuild.oldâ and it works. But in a funny way, it has a different theme
This is how it looks with the build folder in place:
To launch the main executable via command line, some environmental variables must be passed. The Info.plist has a list of these. In command form, it would look like this:
Thanks for the tip!
What confuses me a bit is that after installing the APP downloaded from you, I was able to run it from command line without doing anything.
The one I compiled crashes. Have you done anything special for this not to happen with the APP you shared?
@HIRAM Back to the packaging script. I found a problem that is probably not related to what we try to fix, but it is a problem and since we are looking there anyway it might worth fixing.
in the âRegistering @rpath in Frameworks folderâ it calls for
for dylib in ./${PROJECT_NAME}.app/Contents/Frameworks/*.dylib ; do if [[ $dylib ]]; then sudo install_name_tool -change $(otool -L ${PROJECT_NAME}.app/Contents/MacOS/${PROJECT_NAME} | grep $(basename $dylib) | cut -f2 | cut -d ' ' -f1 ) /Applications/${PROJECT_NAME}.app/Contents/Frameworks/$(basename $dylib) /Applications/${PROJECT_NAME}.app/Contents/MacOS/${PROJECT_NAME} ; fi; done
There are 2 issues here:
it is calling it with sudo, which is not needed as the whole script is called with sudo, this is easy to fix and has no influence on anything else
install_name_tool is throwing an error because if called with -change it expects 3 arguments and receives just 2. I am not sure which path with each path it is trying to replace at this step, if you can help here I can try to fix it and see if it improves anything.
This command updates the main executableâs dynamic links from the librariesâ original homes to their new home in the bundle.
To fix the issue with the -cli, I have duplicated this command as: for dylib in ./${PROJECT_NAME}.app/Contents/Frameworks/*.dylib ; do if [[ $dylib ]]; then sudo install_name_tool -change $(otool -L ${PROJECT_NAME}.app/Contents/Frameworks/${PROJECT_NAME}-cli | grep $(basename $dylib) | cut -f2 | cut -d ' ' -f1 ) /Applications/${PROJECT_NAME}.app/Contents/Frameworks/$(basename $dylib) ${PROJECT_NAME}.app/Contents/Frameworks/${PROJECT_NAME}-cli ; fi ; done
This fixes the above from what I wrote for RT after the fork. Puts cache and options/config dirs in ~/Library/Containers/ART instead of internal to the bundle, for permissions and persistence:
Here are my significant launch error messages, when launched from command line.
Error: the user's processing profile path doesn't point to a directory or doesn't exist!
Error: Can't load css file "/Users/rb/art/build/Release/Resources/share/themes/_ART.css"
Message: <data>:4:70Failed to import: Error opening file /Users/rb/art/build/Release/Resources/share/themes/_ART.css: No such file or directory
ERROR: Failed to open file â/Users/rb/art/build/Release/Resources/share/images/wb-camera-small.svgâ: No such file or directory
What is the âprocessing profile pathâ and how do I set that⌠is it RT_PATH?
options.cc is generating this error.
Iâve renamed the build directory, but it shows it is baked in somewhere. Which file has the original build directory baked in?
The offending file is rtgui/config.h generated by rtgui/CMakeLists.txt using rtgui/config.h.in
@agriggio PR#16 is again producing a working dmg! It was only the tip of the iceberg⌠The changes to options.cc and config.h.in were of course a logical shortcut compared with using cmake. Unfortunately for the installation phase of the cmake build the bundle was relying on the old-fashioned folder structure and not using the paths which are now hardcoded to produce a sandboxed, hardened, entitled app which passes notary. For RT I probably opted for the options.cc and config.h.in change because they were far less complex than repurposing the cmake variables.