GithubHelp home page GithubHelp logo

Comments (29)

adityakamble49 avatar adityakamble49 commented on June 25, 2024 1

@sh1r0 I Got openblas builds from https://github.com/solrex/caffe-mobile

Copied it in the repository

caffe-android-lib $ tree android_lib/
android_lib/
├── bin
├── include
│   ├── cblas.h
│   ├── f77blas.h
│   ├── lapacke_config.h
│   ├── lapacke.h
│   ├── lapacke_mangling.h
│   ├── lapacke_utils.h
│   └── openblas_config.h
└── lib
    ├── cmake
    │   └── openblas
    │       ├── OpenBLASConfig.cmake
    │       └── OpenBLASConfigVersion.cmake
    ├── libopenblas.a -> libopenblas_armv8p-r0.2.19.a
    └── libopenblas_armv8p-r0.2.19.a

5 directories, 11 files

Commented build_openblas.sh in build.sh

caffe-android-lib $ git diff
diff --git a/build.sh b/build.sh
index 6f8c954..552ab11 100755
--- a/build.sh
+++ b/build.sh
@@ -7,10 +7,10 @@ set -eu

 pushd "${PROJECT_DIR}"

-if ! ./scripts/build_openblas.sh; then
-    echo "Failed to build OpenBLAS"
-    exit 1
-fi
+#if ! ./scripts/build_openblas.sh; then
+#    echo "Failed to build OpenBLAS"
+#    exit 1
+#fi

 ./scripts/build_boost.sh
 ./scripts/build_gflags.sh

Able to build final libcaffe_jni.so and libcaffe.so

caffe-android-lib $ tree android_lib/caffe/lib/
android_lib/caffe/lib/
├── libcaffe_jni.so
├── libcaffe.so
└── libproto.a

0 directories, 3 files

from caffe-android-lib.

luohl364218 avatar luohl364218 commented on June 25, 2024 1

@adityakamble49 your solution works!

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

Regarding build issues, please try to use docker for simplicity.

from caffe-android-lib.

Qvodman avatar Qvodman commented on June 25, 2024

@sh1r0 I already use docker.

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

@Qvodman Could you show me the command you use?

from caffe-android-lib.

Qvodman avatar Qvodman commented on June 25, 2024

@sh1r0
git clone --recursive https://github.com/sh1r0/caffe-android-lib.git

cd caffe-android-lib

sudo docker build -t caffe-android-lib .

sudo docker run --rm --name caffe-android-builder -e ANDROID_ABI=x86_64 -e N_JOBS=2 -v $(pwd)/android_lib/x86_64:/caffe-android-lib/android_lib caffe-android-lib ./build.sh

from caffe-android-lib.

Qvodman avatar Qvodman commented on June 25, 2024

@sh1r0 And when I used:

git clone --recursive https://github.com/sh1r0/caffe-android-lib.git

cd caffe-android-lib

sudo docker build -t caffe-android-lib .

sudo docker run --rm --name caffe-android-builder -e ANDROID_ABI=arm64-v8a -e N_JOBS=2 -v $(pwd)/android_lib/arm64-v8a:/caffe-android-lib/android_lib caffe-android-lib ./build.sh

The problem:
make: *** [getarch_2nd] Error 1
make -j 1 -f Makefile.install install
make[1]: Entering directory '/caffe-android-lib/OpenBLAS'
Generating openblas_config.h in /caffe-android-lib/android_lib/openblas/include
Generating f77blas.h in /caffe-android-lib/android_lib/openblas/include
Generating cblas.h in /caffe-android-lib/android_lib/openblas/include
Copying the static library to /caffe-android-lib/android_lib/openblas/lib
install: cannot stat 'libopenblas_armv8-r0.2.18.a': No such file or directory
make[1]: *** [install] Error 1
make: *** [install] Error 2
Makefile.install:23: recipe for target 'install' failed
make[1]: Leaving directory '/caffe-android-lib/OpenBLAS'
Makefile:313: recipe for target 'install' failed
Failed to build OpenBLAS

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

Hi @Qvodman, I just did a clean clone, re-created the docker image, and used the command below.

docker run --rm --name caffe-android-builder \
     -e ANDROID_ABI=arm64-v8a \
     -e N_JOBS=2 \
     -v $(pwd)/android_lib/arm64-v8a:/caffe-android-lib/android_lib \
     caffe-android-lib ./build.sh

Per log (listed below), OpenBLAS is successfully built and installed.

make -j 4 -f Makefile.install install
make[1]: Entering directory '/caffe-android-lib/OpenBLAS'
Generating openblas_config.h in /caffe-android-lib/android_lib/openblas/include
Generating f77blas.h in /caffe-android-lib/android_lib/openblas/include
Generating cblas.h in /caffe-android-lib/android_lib/openblas/include
Copying the static library to /caffe-android-lib/android_lib/openblas/lib
Copying the shared library to /caffe-android-lib/android_lib/openblas/lib
Generating OpenBLASConfig.cmake in /caffe-android-lib/android_lib/openblas/lib/cmake/openblas
Generating OpenBLASConfigVersion.cmake in /caffe-android-lib/android_lib/openblas/lib/cmake/openblas
Install OK!
make[1]: Leaving directory '/caffe-android-lib/OpenBLAS'

Could you provide more details about your environment?

from caffe-android-lib.

Qvodman avatar Qvodman commented on June 25, 2024

@sh1r0
Ubuntu 16.04.02
cmake version 3.5.1
NDK:android-ndk-r11C

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

Hi @Qvodman, I pulled the latest ubuntu:16.04 docker image and tested again without failures. Would you like to re-pull the docker image?

from caffe-android-lib.

Qvodman avatar Qvodman commented on June 25, 2024

@sh1r0 Do I need to install OpenBLAS by myself?

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

Nope, everything should be self-contained in this project.

from caffe-android-lib.

Qvodman avatar Qvodman commented on June 25, 2024
liaolp@ubuntu:~/caffe-android-lib$ sudo docker build -t caffe-android-lib .
Sending build context to Docker daemon 309.9 MB
Step 1/5 : FROM ubuntu:16.04
 ---> 00fd29ccc6f1
Step 2/5 : RUN apt-get update && apt-get install -y --no-install-recommends     automake     build-essential     ca-certificates     curl     cmake     file     libtool     pkg-config     unzip     wget
 ---> Using cache
 ---> e21d0c6626ad
Step 3/5 : RUN curl -SL     http://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip     -o /tmp/android-ndk.zip     && unzip -q -d /opt /tmp/android-ndk.zip     && rm -f /tmp/android-ndk.zip
 ---> Using cache
 ---> 78131cbb08f3
Step 4/5 : COPY . /caffe-android-lib
 ---> Using cache
 ---> 081e19e42ff4
Step 5/5 : WORKDIR /caffe-android-lib
 ---> Using cache
 ---> 3c628ed3e218
Successfully built 3c628ed3e218

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

First, docker pull ubuntu:16.04 to get the latest image, which image id should be 2a4cca5ac898.
Then, re-build image via docker build -t caffe-android-lib ..

from caffe-android-lib.

Qvodman avatar Qvodman commented on June 25, 2024
sudo docker images
[sudo] password for liaolp: 
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
caffe-android-lib   latest              80ac207e9df6        21 seconds ago      3.45 GB
<none>              <none>              ea38e441a68f        2 hours ago         3.45 GB
<none>              <none>              1038af21e2e6        8 hours ago         3.45 GB
ubuntu              16.04               2a4cca5ac898        37 hours ago        111 MB
<none>              <none>              3c628ed3e218        11 days ago         3.45 GB
<none>              <none>              e29454a39e35        12 days ago         3.46 GB
ubuntu              <none>              00fd29ccc6f1        4 weeks ago         111 MB

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

According to your comment above (quoted below),

Step 1/5 : FROM ubuntu:16.04
---> 00fd29ccc6f1

I think the caffe-android-lib image you created is not based on the right one

ubuntu              16.04               2a4cca5ac898        37 hours ago        111 MB

but this one

ubuntu              <none>              00fd29ccc6f1        4 weeks ago         111 MB

from caffe-android-lib.

Qvodman avatar Qvodman commented on June 25, 2024

@sh1r0 I re-created the docker image

sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
caffe-android-lib   latest              7383e0d3c6ef        8 minutes ago       3.47 GB
ubuntu              16.04               2a4cca5ac898        2 days ago          111 MB

But the problem is still reproduced:

make: *** [getarch_2nd] Error 1
make -j 1 -f Makefile.install install
make[1]: Entering directory '/caffe-android-lib/OpenBLAS'
Generating openblas_config.h in /caffe-android-lib/android_lib/openblas/include
Generating f77blas.h in /caffe-android-lib/android_lib/openblas/include
Generating cblas.h in /caffe-android-lib/android_lib/openblas/include
Copying the static library to /caffe-android-lib/android_lib/openblas/lib
install: cannot stat 'libopenblas_armv8-r0.2.18.a': No such file or directory
make[1]: *** [install] Error 1
Makefile.install:23: recipe for target 'install' failed
make[1]: Leaving directory '/caffe-android-lib/OpenBLAS'
Makefile:313: recipe for target 'install' failed
Failed to build OpenBLAS
make: *** [install] Error 2

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

Could you check the version of cmake via docker run --rm --name caffe-android-builder caffe-android-lib cmake --version?

from caffe-android-lib.

Qvodman avatar Qvodman commented on June 25, 2024
sudo docker run --rm --name caffe-android-builder caffe-android-lib cmake --version
cmake version 3.5.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

Hi @Qvodman, I got another linux machine to test from scratch without any issues. I think the docker build should be fine on a clean setup. Sorry, I could not help you to find out why this did not work on your env.

from caffe-android-lib.

Qvodman avatar Qvodman commented on June 25, 2024

@sh1r0 The new issues:

/home/liaolp/caffe-android-lib/android_lib/opencv/sdk/native/jni/include/opencv2/core/mat.hpp:1754:33: note:   template argument deduction/substitution failed:
/home/liaolp/caffe-android-lib/android_lib/opencv/sdk/native/jni/include/opencv2/core/mat.hpp:1759:39: note: template<class _Tp> const _Tp& cv::Mat::at(cv::Point) const
    template<typename _Tp> const _Tp& at(Point pt) const;
                                      ^
/home/liaolp/caffe-android-lib/android_lib/opencv/sdk/native/jni/include/opencv2/core/mat.hpp:1759:39: note:   template argument deduction/substitution failed:
android/CMakeFiles/caffe_jni.dir/build.make:86: recipe for target 'android/CMakeFiles/caffe_jni.dir/caffe_mobile.cpp.o' failed
make[2]: *** [android/CMakeFiles/caffe_jni.dir/caffe_mobile.cpp.o] Error 1
CMakeFiles/Makefile2:1053: recipe for target 'android/CMakeFiles/caffe_jni.dir/all' failed
make[1]: *** [android/CMakeFiles/caffe_jni.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

from caffe-android-lib.

mmiirroo avatar mmiirroo commented on June 25, 2024

same problem

make[1]:
Leaving directory '/caffe-android-lib/OpenBLAS/kernel'
make -j 1 -f Makefile.install install
make[1]: Entering directory '/caffe-android-lib/OpenBLAS'
Generating openblas_config.h in /caffe-android-lib/android_lib/openblas/include
Generating f77blas.h in /caffe-android-lib/android_lib/openblas/include
Generating cblas.h in /caffe-android-lib/android_lib/openblas/include
Copying the static library to /caffe-android-lib/android_lib/openblas/lib
install: cannot stat 'libopenblas_atom-r0.2.18.a': No such file or directory
Makefile.install:23: recipe for target 'install' failed
make[1]: *** [install] Error 1
make[1]: Leaving directory '/caffe-android-lib/OpenBLAS'
Makefile:313: recipe for target 'install' failed
make: *** [install] Error 2
Failed to build OpenBLAS

and compile command is the following:

echo Copying the static library to /opt/OpenBLAS/lib
install -pm644 libopenblas_atom-r0.2.18.a /opt/OpenBLAS/lib
cd /opt/OpenBLAS/lib ;
ln -fs libopenblas_atom-r0.2.18.a libopenblas.a

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

Hi @Qvodman and @seiyaa,
I've used docker to build the project on windows 10 and ubuntu 14.04 without any problems. FYI, I list the openblas libs I got for arm64-v8a, x86_64, and x86, respectively. Note that the filename of all .a has a p following the arch name, which is different from yours.

android_lib/arm64-v8a/openblas/lib/:
cmake  libopenblas.a  libopenblas_armv8p-r0.2.18.a

android_lib/x86_64/openblas/lib/:
cmake  libopenblas.a  libopenblas_atomp-r0.2.18.a

android_lib/x86/openblas/lib/:
cmake  libopenblas.a  libopenblas_atomp-r0.2.18.a

from caffe-android-lib.

adityakamble49 avatar adityakamble49 commented on June 25, 2024

I am facing the same issue
Getting following error

make[1]: Leaving directory `/home/aditya/workspace/caffe-android-lib/OpenBLAS/kernel'
make -j 1 -f Makefile.install install
make[1]: Entering directory `/home/aditya/workspace/caffe-android-lib/OpenBLAS'
Generating openblas_config.h in /home/aditya/workspace/caffe-android-lib/android_lib/openblas/include
Generating f77blas.h in /home/aditya/workspace/caffe-android-lib/android_lib/openblas/include
Generating cblas.h in /home/aditya/workspace/caffe-android-lib/android_lib/openblas/include
Copying the static library to /home/aditya/workspace/caffe-android-lib/android_lib/openblas/lib
install: cannot stat ‘libopenblas_armv8-r0.2.18.a’: No such file or directory
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/aditya/workspace/caffe-android-lib/OpenBLAS'
make: *** [install] Error 2
Failed to build OpenBLAS

As you mentioned p following arch name, there is same file generated under OpenBLAS directory and linked to libopenblas.a also . So why script expecting without p following arch name in libopenblas file name.

caffe-android-lib $ ls -l OpenBLAS | grep libopenblas
lrwxrwxrwx  1 aditya aditya      28 Apr 19 15:26 libopenblas.a -> libopenblas_armv8p-r0.2.18.a
-rw-rw-r--  1 aditya aditya 4754848 Apr 19 15:29 libopenblas_armv8p-r0.2.18.a

I have used following environment to build

caffe-android-lib $ uname -a
Linux ubuntu 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
caffe-android-lib $ cmake --version
cmake version 3.5.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

and android-ndk-r11c for android ndk

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

Hi @adityakamble49, could you have a try on docker build?

from caffe-android-lib.

adityakamble49 avatar adityakamble49 commented on June 25, 2024

@sh1r0 , Yes tried docker build , giving same error

from caffe-android-lib.

sh1r0 avatar sh1r0 commented on June 25, 2024

@adityakamble49 Could you let me know your docker version (via docker --version)?

from caffe-android-lib.

adityakamble49 avatar adityakamble49 commented on June 25, 2024

@sh1r0 Sure, Docker version as below

caffe-android-lib $ docker --version
Docker version 18.04.0-ce, build 3d479c0

from caffe-android-lib.

Bshowg avatar Bshowg commented on June 25, 2024

Disabling multi-threading in scripts/openblas.sh makes the error disappear and the library builds.
In particular change line 59 of openblash.sh to :
HOSTCC= gcc USE_THREAD=0 NUM_THREADS=1 USE_OPENMP=0

Although, the process is really slow. Any idea why this way it works?

EDIT: using the docker

from caffe-android-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.