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

Android prebuilds? #38

Open
christianbundy opened this issue Feb 20, 2020 · 4 comments
Open

Android prebuilds? #38

christianbundy opened this issue Feb 20, 2020 · 4 comments

Comments

@christianbundy
Copy link

Hi there! I'd like to run Sharp on Android, but Android doesn't support libvips by default. I've tried to install libvips via Termux, but the package hasn't been ported. Would you be opening to creating prebuilds for Android? I saw this workaround, but I'm concerned about compatibility (for Sharp and other native modules).

Thanks!

@lovell
Copy link
Owner

lovell commented Feb 21, 2020

I guess these would need to use the bionic libc and be cross-compiled for ARMv7 and ARM64v8. Happy to accept a PR with Dockerfiles that create suitable cross-build environments for this.

@christianbundy
Copy link
Author

Works for me! Out of curiosity, I've noticed that lots of other projects use prebuild, which maintains its own Dockerfiles for a bunch of platforms -- is that something you've explored, or would be interested in using?

@lovell
Copy link
Owner

lovell commented Feb 21, 2020

sharp already uses prebuild, this repo is to prebuild libvips for sharp, but we might be able to use the same base images it uses though - see https://github.com/dockcross/dockcross

@kleisauke
Copy link
Collaborator

Note that supporting Android devices would require libvips to be cross-compiled with an Android-compatible toolchain such as NDK. It looks like Termux has succeeded in this, see PR termux/termux-packages#6325.

fwiw, as an experiment I tried to reuse the Linux ARM64v8 glibc binaries on Android (with Xamarin), but that doesn't seem to work.

Details
<ItemGroup>
  <PackageReference Include="NetVips" Version="2.0.0" ExcludeAssets="Compile" GeneratePathProperty="true" />
  <PackageReference Include="NetVips.Native.linux-arm64" Version="8.10.6" GeneratePathProperty="true" />
</ItemGroup>
<ItemGroup>
  <!-- Use the Linux variant of NetVips on Android -->
  <Reference Include="NetVips">
    <HintPath>$(PkgNetVips)\runtimes\linux\lib\netstandard2.0\NetVips.dll</HintPath>
  </Reference>
  <!-- Include libvips ARM64v8-A glibc as native Android library -->
  <AndroidNativeLibrary Include="$(PkgNetVips_Native_linux-arm64)\runtimes\linux-arm64\native\libvips.so.42">
    <Abi>arm64-v8a</Abi>
  </AndroidNativeLibrary>
</ItemGroup>
[monodroid-assembly] Trying to load shared library '/data/app/nl.kleisauke.netvips/lib/arm64/libvips.so.42'
[monodroid-assembly] Failed to load shared library '/data/app/nl.kleisauke.netvips/lib/arm64/libvips.so.42'. dlopen failed: library "libpthread.so.0" not found: needed by /data/app/nl.kleisauke.netvips/lib/arm64/libvips.so.42 in namespace classloader-namespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants