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

Fix android aar build #16

Closed
ortex opened this issue Jun 1, 2020 · 2 comments · Fixed by #18
Closed

Fix android aar build #16

ortex opened this issue Jun 1, 2020 · 2 comments · Fixed by #18
Assignees
Labels
defect Something isn't working

Comments

@ortex
Copy link
Member

ortex commented Jun 1, 2020

Built aar doesn't work

java.lang.UnsatisfiedLinkError: dlopen failed: library "libroc.so.0.1" not found
    at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
    at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
    at java.lang.System.loadLibrary(System.java:1667)
    at com.github.rocproject.roc.RocLibrary.loadLibrary(RocLibrary.java:5)
    at com.github.rocproject.roc.ChannelSet.<init>(ChannelSet.java:18)
    at com.github.rocproject.roc.ChannelSet.<clinit>(ChannelSet.java:14)

how to build:

export JAVA_VERSION=8 
export ANDROID_API=28 
export ANDROID_BUILD_TOOLS_VERSION=28.0.3 
export ANDROID_NDK_VERSION=21.1.6352462 
export ROC_BASE_DIR=$HOME/roc-build

./scripts/travis/android/install.sh 
./scripts/travis/android/script.sh 

how to reproduce:

As a temporary workaround to build arr I changed in https://github.com/roc-project/roc/blob/master/SConstruct#L1079
from

lib_env['SHLIBSUFFIX'] = '%s.%s' % (lib_env['SHLIBSUFFIX'], abi_version)

to

lib_env['SHLIBSUFFIX'] = '%s' % (lib_env['SHLIBSUFFIX'], abi_version)
@gavv gavv added the defect Something isn't working label Jun 2, 2020
@gavv
Copy link
Member

gavv commented Jun 4, 2020

Note: ironically, soname and symlink feature was first introduced specifically for Android port: roc-streaming/roc-toolkit#222 (comment)

@MatteoArella
Copy link
Member

Yes gradle plugin doesn't pack shared libraries with extensions that differ from .so so libroc.so.0.1 file won't be packed inside aar.
I've fixed setting LDFLAGS="-Wl,-soname,libroc.so" before building roc library with scons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants