Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 14.5 / Xcode 12.5 Build Issue: Semantic Issue (Comparison of distinct pointer types) #14

Closed
roblabs opened this issue Feb 3, 2021 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@roblabs
Copy link
Collaborator

roblabs commented Feb 3, 2021

There is a compiler error when building the scheme dynamic with Xcode.

Tested against:

  • Version 12.5 (12E262) released on Apr 20, 2021
  • Version 12.5 beta 3 (12E5244e) released on Mar 2, 2021.
  • Version 12.5 beta 2 (12E5234g) released on Feb 16, 2021.
  • Version 12.5 Beta (12E5220o) released on Feb 1, 2021.

This same file (NSExpression+MGLAdditions.mm) compiles fine with Xcode Version 12.4 (12D4e) & Xcode Version 11.7 (11E801a)


Xcode reports Semantic Issue

Comparison of distinct pointer types ('NSString *' and 'Class')


https://github.com/maptiler/maplibre-gl-native/blob/72692d6305bb4df1d64dab450e0d49e2c8d5c943/platform/ios/platform/darwin/src/NSExpression%2BMGLAdditions.mm#L1272


Error in Xcode 12.5 Beta

image


Other parameters of note:

  • SDK iOS 14.5 (released as Beta on Feb 1, 2021)

image

@roblabs
Copy link
Collaborator Author

roblabs commented Apr 6, 2021

New type of error when attempting to build with Version 12.5 beta 3 (12E5244e) when testing with master: dba5d96

Cast to smaller integer type 'unsigned int' from 'MGLReachability *'

image

@roblabs roblabs changed the title iOS 14.5 / Xcode 12.5 beta Build Issue: Semantic Issue (Comparison of distinct pointer types) iOS 14.5 / Xcode 12.5 Build Issue: Semantic Issue (Comparison of distinct pointer types) Apr 21, 2021
@roblabs
Copy link
Collaborator Author

roblabs commented Apr 21, 2021

This issue still exists & is a blocker for anyone intending to upgrade to Xcode 12.5 RC for MapLibre development. I recommend sticking with Xcode 11.7 or 12.4 to build MapLibre.

@roblabs roblabs added bug Something isn't working help wanted Extra attention is needed labels Apr 21, 2021
@roblabs
Copy link
Collaborator Author

roblabs commented Apr 28, 2021

If you are keen to upgrade to Xcode 12.5, you can help investigate or make a test case to ensure that the following is the right fix and/or a proper workaround.

//                           (NSString *) // Fixing the error by casting.  TODO verify it doesn't break something else
            } else if (op == (NSString *) [MGLColor class] && [function isEqualToString:@"colorWithRed:green:blue:alpha:"]) {

Diff from within Xcode 12.5
image

@glyuck
Copy link

glyuck commented May 12, 2021

Regarding the error in MGLReachability.m and Cast to smaller integer type 'unsigned int' from 'MGLReachability *' warning:
I think we should replace

    NSString *description = [NSString stringWithFormat:@"<%@: %#x (%@)>",
                             NSStringFromClass([self class]), (unsigned int) self, [self currentReachabilityFlags]];

with

    NSString *description = [NSString stringWithFormat:@"<%@: %p (%@)>",
                             NSStringFromClass([self class]), (void *) self, [self currentReachabilityFlags]];

The first warning Comparison of distinct pointer types ('NSString *' and 'Class'):

} else if (op == [MGLColor class] && [function isEqualToString:@"colorWithRed:green:blue:alpha:"]) {

It looks like a bug in Mapbox source code to me: op == [MGLColor class] the left variable is NSString * and the right one is Class. I can't figure out how it supposed to work.
Probably it should be something like [op isEqualToString:NSStringFromClass([MGLColor class])]

@roblabs
Copy link
Collaborator Author

roblabs commented Jul 22, 2021

@glyuck — thanks for the contribution!

With this commit we now support Xcode 12.5 & Xcode 13-beta. And as a bonus MapLibre runs on the simulator on Apple Silicon with the latest Xcode release & beta.

Commit 19b86f7 has been tested on:

  • both flavors of Big Sur (Intel & arm)
  • a couple of Xcode versions that I had lying around
Xcode Version c++ version Catalina Big Sur (Intel) Big Sur (arm)
12.4 (12D4e) 12.0.0.12000032 Xcode 12.4 runs on Catalina & Big Sur Not tested
12.5.1 (12E507) 12.0.5.12050022 Xcode 12.5 requires Big Sur
13.0 (13A5192i) 13.0.0.13000025 Xcode 13-beta requires Big Sur

macOS Version Info

uname -a

Catalina

Darwin catalina.local 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 22 19:49:55 PDT 2021; root:xnu-6153.141.35~1/RELEASE_X86_64 x86_64

Big Sur (Intel)

Darwin bigsur-intel.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64

Big Sur (arm)

Darwin bigsur-arm.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:27 PDT 2021; root:xnu-7195.141.2~5/RELEASE_ARM64_T8101 arm64

@roblabs roblabs closed this as completed Jul 22, 2021
nvanfleet pushed a commit to lyft/maplibre-gl-native that referenced this issue Jul 28, 2022
…dules/ops/terraform/modules/iam_role to v3.9 in maplibreglnativeprivate (maplibre#14)

Refactorator would like to apply these changes to your code!
Please shepherd this to production as soon as possible,
going through the normal deployment process
monitoring this PR as you would any other change.

**You are responsible for merging this PR; Refactorator will not automatically merge it.**

If this PR is outdated, run [this job](https://refactorator.lyft.net/run?fixer=iamroleterraformmodule&projects=maplibreglnativeprivate&rerun=all) to update it;
watch the output in case the fixer errors out before pushing changes.

# iamroleterraformmodule
See the [release notes](https://github.com/lyft/terraform-orchestration-modules/releases).

For more information or questions, reach out to [#orchestration](https://lyft.slack.com/channels/orchestration).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants