undefined reference error while building FFMPEG with NDK - android

I get this error while running build-ndk for my ffmpeg android project
make: *** [obj/local/armeabi-v7a/libffmpeg-test-jni.so]
undefined reference to 'av_close_input_file'
undefined reference to 'av_find_stream_info'
undefined reference to 'av_open_input_file'
undefined reference to 'avcodec_open'
Any solutions to get rid of this error ? I am very new to ffmpeg and Android NDK
This is my Android MK file
LOCAL_PATH := $(call my-dir)
#declare the prebuilt library
include $(CLEAR_VARS)
LOCAL_MODULE := ffmpeg-prebuilt
LOCAL_SRC_FILES := ffmpeg-2.5.4/android/armv7-a/libffmpeg.so
LOCAL_EXPORT_C_INCLUDES := ffmpeg-2.5.4/android/armv7-a/include
LOCAL_EXPORT_LDLIBS := ffmpeg-2.5.4/android/armv7-a/libffmpeg.so
LOCAL_LDLIBS += -llog -lavutil -lavformat -lavcodec -lz -lavutil -lm
LOCAL_PRELINK_MODULE := true
include $(PREBUILT_SHARED_LIBRARY)
#the andzop library
include $(CLEAR_VARS)
LOCAL_ALLOW_UNDEFINED_SYMBOLS=false
LOCAL_MODULE := ffmpeg-test-jni
LOCAL_SRC_FILES := ffmpeg-test-jni.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/ffmpeg-2.5.4/android/armv7-a/include
LOCAL_SHARED_LIBRARY := ffmpeg-prebuilt
LOCAL_LDLIBS := -llog -ljnigraphics -lz -lm $(LOCAL_PATH)/ffmpeg-2.5.4/android/armv7-a/libffmpeg.so
include $(BUILD_SHARED_LIBRARY)
Any Pointers much appreciated
Thanks!

Related

AddressSanitizier: error: undefined reference to "__asan_report_load4"

When I compiled a test Android program by enabling the AddressSanitizier, I got this error:
error: undefined reference to __asan_report_load4
Does anyone know what happened here?
This is my Android.mk:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := asan_boom.c
LOCAL_SHARED_LIBRARIES := libc
LOCAL_CFLAGS := -O1 -g -fsanitize=address -fno-omit-frame-pointer
LOCAL_MODULE := asan_boom
include $(BUILD_EXECUTABLE)

Android NDK, error: undefined reference to function of .h file

This is my android.mk file but when I Compile this I get this error
Error while creating
My android.mk file
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libNDK
LOCAL_CFLAGS := -DANDROID_NDK \
-DDISABLE_IMPORTGL
LOCAL_SRC_FILES := SerialPort.c
LOCAL_CFLAGS := -std=c99
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog
include $(BUILD_SHARED_LIBRARY)

ndk-build gstreamer android tutorial: cannot find -lrt

I am following the tutorial at
http://docs.gstreamer.com/display/GstSDK/Installing+for+Android+development
I would like to use ndk-build to build the example.
When I use "ndk-build", there is an error message.
Here are the output messages:
GStreamer : [GEN] => gst-build/gstreamer_android.c
GStreamer : [COMPILE] => gst-build/gstreamer_android.c
GStreamer : [LINK] => gst-build/libgstreamer_android.so
/home/quanta/tools/android-ndk-r9d/toolchains/arm-linux-androideabi-
4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.gold: error: cannot find -lrt
collect2: ld returned 1 exit status
make: *** [buildsharedlibrary] Error 1
I use ndk-r9d in ubuntu linux 64bit 12.04
Many thanks for any suggestion.
Add Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := tutorial-1
LOCAL_SRC_FILES := tutorial-1.c
LOCAL_SHARED_LIBRARIES := gstreamer_android
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
ifndef GSTREAMER_SDK_ROOT
ifndef GSTREAMER_SDK_ROOT_ANDROID
$(error GSTREAMER_SDK_ROOT_ANDROID is not defined!)
endif
GSTREAMER_SDK_ROOT := $(GSTREAMER_SDK_ROOT_ANDROID)
endif
GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_SDK_ROOT)/share/gst-android/ndk- build/
GSTREAMER_PLUGINS := coreelements
include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer.mk
LOCAL_LDLIBS := -llog
to
LOCAL_LDLIBS := -llog -landroid
Android doesn't have a librt. It's all in libc.
Presumably include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer.mk is adding -lrt to ldlibs.

Android studio NDK Undefined reference to GL functions

I made small JNI-based project.
I do #include GLES3/gl3.h in my C code and it works. But when I try to use ANY OpenGL function it says Undefined reference to gl*. My Android.mk is:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := hello-jni
LOCAL_CFLAGS := -Wall -Wextra
LOCAL_SRC_FILES := hello-jni.c
LOCAL_LDLIBS := -lGLESv3 -ldl -llog
LOCAL_STATIC_LIBRARIES := android_native_app_glue
include $(BUILD_SHARED_LIBRARY)
What I am doing wrong? Could some one tell me what's wrong?
Try linking to EGL as well.
For my projects, I use these libraries:
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv3

Undefined references appears when including iostream

I have tried to compile very simple code for android:
#include <iostream>
void foo()
{
}
But I get some linking errors:
/home/l/android-ndk-r7b/sources/cxx-stl/gnu-libstdc++/include/iostream:72: undefined reference to `std::ios_base::Init::Init()'
/home/l/eclipse_workspace/android_bt_test1/jni/native.cpp:33: undefined reference to `std::ios_base::Init::~Init()'
My Application.mk is:
APP_OPTIM := debug
APP_MODULES := native_lab
APP_STL := gnustl_static
My Android.mk is:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := native_lab
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_SRC_FILES := native.cpp
LOCAL_LDLIBS := -ldl -lstdc++ -llog
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include /home/l/android-ndk-r7b/sources/cxx-stl/gnu-libstdc++/include/ /home/l/android-ndk-r7b/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include
include $(BUILD_SHARED_LIBRARY)
I know this problem is very easy, but I have't found a resolution.
Could anybody help me please?

Categories

Resources