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

ERROR: While parsing option --apple_platform_type=ios: Not a valid Apple platform type: 'ios' (should be ıos, watchos, tvos, macos or catalyst) #17541

Closed
FahriBilici opened this issue Feb 20, 2023 · 4 comments
Labels

Comments

@FahriBilici
Copy link

Description of the bug:

I am following tensorflow installation locally from here. I run configure then run this code:
bazel build --config=ios_fat -c opt --cxxopt=--std=c++17 \ //tensorflow/lite/ios:TensorFlowLiteC_framework

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

following the link provided after cloning tensorflow from github.

Which operating system are you running Bazel on?

macos monterey (intel)

What is the output of bazel info release?

5.3.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

-

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@fmeum
Copy link
Collaborator

fmeum commented Feb 21, 2023

@sgowroji This is indeed a bug in Bazel itself. Note how the error message says that ios is not a valid Apple platform type but then goes on to list it as valid - but with a Turkish lowercase i.

I believe that this can be fixed by using Ascii.toLowerCase and Ascii.equalsIgnoreCase in the methods of https://cs.opensource.google/bazel/bazel/+/669c298f71b5f8fbef8f62c85543cda3eab4dfcc:src/main/java/com/google/devtools/build/lib/rules/apple/ApplePlatform.java;drc=669c298f71b5f8fbef8f62c85543cda3eab4dfcc;l=246. Can't fix it myself right now, could you assign it (probably to the Apple team)?

@drraghavendra
Copy link

Yes I truly believe the issue displayed because of case sensitivity.

fmeum added a commit to fmeum/bazel that referenced this issue Mar 8, 2023
Java's `String#to{Lower,Upper}Case()` is locale-dependent, which can
lead to unexpected results in locales with special case mappings in the
ASCII range (e.g. in a Turkish locale, a capital ASCII `I` lowercases to
a non-ASCII variant of `i`).

This is prevented by specifying a local without such case mappings. This
commit uses `Locale.ROOT` as the canonical choice with the same case
mapping behavior as other common locales such as `Locale.ENGLISH` or
`Locale.US`.

Follow-up changes could use Guava's `Ascii.to{Lower,Upper}Case` instead,
but whether this is safe may depend on the context, which makes this
replacement unsuitable to perform across the repo.

Fixes bazelbuild#17541
@fmeum
Copy link
Collaborator

fmeum commented Mar 8, 2023

I submitted a fix: #17687

Bazel didn't really work at all with a Turkish locale (e.g. it fails when it encounters a size = "medium" on a test). The workaround is to specify a different locale with:

bazel --host_jvm_args=-Duser.country=US --host_jvm_args=-Duser.language=en build ...

ShreeM01 pushed a commit to ShreeM01/bazel that referenced this issue Mar 10, 2023
This ensures consistent behavior of string operations even if the individual operations do not set a locale.

Without this change, Bazel can't operate in e.g. a Turkish locale, where it fails with error messages such as:

In rule 'test', size 'medium' is not a valid size.

This is because Turkish case mapping rules make it so that a capital ASCII 'I' lowercases to a non-ASCII variant of 'i'.

Fixes bazelbuild#17541

Closes bazelbuild#17702.

PiperOrigin-RevId: 515339563
Change-Id: I8417d0befd76ba6d140588be5f7e50529af3f6c7
meteorcloudy pushed a commit that referenced this issue Mar 13, 2023
This ensures consistent behavior of string operations even if the individual operations do not set a locale.

Without this change, Bazel can't operate in e.g. a Turkish locale, where it fails with error messages such as:

In rule 'test', size 'medium' is not a valid size.

This is because Turkish case mapping rules make it so that a capital ASCII 'I' lowercases to a non-ASCII variant of 'i'.

Fixes #17541

Closes #17702.

PiperOrigin-RevId: 515339563
Change-Id: I8417d0befd76ba6d140588be5f7e50529af3f6c7

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
fweikert pushed a commit to fweikert/bazel that referenced this issue May 25, 2023
This ensures consistent behavior of string operations even if the individual operations do not set a locale.

Without this change, Bazel can't operate in e.g. a Turkish locale, where it fails with error messages such as:

In rule 'test', size 'medium' is not a valid size.

This is because Turkish case mapping rules make it so that a capital ASCII 'I' lowercases to a non-ASCII variant of 'i'.

Fixes bazelbuild#17541

Closes bazelbuild#17702.

PiperOrigin-RevId: 515339563
Change-Id: I8417d0befd76ba6d140588be5f7e50529af3f6c7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants
@fmeum @FahriBilici @drraghavendra and others