openframeworks / openframeworks/openFrameworks

Gradle failed to link ofAndroidLib

Open
#6,161 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

A strange link error happened today when I tried to build the project from command-line, see the error below. This didn't happen when I used the make button in Android Studio.

./gradlew build

........

:ofAndroidLib:compileReleaseUnitTestSources UP-TO-DATE
:ofAndroidLib:assembleReleaseUnitTest UP-TO-DATE
:ofAndroidLib:testReleaseUnitTest UP-TO-DATE
:ofAndroidLib:test UP-TO-DATE
:ofAndroidLib:check
:ofAndroidLib:build
:openFrameworksProject:compileOpenFrameworksLibArmeabi-v7aDebugArm7SharedLibraryOpenFrameworksLibArmeabi-v7aDebugArm7SharedLibraryMainCpp UP-TO-DATE
:openFrameworksProject:linkOpenFrameworksLibArmeabi-v7aDebugArm7SharedLibrary
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/utils/ofLog.cpp:29: error: undefined reference to 'ofxAndroidLogChannel::ofxAndroidLogChannel()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/gl/ofVbo.cpp:62: error: undefined reference to 'ofAppAndroidWindow::isSurfaceDestroyed()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/gl/ofVbo.cpp:71: error: undefined reference to 'ofAppAndroidWindow::isSurfaceDestroyed()'
/Users/lewisou/Tools/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/memory:2157: error: undefined reference to 'ofxAndroidVideoPlayer::ofxAndroidVideoPlayer()'
/Users/lewisou/Tools/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/memory:2044: error: undefined reference to 'ofxAndroidVideoPlayer::~ofxAndroidVideoPlayer()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/gl/ofShader.cpp:816: error: undefined reference to 'ofxAndroidEvents()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/gl/ofShader.cpp:817: error: undefined reference to 'ofxAndroidEvents()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/gl/ofShader.cpp:130: error: undefined reference to 'ofxAndroidEvents()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/gl/ofShader.cpp:745: error: undefined reference to 'ofxAndroidEvents()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/utils/ofUtils.cpp:1147: error: undefined reference to 'ofxAndroidLaunchBrowser(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator >)'
/Users/lewisou/Tools/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/memory:2157: error: undefined reference to 'ofxAndroidVideoGrabber::ofxAndroidVideoGrabber()'
/Users/lewisou/Tools/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/memory:2044: error: undefined reference to 'ofxAndroidVideoGrabber::~ofxAndroidVideoGrabber()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/utils/ofSystemUtils.cpp:314: error: undefined reference to 'ofxAndroidAlertBox(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator >)'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/utils/ofSystemUtils.cpp:774: error: undefined reference to 'ofxAndroidAlertTextBox(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator >, std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator >)'
/Users/lewisou/Tools/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/memory:2157: error: undefined reference to 'ofxAndroidSoundStream::ofxAndroidSoundStream()'
/Users/lewisou/Tools/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/memory:2044: error: undefined reference to 'ofxAndroidSoundStream::~ofxAndroidSoundStream()'
/Users/lewisou/Tools/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/memory:2157: error: undefined reference to 'ofxAndroidSoundPlayer::ofxAndroidSoundPlayer()'
/Users/lewisou/Tools/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/memory:2044: error: undefined reference to 'ofxAndroidSoundPlayer::~ofxAndroidSoundPlayer()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/gl/ofTexture.cpp:149: error: undefined reference to 'ofAppAndroidWindow::isSurfaceDestroyed()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/gl/ofTexture.cpp:159: error: undefined reference to 'ofAppAndroidWindow::isSurfaceDestroyed()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/utils/ofThread.cpp:156: error: undefined reference to 'ofGetJavaVMPtr()'
/Users/lewisou/Projects/openFrameworks/libs/openFrameworks/utils/ofThread.cpp:175: error: undefined reference to 'ofGetJavaVMPtr()'
/Users/lewisou/Tools/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/memory:2157: error: undefined reference to 'ofAppAndroidWindow::ofAppAndroidWindow()'
/Users/lewisou/Tools/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/memory:2044: error: undefined reference to 'ofAppAndroidWindow::~ofAppAndroidWindow()'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

:openFrameworksProject:linkOpenFrameworksLibArmeabi-v7aDebugArm7SharedLibrary FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':openFrameworksProject:linkOpenFrameworksLibArmeabi-v7aDebugArm7SharedLibrary'.

A build operation failed.
Linker failed while linking libopenFrameworksLib.so.
See the complete log at: file:///Users/lewisou/Projects/openFrameworks/libs/openFrameworksCompiled/project/android/build/tmp/linkOpenFrameworksLibArmeabi-v7aDebugArm7SharedLibrary/output.txt

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 7.941 secs
Zhenyas-MacBook-Pro:mtcam_android lewisou$ ./gradlew --version


Gradle 3.3

Build time: 2017-01-03 15:31:04 UTC
Revision: 075893a3d0798c0c1f322899b41ceca82e4e134b

Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_31 (Oracle Corporation 25.31-b07)
OS: Mac OS X 10.13.6 x86_64

Below is my openFramework github version:

commit 6127e9fb81520f27996265aea704255cc17748f8
Author: lilive lilivve@yahoo.fr
Date: Fri Aug 10 18:51:31 2018 +0200

Add option to create console window in QtCreator wizards (#6105)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the :openFrameworksProject:linkOpenFrameworksLibArmeabi-v7aDebugArm7SharedLibrary task and its output.txt log, then compare the command-line Gradle build with the Android Studio build. Trace how the reported Android symbols are included in the link; done means ./gradlew build completes without the undefined-reference errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cpp
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.