After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787326 - commit 62c37c7ddb88c9796a269fce89e414dacbb1a75d does not compile on macOS with macports
commit 62c37c7ddb88c9796a269fce89e414dacbb1a75d does not compile on macOS wit...
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
git master
Other Mac OS
: Normal blocker
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2017-09-05 19:18 UTC by Jan
Modified: 2017-09-10 00:14 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jan 2017-09-05 19:18:30 UTC
commit 62c37c7ddb88c9796a269fce89e414dacbb1a75d does not compile under latest macOS (10.12.6). Macports error:

:info:build file-raw-utils.c:70:16: warning: 'LSFindApplicationForInfo' is deprecated: first deprecated in macOS 10.10 - Use LSCopyApplicationURLsForBundleIdentifier instead. [-Wdeprecated-declarations]
:info:build       status = LSFindApplicationForInfo (kLSUnknownCreator,
:info:build                ^
:info:build /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LSInfoDeprecated.h:785:1: note: 'LSFindApplicationForInfo' has been explicitly marked deprecated here
:info:build LSFindApplicationForInfo(
:info:build ^
:info:build file-raw-utils.c:71:49: error: expected ')'
:info:build                                          CFSTR (mac_bundle_id),
:info:build                                                 ^
:info:build file-raw-utils.c:71:42: note: to match this '('
:info:build                                          CFSTR (mac_bundle_id),
:info:build                                          ^
:info:build /System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h:150:76: note: expanded from macro 'CFSTR'
:info:build #define CFSTR(cStr)  ((CFStringRef) __builtin___CFStringMakeConstantString ("" cStr ""))
:info:build                                                                            ^
:info:build 1 warning and 1 error generated.
:info:build make[3]: *** [file-raw-utils.o] Error 1
:info:build make[3]: Leaving directory `/opt/local/var/macports/build/_Users_janbuchmann_ports_graphics_gimp2-devel-git/gimp2-devel-git/work/gimp-62c37c7ddb88c9796a269fce89e414dacbb1a75d/plug-ins/file-raw'
:info:build make[2]: *** [all-recursive] Error 1
:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_Users_janbuchmann_ports_graphics_gimp2-devel-git/gimp2-devel-git/work/gimp-62c37c7ddb88c9796a269fce89e414dacbb1a75d/plug-ins'
:info:build make[1]: *** [all-recursive] Error 1
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_Users_janbuchmann_ports_graphics_gimp2-devel-git/gimp2-devel-git/work/gimp-62c37c7ddb88c9796a269fce89e414dacbb1a75d'
:info:build make: *** [all] Error 2
Comment 1 Daniel Macks 2017-09-09 07:45:57 UTC
glib gio/gosxappinfo.c get_bundle_for_id() seems to have logic for using a modern replacement for LSFindApplicationForInfo when available.
Comment 2 Jehan 2017-09-09 12:44:03 UTC
Even though the error message is unclear, the main error seems to be in `CFSTR (mac_bundle_id)`. Apparently this macro can only be used with string literals, in particular no variable or even const variables.

See: Cf. https://lists.apple.com/archives/cocoa-dev/2015/Jun/msg00106.html
https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFStrings/Articles/CreatingAndCopying.html

I think I just fixed this issue with the following commit, could you please try and compile last master to confirm, because I have no MacOS computer, and no other way to check:

commit 54b4d1e0a22d2bfac9afcab0c1b791702b5171ed
Author: Jehan <jehan@girinstud.io>
Date:   Sat Sep 9 14:37:32 2017 +0200

    Bug 787326 - MacOS's CFSTR() does not work with const variables.
    
    This is untested, written from gathering information on the web. MacOS
    people, please try and compile GIMP!

 plug-ins/file-raw/file-raw-utils.c | 81 ++++++++++++++++++++++++++++++++++++++++++++-------------------------------------
 1 file changed, 44 insertions(+), 37 deletions(-)
Comment 3 Jehan 2017-09-09 12:52:36 UTC
As for the warning, I'll do this after the previous fix is confirmed.

Comment 1 indeed looks like a good fit (it will use either LSFindApplicationForInfo() or the newer API LSCopyApplicationURLsForBundleIdentifier() depending on the MacOS version) except that it is not a public glib API. So we can't use this. So I will probably just copy the glib code with a comment and propose a patch upstream to make a similar function public.
Comment 4 Jan 2017-09-09 18:10:16 UTC
Fixes the compile error. GIMP compiles now and functionality (opens darktable when opening raw file) seems to work. Thanks Jehan!
Comment 5 Jehan 2017-09-10 00:14:23 UTC
For info, I opened bug 787489 in glib with a patch to get a public API to their code so that we don't need to duplicate code with MacOS API.

I don't think it's worth to fix the warning for now but when we will get a glib function for this, that should do it.