openframeworks / openframeworks/openFrameworks
Android ofImage load results in undefined references for uriparser
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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