0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-26 06:41:03 +08:00
Stephan Guilloux e6e76096bf
Problem: Android APP fails to load ZMQ (ARM64 only) (#4442)
* Problem: Android APP fails to load ZMQ (ARM64 only)

Seen with physical Android devices running ARM64.
Not seen with ARM, X86 or X86_64.

Any Android APP loading ZMQ fails with:
```
[FATAL] Couldn't load library library zmq from jar. Dependency is required!
```

Unpack zyre-android-2.0.1.jar, find libzmq.so for ARM64 and look for missing
symbols:
```
prompt> unzip zyre-android-2.0.1.jar
prompt> cd lib/arm64-v8a
prompt> nm --undefined-only ./libzmq.so | head
                 U __aarch64_ldadd4_acq
                 U __aarch64_ldadd4_acq_rel
                 U __aarch64_ldadd4_rel
                 U __aarch64_ldadd4_relax
                 U __aarch64_ldadd8_acq_rel
                 U __aarch64_ldadd8_relax
                 U __aarch64_swp8_acq
                 U __aarch64_swp8_acq_rel
                 U __aarch64_swp8_rel
                 U __aarch64_swp8_relax
prompt>
```
Some more symbols are missing, but those are relevant for this issue.

OK.
These symbols are present in libc++_shared, but not exported ...:
```
prompt> nm libc++_shared.so | grep aarch64
00000000000ee6d0 t __aarch64_cas1_acq_rel
00000000000ee7a0 t __aarch64_cas8_acq_rel
00000000001028f0 b __aarch64_have_lse_atomics
00000000000ee840 t __aarch64_ldadd4_acq_rel
00000000000ee810 t __aarch64_ldadd4_rel
00000000000ee8a0 t __aarch64_ldadd8_acq_rel
00000000000ee870 t __aarch64_ldadd8_relax
00000000000ee7e0 t __aarch64_swp8_acq_rel
prompt>
```

Issue seen also on the WEB, with GCC & CLANG:
- https://bugzilla.redhat.com/show_bug.cgi?id=1830472
- cea175b838
- ...

Solution: Add `-mno-outline-atomics` to CXXFLAGS (FLUTTER fix).

Additionaly, had to introduce NDK_NUMBER.
This variable is calculated in `android_build_helper.sh`.
It represents the numeric form of NDK_VERSION:
```
  NDK_VERSION          --> NDK_NUMBER
  android-ndk-r25      --> 2500
  android-ndk-r23c     --> 2303
  android-ndk-r22      --> 2200
  android-ndk-r21e     --> 2105
  ... and so on
```

This will help a few other things (NDK download ?).
2022-10-18 10:19:15 +01:00
..
2022-02-11 00:45:06 +02:00
2021-04-28 11:41:36 +03:00
2016-12-22 14:25:00 +08:00
2022-02-11 00:45:06 +02:00
2019-05-07 10:37:47 -04:00
2022-02-11 00:45:06 +02:00

This directory holds build tools, i.e. tools we use to build the current
code tree. Packaging tools (which take released tarballs or github code
repos) should go into /packaging.

Note: 'deprecated-msvc' contains deprecated prepared Visual Studio Solution 
files for various Visual Studio versions. These are no longer maintained, 
and may or may not work. Please use cmake instead to build with Visual
Studio. Rationale: The solution and project files are hard to maintain,
since there are different variants for each Visual Studio version.
The tests have never been included there for this reason, so they were
never usable for actual development of libzmq. If you encounter that 
something that worked before does not work with CMake, please open as 
issue at https://github.com/zeromq/libzmq/issues.