Function 'glDrawTexfOES' could not be resolved - android

I'm creating a native android project using eclipse. I'm using opengl es 1.1.
I get this error when using a function from the glext.h file
Function 'glDrawTexfOES' could not be resolved
I'm using a function from gl.h right before i call the glDrawTexfOES. I'm able to use macros defined in the glext.h such as GL_TEXTURE_CROP_RECT_OES, so i know the file is included all right.
looking at the glext.h file, i found the function declaration i want, which is in an #ifdef block (#ifdef GL_GLEXT_PROTOTYPES). I defined GL_GLEXT_PROTOTYPES immediately before including glext.h, and i still have the same problem. I went into glext.h and edited it, first by commenting the ifdef and endif lines surrounding the functions i want. i still got the same error as above. then i copied the function declaration and pasted it at the top of the glext.h file, and my project still says it can't resolve that function.
I know glext.h is deprecated, but i should still be able to use it

I had this same issue, but then put this in my Android.mk file:
LOCAL_CFLAGS += -D GL_GLEXT_PROTOTYPES
http://grokbase.com/t/gg/android-ndk/11cxrckjmp/ndkr7-cant-see-gldrawtexioes

Related

Symbol from C file is not being added even though the MakeFile includes its object file

I'm trying to build libavformat with this MAKEFILE. Although the makefile includes avio.o file in its build instruction but it doesn't add any symbol for the functions that are declared on the header file url.h. Source folder which includes the avio.c, avio.h and url.h files can be found HERE.
The nm command for avio.o returns
nm: avio.o: File format not recognized
file command on avio.o shows the following output
avio.o: LLVM IR bitcode
I have checked the nm command on the generated libavformat.so and did not find any symbols for the functions declared on the url.h file
I have been stuck on this for two days. Could not figure out how to solve this problem!
Calling the ff_check_interrupt method and results in
undefined reference to 'ff_check_interrupt'
Configurations and flags.
FFmpeg Configuration File: Config.h
FFmpeg Root MakeFile: Root MakeFile
CC, CXX, CFLAGS, LDFLAGS: FLAGS
First off, a function declared by url.h should be defined in url.c, not in avio.c.
Second the only use of the ff_check_interrupt in avoi.c is within a static inline function, so indeed the toolchain is likely optimizing this symbol away.
I think what's occurring for you is that the toolchain making the decision that this is only used in this compilation unit.
Moving the definition of ff_check_interrupt to 'url.c' should resolve the issue. This is a library though, so out of your control.
However, this doesn't answer why thousands of users on Github have this same library in their code. I'd suggest comparing your Makefile against those (e.g. first search return is this one.

Strange Makefile, need explanations

I'm trying to compile a kernel but can't figure out how its Makefile work : https://github.com/LineageOS/android_kernel_sony_msm8994/blob/cm-14.1/scripts/Makefile.build
As I have this error when building : Build of a custom Linux/Android/LineageOS kernel in C doesn't work , I'm for now trying to understand up until the line 44.
Why are there several Makefile with extensions like .build .clean etc rather than these actions being "targets" within the main Makefile?
How can I figure out what the very first $(obj) var refers to ?
Is the mathematical syntax := "equals by definition" instead of = specific to the developper? I do saw this on mathematics notes or symbolic languages such as Wolfram/Mathematica if I'm right, but never within a program.
Why does PHONY := is a variable and not a "type of action" as in the doc ? It should be written .PHONY: as on the very last line of the file. I didn't get this trick.
Why are there 2 underscores before __build the value of PHONY ?
By thanking you for your precisions
Because the person who wrote the makefile wanted to break those out into separate files. Maybe they're included in multiple other files, or they just wanted the top-level makefile to be more clean to read.
You can run make with the -p option and it will print all the values of all the variables in the makefile.
I don't quite understand the question: the := operator in a makefile is used for simply-expanded variable assignments. See the GNU make manual for more info.
That sets the variable PHONY to contain some contents. It is just a normal variable assignment, there's nothing fancy here. Presumably somewhere else in the makefile will appear a line: .PHONY: $(PHONY) and that will make all the targets in the PHONY variable phony.
Because the person who wrote the makefile wanted to use two underscores.

No matching function for std::find() in eclipse. Works fine in XCode

I"m running into an eclipse head scratcher. I have trying to check to see if a certain string is in a std::vector called multiplayername. I call
if (std::find(multiplayernames.begin(), multiplayernames.end(), username) == multiplayernames.end())
{
//blah blah
}
to do it, which works perfectly find in XCode, but gives me a
no matching function for call to
'find(std::vector<std::basic_string<char> >::iterator,
std::vector<std::basic_string<char> >::iterator, std::string&)
error in eclipse. I assume this is an issue with how I have Eclipse set up.
Currently, I have
APP_STL := gnustl_static
in the application.mk and I'm using ndk8b for both XCode and Eclipse. What else do I need to fix to get this working?
You'll need to include the header that declares std::find
#include <algorithm>
You're probably missing a header. Now, implementations may indirectly include one header from another, which means that XCode can include a header even if you didn't do so explicitly.

How to use CallStack (in CallStack.tpp) in a executable on android platform?

A question from https://stackoverflow.com/a/11467040/1442443
my final target is to dump user space stack.
I try to build a cpp file as below to a executable on android platform. Therefore, by calling tryToGetStack(), I can get call stack of my executable in run time.
#include <utils/CallStack.h>
namespace android
{
extern "C" void tryToGetStack()
{
CallStack stack;
stack.update();
stack.dump("");
}
}
and add lib setting to to Android.mak since CallStack.tpp is in libutils
LOCAL_SHARED_LIBRARIES += libutils
but I always get error with message:
error: undefined reference to 'android::CallStack::CallStack()'
error: undefined reference to 'android::CallStack::update(int, int)'
...
It seems the executable resolve the symbols at link time rather than load the .so file in runtime?
Do I missing something or there is some limit in Android build system?
I know it is a simple question, but I really need help...
update1
I try to add the code to another executable. The result is same... Does anyone knows the rule of android build system?
update2
There are some key words in my console "target StaticExecutable: ...", I think is is the answer.
http://en.wikipedia.org/wiki/Static_executable
my final target is to dump user space stack.
after google so many information from internet, I found there are 4 ways:
ptraceļ¼š http://en.wikipedia.org/wiki/Ptrace
It is really hard to use ptrace, and we need to stop the thread before using ptrace to attach
_unwind_backtrace: the way used by CallStack (CallStack class in CallStack.cpp)
example: http://git.stlinux.com/?p=stm/uclibc.git;a=blob;f=libubacktrace/sysdeps/sh/backtrace.c;h=18b91b1bb3fa26344a521927c631553a410fcf56;hb=d6a3d9ece5922a337800a8e2ed4db7e226f9ccb3
It is work with a drawback: if you use it as the thread is processing signal, it would dump signal stack rather than dump thread stack
The same problen: How to get fullstacktrace using _Unwind_Backtrace on SIGSEGV
backtrace: http://www.gnu.org/software/libc/manual/html_node/Backtraces.html
a GNU extension function, not be implemented in Bionic libc used by Android
reference: https://stackoverflow.com/a/8295238/1442443
reference: http://lists.puredata.info/pipermail/pd-list/2012-02/094258.html
a patch to dump user space thread stack: http://www.gossamer-threads.com/lists/linux/kernel/1525096
but only be implemented in X86 architecture... orz
I try to port it to android, no it only shows the first frame of stack since arm does not use frame pointer.
So... 2 is the answer.
However, I wonder if someone can resolve the problem : How to get fullstacktrace using _Unwind_Backtrace on SIGSEGV
update:
if you can use cross compiler to use glic to compile your code, maybe you can use 3. backtrace !
http://communities.mentor.com/community/cs/archives/arm-gnu/msg02514.html
update2
a good article
http://codingrelic.geekhold.com/2009/05/pre-mortem-backtracing.html
Since this is such an important question here is my answer that worked for me. My code is in C so it has to call a C++ function that can access android::CallStack.
stackdump.cpp:
#include < utils/CallStack.h >
extern "C" void dumpCallStack( char *label)
{
android::CallStack cs;
cs.update();
cs.dump(label);
}
my main code (foo.c):
void dumpCallStack(char *label);
...
dumpCallStack(\__FUNCTION__);
I have had the same problem once. And it is hard to interpret.
The syntax is of course correct and reasonable!
I have tried many methods but it did not work.
Finally, I got an idea that, the lib reference "LOCAL_SHARED_LIBRARIES += libutils" should be put into a makefile generating a dynamic library rather than into a makefile generating a static library. This is the final reason.
Reference:
http://yongbingchen.github.io/blog/2013/05/09/dump-stack-in-android-native-c-code/
I also received this error, but I added:
LOCAL_STATIC_LIBRARIES += libutils
before line of LOCAL_MODULE := xxx in vm/Android.m of three targets and added
LOCAL_SHARED_LIBRARIES += libcorkscrew
in vm/Android.mk
and libdex/Android.mk, and same for the dexlist/Android.mk, dexdump/Android.mk
After all these done, it works for me.

