Multiple definition of '__aeabi_ul2f' for Rust/C++ mixed code on Android (libgcc_real.a)

I'm getting this error about multiple definition of '__aeabi_ul2f' when compiling a big project on Android using CMake. Apparently one of the places where the definition is found is is on

libsmoltcp_cpp_interface_rust.a(compiler_builtins-5ae026d08032e786.compiler_builtins.2kv22hwk-cgu.127.rcgu.o): previous definition here

which is some Rust code mixed with C++ compiled like this in CMake:

add_custom_target(
    lib_smol_tcp_rust
    COMMAND 
    echo "-------------COMPILING LIBSMOLTCP_CPP_INTERFACE RELEASE x86_64"
    && cargo build --release
    && echo "-------------COMPILING LIBSMOLTCP_CPP_INTERFACE RELEASE aarch64-linux-android"
    && cargo build --target aarch64-linux-android --release 
    && echo "-------------COMPILING LIBSMOLTCP_CPP_INTERFACE RELEASE armv7-linux-androideabi"
    && cargo build --target armv7-linux-androideabi --release 
    && echo "-------------COMPILING LIBSMOLTCP_CPP_INTERFACE RELEASE i686"
    && cargo build --target i686-linux-android --release
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

then lsmoltcp_cpp_interface_rust, which is C++ code, links against lib_smol_tcp_rust which is rust.

It looks like the object '__aeabi_ul2f' is already defined on libgcc_real.a from the Android NDK project.

So I shouldn't compile the C++/Rust mixed code against libgcc? How can I do that? I'm confused because I use

The entire error:

  [1369/1369] Linking CXX shared library /home/dev/orwell/orwell_flutter_app/build/app/intermediates/cmake/debug/obj/armeabi-v7a/liborwell_android.so
  FAILED: /home/dev/orwell/orwell_flutter_app/build/app/intermediates/cmake/debug/obj/armeabi-v7a/liborwell_android.so 
  : && /opt/android-sdk-linux/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi24 --gcc-toolchain=/opt/android-sdk-linux/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/opt/android-sdk-linux/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security  -std=c++17 -O0 -fno-limit-debug-info  -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,liborwell_android.so -o /home/dev/orwell/orwell_flutter_app/build/app/intermediates/cmake/debug/obj/armeabi-v7a/liborwell_android.so CMakeFiles/orwell_android.dir/orwell_jni.cpp.o CMakeFiles/orwell_android.dir/DecodedFfmpegFrameJNI.cpp.o CMakeFiles/orwell_android.dir/JavaOrwellFlutterRenderer.cpp.o CMakeFiles/orwell_android.dir/MediaCodecDecoder.cpp.o CMakeFiles/orwell_android.dir/JavaSimpleFileWriter.cpp.o CMakeFiles/orwell_android.dir/JavaHashMapJNI.cpp.o CMakeFiles/orwell_android.dir/JavaFlutterEventMessenger.cpp.o  _liborwell/liborwell_static.a -landroid -llog -lmediandk /home/dev/orwell/orwell_flutter_app/android/app/src/main/cpp/../../../../../../deps/ffmpeg/build/android/armeabi-v7a/lib/libavcodec.so /home/dev/orwell/orwell_flutter_app/android/app/src/main/cpp/../../../../../../deps/ffmpeg/build/android/armeabi-v7a/lib/libavutil.so /home/dev/orwell/orwell_flutter_app/android/app/src/main/cpp/../../../../../../deps/ffmpeg/build/android/armeabi-v7a/lib/libswscale.so /home/dev/orwell/orwell_flutter_app/android/app/src/main/cpp/../../../../../../deps/ffmpeg/build/android/armeabi-v7a/lib/libswresample.so /home/dev/orwell/orwell_flutter_app/build/app/intermediates/cmake/debug/obj/armeabi-v7a/libmyRtspClient.so /home/dev/orwell/orwell_flutter_app/build/app/intermediates/cmake/debug/obj/armeabi-v7a/libjrtp.so _liborwell/_myRtspClient/libmyRtspClient-static.a _liborwell/_myRtspClient/_JTRPLIB/src/libjrtp.a _liborwell/_ZLMediaKit/libzlmediakit.a _liborwell/_ZLMediaKit/libzltoolkit.a _liborwell/_ZLMediaKit/libmpeg.a _liborwell/_ZLMediaKit/libmov.a _liborwell/_ZLMediaKit/libflv.a _liborwell/common/openvpn_zl_socket/libopenvpn_zl_socket.a _liborwell/_libopenvpn3/src/libopenvpn/libopenvpn_lib.a _liborwell/_libopenvpn3/openvpn3/libssl.a _liborwell/_libopenvpn3/openvpn3/libcrypto.a _liborwell/_libopenvpn3/openvpn3/liblzo.a _liborwell/_libopenvpn3/openvpn3/liblz4.a _liborwell/_libopenvpn3/libtins/lib/libtins.a _liborwell/_libopenvpn3/smoltcp_cpp_interface/libsmoltcp_cpp_static.a /home/dev/orwell/deps/libopenvpn3/smoltcp_cpp_interface/target/armv7-linux-androideabi/release/libsmoltcp_cpp_interface_rust.a -ldl _liborwell/common/liborwellebml/liborwell_ebml.a _liborwell/_libebml/libebml.a _liborwell/common/liborwellprofile/liborwell_profile.a _liborwell/common/liborwellprofile2/liborwell_profile2.a _liborwell/common/liborwellprofile2/_protobuf/libprotobufd.a /opt/android-sdk-linux/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libz.a -latomic -lm && :
  /opt/android-sdk-linux/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /opt/android-sdk-linux/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/armv7-a/thumb/libgcc_real.a(_arm_addsubsf3.o): multiple definition of '__aeabi_ul2f'
  /opt/android-sdk-linux/ndk/21.1.6352462/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: /home/dev/orwell/deps/libopenvpn3/smoltcp_cpp_interface/target/armv7-linux-androideabi/release/libsmoltcp_cpp_interface_rust.a(compiler_builtins-5ae026d08032e786.compiler_builtins.2kv22hwk-cgu.127.rcgu.o): previous definition here
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)                                
  ninja: build stopped: subcommand failed.    

This is how I created my Rust toolchain:

&& ${ANDROID_NDK_HOME}/build/tools/make_standalone_toolchain.py --api 26 --arch arm64 --install-dir /opt/RUST_NDK_TOOLCHAIN/arm64 \
    && ${ANDROID_NDK_HOME}/build/tools/make_standalone_toolchain.py --api 26 --arch arm --install-dir /opt/RUST_NDK_TOOLCHAIN/arm \
    && ${ANDROID_NDK_HOME}/build/tools/make_standalone_toolchain.py --api 26 --arch x86 --install-dir /opt/RUST_NDK_TOOLCHAIN/x86

As you can see, the linking uses

--exclude-libs,libgcc_real.a

so it shouldn't use libgcc_real.a at all, but it's using it anyways