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

Linking for Android: libsnappyjava.a:1:1: invalid character #257

Closed
taranion opened this issue Sep 22, 2020 · 3 comments
Closed

Linking for Android: libsnappyjava.a:1:1: invalid character #257

taranion opened this issue Sep 22, 2020 · 3 comments

Comments

@taranion
Copy link

taranion commented Sep 22, 2020

I had a working environment with client-maven-plugin 0.1.30 and GraalVM 20.2.0 - until my application got more complex and now linking fails only on Android, while Linux is still linking fine. It fails on my local Fedora 32 machine, as well on the Ubuntu in Github Actions. It fails with GraalVM 20.2 as well as 20.3-dev (from today)

The output is

[Di. Sep. 22 21:41:07 MESZ 2020][INFO] ==================== LINK TASK ====================
Download progress: 0,06 / 0,06M
[Di. Sep. 22 21:41:09 MESZ 2020][INFO] [SUB] /home/prelle/.gluon/substrate/Android/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libsnappyjava.a:1:1: invalid character
[Di. Sep. 22 21:41:10 MESZ 2020][INFO] [SUB] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[Di. Sep. 22 21:41:10 MESZ 2020][SEVERE] Process link failed with result: 1

The full linker command line (according to the log) is:

Command Line
============
/home/prelle/.gluon/substrate/Android/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/Mondtor/launcher.o /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/Mondtor/javafx_adapter.o /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/Mondtor/touch_events.o /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/Mondtor/glibc_shim.o /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/Mondtor/attach_adapter.o /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/Mondtor/logger.o /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/tmp/SVM-1600803459229/de.rpgframework.splittermond.mondtor.mondtormain.o -ljava -lnio -lzip -lnet -lprefs -ljvm -lfdlibm -lz -ldl -lj2pkcs11 -lsunec -ljaas -lextnet -target aarch64-linux-android21 -fPIC -fuse-ld=gold -Wl,--rosegment,--gc-sections,-z,noexecstack -shared -landroid -llog -lffi -llibchelper -Wl,--whole-archive -lprism_es2_monocle -lglass_monocle -ljavafx_font_freetype -ljavafx_iio -Wl,--no-whole-archive -lGLESv2 -lEGL -lfreetype -o /home/prelle/git/Mondtor/target/client/aarch64-android/libMondtor.so -L/home/prelle/.gluon/substrate/javafxStaticSdk/15-ea+gvm22/android-aarch64/sdk/lib -L/opt/graalvm-ce-java11-20.2.0/lib/svm/clibraries/android-aarch64 -L/home/prelle/.gluon/substrate/javaStaticSdk/11-ea+1/android-aarch64/labs-staticjdk/lib/static -L/home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib -Wl,--whole-archive /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libsnappyjava.a /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/liblifecycle.a /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libsettings.a /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libutil.a /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libstatusbar.a /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libdisplay.a /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libstorage.a /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libdevice.a /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/liborientation.a /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libconnectivity.a /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libbrowser.a -Wl,--no-whole-archive

The static archive in question (libsnappyjava.a) does not seem to be a regular "ar archive"

$ file /home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libsnappyjava.a
/home/prelle/git/Mondtor/target/client/aarch64-android/gvm/lib/libsnappyjava.a: 64-bit XCOFF executable or object module not stripped

libsnappy seems to be android-related. It seems, that the different library format of libsnappy.a is a problem, but I don't know how to deal with it.

@jperedadnr
Copy link
Contributor

Can you try Client plugin 0.1.32?

@taranion
Copy link
Author

Client plugin 0.1.32 - which I seem to have missed - works like a charm. From what I see from the logs, it doesn't try to link with libsnappyjava anymore.

Thank you (again) José

@jperedadnr
Copy link
Contributor

Yes, we fixed that issue with gluonhq/substrate#746

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

No branches or pull requests

2 participants