Problem using OpenCV2.3.1 with Android Native Activity

i'm developing a computer vision application for Android.
That work involves getting camera frames as fast as possible, so I'm trying to build a android application directly in c++ using "android_native_app_glue" and "libnative_camera" to get camera frames.
It seems to be incompatible.
I tested out 2 options.
I tried to use OpenCV on the android NDK sample "NativeActivity", just make the few necessary changes (convert sample to c++, modify android.mk y application.mk and including using namespaces and includes) It gives the following error:
sharedLibrary : libnative-activity.so
C:/Development/android-opencv-wsp/samples/native-activity/obj/local/armeabi-v7a/objs/native-activity/main.o: In function ~Mat':
C:\Development\android-opencv-wsp\samples\native-activity/../../OpenCV-2.3.1/share/OpenCV/../../include/opencv2/core/mat.hpp:297: undefined reference tocv::fastFree(void*)'
and so on
I tried to import the necessary libraries to make a native activity on the OpenCV2.3.1 tutorial 3 sample. I simply modified the Android.mk and added:
LOCAL_STATIC_LIBRARIES := android_native_app_glue
Immediately, when I add this line, I get the following error:
SharedLibrary : libnative_sample.so
C:/Development/android-opencv-wsp/samples/tutorial-3-native/obj/local/armeabi-v7a/objs/native_sample/jni_part.o: In function ~Mat':
C:\Development\android-opencv-wsp\samples\tutorial-3-native/../../OpenCV-2.3.1/share/OpenCV/../../include/opencv2/core/mat.hpp:297: undefined reference tocv::fastFree(void*)'
and so on...
Please, has anyone tested a purely native activity with openCV2.3.1 and libnative_camera to get camera frames?
Thanks in advance.
I solved the problem there. It was my fault (as usual xD) the problem was I was writting in my Android.mk this line: LOCAL_STATIC_LIBRARIES := android_native_app_glue, instead of this line: LOCAL_STATIC_LIBRARIES += android_native_app_glue. I needed the "plus" symbol, in order to add the new library and not deleting the previously loaded. Thanks anyway!!
#Adi Shavit - thx
Change LOCAL_STATIC_LIBRARIES := android_native_app_glue to LOCAL_STATIC_LIBRARIES += android_native_app_glue. Note the plus sign. This will add the new library without deleting the previously loaded one. Source: Edanna in the comments
Maybe you should take a look at the V4L interface? You might want to check out this thread: http://comments.gmane.org/gmane.comp.handhelds.android.ndk/2824
If I recall you can read directly from a camera's dev file in OpenCV.
-James

Categories

Resources