openframeworks / openframeworks/openFrameworks

Android ofImage load results in undefined references for uriparser

Open
#5,437 0 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

The following results in the below mentioned undefined references:

Setup:

  • Fresh checkout of master branch
  • get android libs
  • setup androidEmptyExample
  • run

The first time around, the lazy load of c++_shared.so as a dependency of ofAndroidLib is going to give you an unsatisfied link error. Open config.android.project.mk, and under the following line:

echo "LOCAL_MODULE := OFAndroidApp" >> jni/Android.mk

Add:

cp $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(ABI_PATH)/libc++_shared.so libs/$(ABI_PATH)/libc++_shared.so

Rebuild, and the project should run this time around.

Copy an image to the bin/data folder of androidEmptyExample, and add the following to ofApp::setup()

ofImage foo;
foo.load("image.png");

Results in the following:

/Users/mustafa/Development/OF2/openFrameworks/libs/openFrameworks/graphics/ofImage.cpp:191: error: undefined reference to 'uriParseUriA'
/Users/mustafa/Development/OF2/openFrameworks/libs/openFrameworks/graphics/ofImage.cpp:193: error: undefined reference to 'uriFreeUriMembersA'
/Users/mustafa/Development/OF2/openFrameworks/libs/openFrameworks/graphics/ofImage.cpp:197: error: undefined reference to 'uriFreeUriMembersA'

The issue is the downloaded libs for android extract the uriparser library incorrectly; we get:

openFrameworks/libs/uriparser/armeabi-v7a, where armeabi-v7a is the actual library rather than the target folder the library should be copied into. I am guessing this is something trivial in the way the libs are packed / extracted. To fix:

cd openFrameworks/libs/uriparser
mv armeabi-v7a liburlparser.a
mkdir armeabi-v7a ; cp liburlparser.a armeabi-v7a/

Do the same for the x86 lib and everything should be good to go.

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 config.android.project.mk and the downloaded library layout under libs/uriparser. Reproduce the issue using androidEmptyExample with an ofImage loading image.png, checking the armeabi-v7a and x86 library paths. Done means the Android build links without the uriParseUriA or uriFreeUriMembersA undefined references and the image loads successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cpp
Domain
build-system, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.