Opened 8 months ago

Last modified 46 hours ago

#61076 assigned defect

wxWidgets-3.2 @3.1.4: error: use of undeclared identifier 'LSCopyDefaultApplicationURLForContentType'

Reported by: programmingkidx Owned by: mojca (Mojca Miklavec)
Priority: Normal Milestone:
Component: ports Version:
Keywords: tiger leopard snowleopard lion mountainlion mavericks Cc: programmingkidx
Port: wxWidgets-3.2

Description

When I was trying to install py38-wxpython-4.0, an error appeared saying that wxWidgets 3.2 failed to build.

Attachments (1)

main.log (307.7 KB) - added by programmingkidx 8 months ago.

Download all attachments as: .zip

Change History (11)

Changed 8 months ago by programmingkidx

Attachment: main.log added

comment:1 Changed 8 months ago by programmingkidx

Cc: programmingkidx added

comment:2 Changed 8 months ago by programmingkidx

The error:

:info:build ../src/osx/core/mimetype.cpp:434:32: error: use of undeclared identifier 'LSCopyDefaultApplicationURLForContentType'
:info:build     wxCFRef<CFURLRef> appUrl = LSCopyDefaultApplicationURLForContentType( cfuti, kLSRolesAll, NULL);

I found out that LSCopyDefaultApplicationURLForContentType first appears on Mac OS 10.10. Source: https://developer.apple.com/documentation/coreservices/1447734-lscopydefaultapplicationurlforco?language=objc

Last edited 8 months ago by ryandesign (Ryan Schmidt) (previous) (diff)

comment:3 Changed 8 months ago by ryandesign (Ryan Schmidt)

Keywords: tiger leopard snowleopard lion mountainlion mavericks added; wxWidgets removed
Owner: set to mojca
Port: wxWidgets-3.2 added; py38-wxpython-4.0 removed
Status: newassigned
Summary: wxWidgets 3.2 fails to build on Mac OS 10.8wxWidgets-3.2 @3.1.4: error: use of undeclared identifier 'LSCopyDefaultApplicationURLForContentType'

Then unfortunately you will not be able to build wxWidgets-3.2 on OS X 10.8. Sorry.

comment:4 Changed 8 months ago by programmingkidx

Could an error message be displayed on unsupported versions of Mac OS X that tell the user this software cannot installed on the current operating system? It would be much more helpful.

comment:5 Changed 8 months ago by kencu (Ken)

Or you could look at the same file in a previous version of wxWidgets, see what exactly changed, and come up with some workaround that would be used on earlier systems.

Almost anything is possible, depending on your motivation and available time...

comment:6 Changed 8 months ago by mojca (Mojca Miklavec)

See https://github.com/wxWidgets/wxWidgets/pull/1929

I don't really know, but I suspect it will become increasingly difficult to keep the patches for older versions of OS X around unless you volunteer to join the wxWidgets development team and reach the agreement to actively support older versions.

comment:7 Changed 2 days ago by Wowfunhappy (Jonathan)

fwiw, problem is likely this commit: https://github.com/wxWidgets/wxWidgets/commit/7be80a858d339006113c404685f2a87c32e52acf#diff-cb0fd54f455070cd20fa55627d37b10461ea029a13fcb63d233a9ea64240b9bf

Undoing that should be a very simple/safe fix, since the functionality is the same.

(I almost wonder if this sort of thing could be added to LegacySupport, or maybe a similar package focused on higher-level functionality.)

Last edited 2 days ago by Wowfunhappy (Jonathan) (previous) (diff)

comment:8 Changed 2 days ago by Wowfunhappy (Jonathan)

Gave it go. As expected, getting past the specific error is quite easy:

--- mimetype-orig.cpp	2020-07-22 13:20:06.000000000 -0400
+++ mimetype.cpp	2021-04-11 20:57:38.000000000 -0400
@@ -431,9 +431,10 @@
     wxCFStringRef ext = UTTypeCopyPreferredTagWithClass( cfuti, kUTTagClassFilenameExtension );
 
     // Look up the preferred application
-    wxCFRef<CFURLRef> appUrl = LSCopyDefaultApplicationURLForContentType( cfuti, kLSRolesAll, NULL);
+    CFURLRef appUrl;
+    OSStatus status = LSGetApplicationForInfo( kLSUnknownType, kLSUnknownCreator, ext, kLSRolesAll, NULL, &appUrl );
 
-    if( !appUrl )
+    if( status != noErr )
         return;
 
     // Create a bundle object for that application

Unfortunately, that led me to another error app = [ws openURLs:params withApplicationAtURL:url, which in turn led me to: https://github.com/wxWidgets/wxWidgets/commit/199a3f51ef2e6f4e99d0fdea410463ccda49fce2#diff-5801460ae7d02351c95cb4077983a12fa3dc825c3ff70371f42102147a0654ec. Looks like you'd need to undo all of those changes too.

My git-foo is weak and I'm not particularly eager to go through these by hand, but someone with better merging skills may want to give it a try. Or, programmingkidx, you might want to give it a go if you're still interested. This work is a tad tedious, but it's not at all difficult, and if there are ultimately more problems after this set, I'd be happy to help track down those commits as well. 👍

comment:9 Changed 2 days ago by kencu (Ken)

Better, probably to try a newer SDk -- what does this one need? -- 10.10? -- and leave the deployment target set to the current system, and see what falls out. There will be things to fix, but IMHO that is (long run) going to be 100x easier that #ifdef'ing all these fixes back in, I would think.

If you want a quick example of what is needed and how to do it, look at libsdl2.

Last edited 2 days ago by kencu (Ken) (previous) (diff)

comment:10 Changed 46 hours ago by kencu (Ken)

another option might be to get the gtk backend going on < 10.10, instead of the cocoa backend...

Note: See TracTickets for help on using tickets.