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

Accept "linux-androideabi" as an alias for Android #6301

Closed
wants to merge 1 commit into from

Conversation

Ericson2314
Copy link
Collaborator

Google uses armv7-none-linux-androideabi, analogous to
armv7-unknown-linux-gnueabi for e.g. a 32-bit regular linux.

The existing alias it not a mistake, it is the right one for 64 bit.
Google for that use aarch64-linux-android, analogous to
aarch64-unknown-linux-android for a 64-bi regular linux.

See https://developer.android.com/ndk/guides/standalone_toolchain for
evidence/details.


Please include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • If the change is docs-only, [ci skip] is used to avoid triggering the build bots.

Please also shortly describe how you tested your change. Bonus points for added tests!

Ericson2314 added a commit to obsidiansystems/cabal2nix that referenced this pull request Oct 18, 2019
See haskell/cabal#6301 for all the details. I'd
say it's safe to merge before the Cabal PR as the only people affected
by this bug would need to work around things anyways.
@@ -122,7 +122,7 @@ osAliases Permissive FreeBSD = ["kfreebsdgnu"]
osAliases Compat FreeBSD = ["kfreebsdgnu"]
osAliases Permissive Solaris = ["solaris2"]
osAliases Compat Solaris = ["solaris2"]
osAliases _ Android = ["linux-android"]
osAliases _ Android = ["linux-android", "linux-androideabi" ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should gate these based on cabal-version / CabalSpecVersion. This affects cabal file format.

cc @hvr

Copy link
Collaborator Author

@Ericson2314 Ericson2314 Oct 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in practice this is more likely to fix old packages than break them.

linux-android was added without such a gate https://github.com/haskell/cabal/pull/5199/files, and before that GHC broke things on Cabal's end when it got rid of its notion of iOS and android in https://gitlab.haskell.org/ghc/ghc/commit/cb4878ffd18a3c70f98bdbb413cd3c4d1f054e1f, so it's not like this stuff has been stable at all.

Furthermore, os(android) probably worked for both bit-widths at many point. Just google armv7-linux-android for people using android instead of androideabi on both architectures. Including @angerman in https://medium.com/@zw3rk/a-haskell-cross-compiler-for-android-8e297cb74e8a. It's really only my pedantry that made nixpkgs switch to using androidaebi to match Google and regular arm 32 Linux, which eventually caused me to discover this and send PRs to Cabal and cabal2nix.

I strongly recommend not gating this.

Copy link
Collaborator

@phadej phadej Oct 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that we were sloppy in the past doesn't justify being sloppy in the future.

Warning: The following errors will cause portability problems on other
environments:
Warning: Unknown operating system name 'linux-androideabi'
Warning: Hackage would reject this package.

The osAliases are part of cabal file format and I'm going to be the strict about their changes. Let's do things properly, even it requires more extensive changes. The more we do it so, the easier future changes will be.


I think the right solution is to have separate osAliases: the one used in .cabal files, and the ones used to match against System.Info.os.

  • .cabal files list should not be changed easily, and should be documented. We really don't need be able to use mingw32 to mean windows
  • latter ones can be changed on need.

Many purposes, tricky to change. Decouple: profit!


EDIT: we decoupled Version used for haskell package versions and pkgconfig stuff, and things become a lot more clearer. It's worth it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah decoupling sound good. I only expect anyone to use anything but os(android). I wouldn't even spend any time advocating anything else to work.

os(linux-android) was just something people started using as a workaround to android not being recognized -- a sort of workdaround that I don't even think works anymore as os(android) || os(linux-androideabi) didn't work when I tried it. In fact, I would recommend you revision that away on Hackage if there's any up there.

Copy link
Collaborator Author

@Ericson2314 Ericson2314 Oct 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, does ClassificationStrictness already handle this split? I see Compat used for some cabal files (maybe just older ones), and Permissive used for Haskell implementations.

Google uses `armv7-none-linux-androideabi`, analogous to
`armv7-unknown-linux-gnueabi` for e.g. a 32-bit regular linux.

The existing alias it not a mistake, it is the right one for 64 bit.
Google for that use `aarch64-linux-android`, analogous to
`aarch64-unknown-linux-android` for a 64-bi regular linux.

See https://developer.android.com/ndk/guides/standalone_toolchain for
evidence/details.
@Ericson2314
Copy link
Collaborator Author

I used Permissive and Compat for now to avoid changing the Cabal file format, as far as I can tell, and also added linux-androideabihf, which means hardware floating point support.

@phadej phadej self-assigned this Nov 28, 2019
@phadej phadej modified the milestones: 3.0.1.0, 3.2, 3.4 Nov 28, 2019
@3noch
Copy link

3noch commented Jul 9, 2020

What's holding this up now?

@phadej
Copy link
Collaborator

phadej commented Jul 9, 2020

Merged rebased in #6949

@phadej phadej closed this Jul 9, 2020
@Ericson2314
Copy link
Collaborator Author

Thanks!

@phadej phadej mentioned this pull request Jul 10, 2020
Profpatsch pushed a commit to Profpatsch/cabal2nix that referenced this pull request Mar 7, 2022
See haskell/cabal#6301 for all the details. I'd
say it's safe to merge before the Cabal PR as the only people affected
by this bug would need to work around things anyways.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants