Git Product home page Git Product logo

Comments (8)

Hramchenko avatar Hramchenko commented on July 21, 2024 1

OK. Give me 2 days to try to make the project again, with the latest versions of libmace and Android Studio(maybe they changed something) :)

from resnetm.

Hramchenko avatar Hramchenko commented on July 21, 2024 1

Hi @vyi! Thank you for your feedback. This is really wrong. I just forgot to replace the libraries :) I don't compile them at all. I simply download it from the official repository (from releases page). Thank you very much. I will now update the libraries in the project.

from resnetm.

Hramchenko avatar Hramchenko commented on July 21, 2024

Hello, thank you for your feedback.
It seems that compiler didn't link a mace libraries with the native code. Please, send me the linker output from Studio compiler window.

from resnetm.

serviceberry3 avatar serviceberry3 commented on July 21, 2024

Android Studio shortens the compiler output to just this:

../../../../src/main/cpp/mace_engine.cpp:111: error: undefined reference to 'mace::MaceEngineConfig::~MaceEngineConfig()'

Do you know how I can view the full output? Also, does this CMakeLists.txt look right to you?

set(LIBMACE_DIR ${CMAKE_SOURCE_DIR}/libmace/)


include_directories(/home/nodog/VENV/opt/include/)
add_library(libmace SHARED IMPORTED)
add_library(mace_engine SHARED src/main/cpp/mace_engine.cpp)


set_target_properties(libmace PROPERTIES IMPORTED_LOCATION ${LIBMACE_DIR}/arm64-v8a/libmace.so) #${CMAKE_ANDROID_ARCH_ABI}


# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
# default, you only need to specify the name of the public NDK library
# you want to add. CMake verifies that the library exists before
# completing its build.
find_library( # Sets the name of the path variable.
        log-lib
        # Specifies the name of the NDK library that
        # you want CMake to locate.
        log)



# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
        mace_engine
        libmace
        -ljnigraphics

        #Links the target library to the log library
        #included in the NDK.
        ${log-lib})

I basically copied your CMakeLists.txt, but my native cpp file is called mace_engine, not native-lib. Inside of LIBMACE_DIR I have an arm64_v8a folder, and inside that I have libmace.a and libmace.so.

from resnetm.

Hramchenko avatar Hramchenko commented on July 21, 2024

Your CMakeLists.txt looks good :) The only reason I can think of why everything doesn't work is because of problems with the libmace.so itself. Do I understand correctly that this is the binary that you got yourself after the build?

from resnetm.

serviceberry3 avatar serviceberry3 commented on July 21, 2024

@Hramchenko Yes, that's correct. Could you give me more detailed steps of how you built mace? I'm worried I'm doing something wrong. I'm on Ubuntu 20.04.

from resnetm.

Hramchenko avatar Hramchenko commented on July 21, 2024

Hi. Thank you for your report. I rebuilt project with latest libraries on my machine. It seems the binary version of libmace doesn't correspond with library sources.
Please download latest sources and binaries from https://github.com/XiaoMi/mace/releases/tag/v1.0.0.
If you are using latest Android Studio don't add sourceSets section. No further changes are required. I added the updated instructions to my article https://v-hramchenko.medium.com/run-your-pytorch-model-on-android-gpu-using-libmace-7e43f623d95c.
Thank you very much.

from resnetm.

vyi avatar vyi commented on July 21, 2024

Hi @Hramchenko, Thank you for your efforts. This is a very neat Android Project.

I wish to clarify a doubt. You mentioned the following :

I rebuilt project with latest libraries on my machine. It seems the binary version of libmace doesn't correspond with library sources.

In the repo, I see the shared library files libmace.so is the old version (last modified 6 month back). However the CMakeLists.txt was recently modified to include header definition from v1.0.0.

Does this imply that the present library files (${LIBMACE_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libmace.so) were compiled from source of these same headers (v1.0.0)?

from resnetm.

Related Issues (1)

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.