Skip to content

Problem compiling for Android #2904

Closed
Closed
@lemberh

Description

@lemberh

I have followed this tutorial from wiki.
I used sources from the latest release https://github.com/xianyi/OpenBLAS/releases/tag/v0.3.10

This is my build script after the path adjustment

# Set path to ndk-bundle
export NDK_BUNDLE_DIR=/Users/rnaz/Library/Android/sdk/ndk/21.3.6528147
# Export PATH to contain directories of clang and aarch64-linux-android-* utilities
export PATH=${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/:${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH
# Setup LDFLAGS so that loader can find libgcc and pass -lm for sqrt
export LDFLAGS="-L${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/lib/gcc/aarch64-linux-android/4.9.x -lm"
# Setup the clang cross compile options
export CLANG_FLAGS="-target aarch64-linux-android --sysroot ${NDK_BUNDLE_DIR}/platforms/android-23/arch-arm64 -gcc-toolchain ${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/"
# Compile
make TARGET=ARMV8 ONLY_CBLAS=1 AR=ar CC="clang ${CLANG_FLAGS}" HOSTCC=gcc -j4

Compilation ended with an error:

clang: warning: argument unused during compilation: '-install_name /Users/rnaz/StudioProjects/OpenBLAS/exports/../libopenblas.0.dylib' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument]
/Users/rnaz/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ld:osx.def: file format not recognized; treating as linker script
/Users/rnaz/Library/Android/sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ld:osx.def:2: syntax error
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libopenblas_haswellp-r0.3.10.dylib] Error 1
make: *** [shared] Error 2

Also if I just compile with make compilation succeed
Can anybody suggest what might be wrong

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions