there is a source code which is built fine (using cmake) for my host platform but when i target android(using android studio cmake) on the same platfrom it gives me the following errors:
Error:error: cannot find -l[/root/libuv-1.x/out/cmake/libuv.a]
Error:error: cannot find -lpthread
Error:(49) undefined reference to 'uv_default_loop'
Error:(84) undefined reference to 'uv_fs_open'
Error:(49) undefined reference to 'uv_now'
...
any reference to properties defined in uv headers creates a undefined reference to x error.
this is how i include uv in the project cmake:
set(UV_INCLUDE_DIR "[/root/libuv-1.x/include/]")
set(UV_LIBRARY "[/root/libuv-1.x/out/cmake/libuv.a]")
find_package(UV REQUIRED)
include_directories("/root/libuv-1.x/include/")
include_directories(${UV_INCLUDE_DIR})
and this is how i compile and link the source code in cmake:
add_library(proto-lib SHARED ${HEADERS} ${SOURCES} ${HTTPD_SOURCES})
target_link_libraries(proto-lib ${UV_LIBRARIES} ${EXTRA_LIBS})
the libuv doesn't seem to be included at all.
how can i fix this?
Related
I'm trying to cross-compile ncurses using android-ndk but compilation error shows halfway the process.
Command:
CC=~/my-toolchain/bin/arm-linux-androideabi-gcc ./configure --host=arm-linux-androideabi --prefix=/Android
Output:
** Configuration summary for NCURSES 6.0 20150808:
extended funcs: yes
xterm terminfo: xterm-new
bin directory: /Android/bin
lib directory: /Android/lib
include directory: /Android/include/ncurses
man directory: /Android/share/man
terminfo directory: /Android/share/terminfo
** Include-directory is not in a standard location
Command
make
Output
../objects/tic.o:tic.c:function usage: error: undefined reference to 'stderr'
../objects/tic.o:tic.c:function put_translate: error: undefined reference to 'stdout'
../objects/tic.o:tic.c:function copy_input: error: undefined reference to 'stderr'
../objects/tic.o:tic.c:function open_input: error: undefined reference to 'stdin'
../objects/tic.o:tic.c:function open_input: error: undefined reference to 'stderr'
../objects/tic.o:tic.c:function show_databases: error: undefined reference to 'stdout'
../objects/tic.o:tic.c:function show_databases: error: undefined reference to 'stderr'
../objects/dump_entry.o:dump_entry.c:function show_entry: error: undefined reference to 'stdout'
../objects/dump_entry.o:dump_entry.c:function compare_entry: error: undefined reference to 'stdout'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_SET_chk'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_SET_chk'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_ISSET_chk'
../lib/libncurses.a(lib_twait.o):lib_twait.c:function _nc_timed_wait: error: undefined reference to '__FD_ISSET_chk'
collect2: error: ld returned 1 exit status
Makefile:242: recipe for target 'tic' failed
make[1]: *** [tic] Error 1
make[1]: Leaving directory '/home/jrm/softether/src/curses/ncurses-6.0/progs'
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2
I don't have any idea about the error. I tried using google but i can't seem to find similar problems like mine.
The usual reason for this error is that you've compiled against android-23 or higher but are linking against something earlier. Another variation of that issue is when you have multiple libraries built against different API levels.
It looks like you are using a standalone toolchain? If that's correct, then I'd suspect your issue is either a prebuilt library that's part of libcurses (FWIR there aren't any of those, so unlikely) or that there's something funky going on in their build scripts that causes one of the two issues I mentioned. Tons of projects add their own Android specific hacks to their build scripts that always end up being the cause of these sorts of issues, so that wouldn't surprise me at all.
Should look at both the compilation command for tic.c and the link command for whatever library/executable is failing to link there. Make sure both are using the same API levels (look for things like $NDK/platforms/android-$API_LEVEL, -D__ANDROID_API__=$API_LEVEL, and -target arm-linux-androideabi$API_LEVEL).
btw, not ncurses 6, but I do have an example showing how to use standalone toolchains that had to build ncurses 5.9: https://github.com/DanAlbert/lua-ndk/blob/master/build_lua_with_libreadline.sh#L75. Might be worth taking a look to see if that helps at all.
I'm trying to build analytics support into a Qt (Android and iOS) application using the Firebase C++ libraries (2.0.0 / 2.1.0). When my app is being linked I get the following errors:
blaze-out/arm-linux-androideabi-4.8-bionic-armv7a-opt/genfiles/firebase/app/client/cpp/include/firebase/variant.h:533: error: undefined reference to 'firebase::Variant::assert_is_type(firebase::Variant::Type) const'
blaze-out/arm-linux-androideabi-4.8-bionic-armv7a-opt/genfiles/firebase/app/client/cpp/include/firebase/variant.h:543: error: undefined reference to 'firebase::Variant::assert_is_type(firebase::Variant::Type) const'
blaze-out/arm-linux-androideabi-4.8-bionic-armv7a-opt/genfiles/firebase/app/client/cpp/include/firebase/variant.h:553: error: undefined reference to 'firebase::Variant::assert_is_type(firebase::Variant::Type) const'
blaze-out/arm-linux-androideabi-4.8-bionic-armv7a-opt/genfiles/firebase/app/client/cpp/include/firebase/variant.h:567: error: undefined reference to 'firebase::Variant::assert_is_string() const'
firebase/analytics/client/cpp/src/analytics_android.cc:228: error: undefined reference to 'firebase::Variant::TypeName(firebase::Variant::Type)'
collect2: error: ld returned 1 exit status
What am I missing?
I'm including the following headers (following the examples from GitHub)
#include "firebase/analytics.h"
#include "firebase/analytics/event_names.h"
#include "firebase/analytics/parameter_names.h"
#include "firebase/analytics/user_property_names.h"
And linking against libapp.a and libanalytics.a in my pri file:
LIBS += -L$$FIREBASE_SDK_LIBS_PATH -lapp
LIBS += -L$$FIREBASE_SDK_LIBS_PATH -lanalytics
I have the AdMob example working in a similar setup - but I can't get the analytics to build...
Turns out the order of linking is important.
Link libanalytics.a before libapp.a and it works
LIBS += -L$$FIREBASE_SDK_LIBS_PATH -lanalytics
LIBS += -L$$FIREBASE_SDK_LIBS_PATH -lapp
(I was linking app first)
I have troubles to run the GStreamer tutorials. I followed all tutorial steps, and run into an error.
My System:
android-ndk-r11c, gstreamer-sdk-android-arm-debug-2013.6
My System: Windows 10 - 64 bit
The Error:
C:\gstreamer-sdk-android-arm-debug-2013.6\share\gst-sdk\tutorials\android-tutorial-1>ndk-build
GStreamer : [GEN] => gst-build/gstreamer_android.c
GStreamer : [COMPILE] => gst-build/gstreamer_android.c
GStreamer : [LINK] => gst-build/libgstreamer_android.so
lex.priv_gst_parse_yy.c:1598: error: undefined reference to '__srget'
gutils.c:2406: error: undefined reference to 'issetugid'
localcharset.c:158: error: undefined reference to '__srget'
localcharset.c:167: error: undefined reference to '__srget'
./localcharset.c:195: error: undefined reference to '__srget'
/home/slomo/Projects/android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.7/include-fixed/stdio.h:376: error: undefined reference to '__swbuf'
collect2.exe: error: ld returned 1 exit status
make: *** [buildsharedlibrary] Error 1
C:\gstreamer-sdk-android-arm-debug-2013.6\share\gst-sdk\tutorials\android-tutorial-1>
I tried:
Windows linkage problems : Due to problems related to the standard linker, Google’s Gold Linker is used to build GStreamer applications. Unfortunately, the Android NDK toolchain for Windows does not include the gold linker and the standard one has to be used.
If you observe linkage problems, you can replace the linker in your Android NDK with the gold one from this project. Download the android-ndk-r8b-ma-windows.7z file, extract \android-ndk-r8b\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\arm-linux-androideabi\bin\ld.exe (only this file is needed) and overwrite the one in the same folder in your Android NDK installation.
No effect. Any ideas how to solve this?
I had similar problem before please give a try with ndk10b.It is always good to check in header files for __srget before move forward.
I'm able to run the hello-jni of the samples provided in the NDK but I can't compile the hello-gl2 sample.
Could you help me? (I think is a problem linking with OpenGL)
This are the errors reported by Android Studio:
C:\AndroidstudioProjects\hello-gl2\app\src\main\jni\gl_code.cpp
Error:(39) undefined reference to `glGetError'
Error:(41) undefined reference to `__android_log_print'
Error:(40) undefined reference to `glGetError'
Error:(34) undefined reference to `glGetString'
Error:(35) undefined reference to `__android_log_print'
Error:(58) undefined reference to `glCreateShader'
Error:(60) undefined reference to `glShaderSource'
Error:(61) undefined reference to `glCompileShader'
Error:(63) undefined reference to `glGetShaderiv'
Error:(66) undefined reference to `glGetShaderiv'
Error:(70) undefined reference to `glGetShaderInfoLog'
Error:(72) undefined reference to `__android_log_print'
Error:(75) undefined reference to `glDeleteShader'
...
In your Android.mk file (in the /jni folder), there should be a LOCAL_LDLIBS line. Some of the libraries that come bundled with Android need to be indicated here. Try the following
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM
Or at least add the options -lEGL and -lGLESv1_CM. The first is the EGL library, and the second is the GLES library.
I don't know if the last one is the right version number for your project though.
Finally I used eclipse (for those that are dealing with the same problems) and with Eclipse all went fine.
I found optimization for NEON in pngrutil.c. But when I define a macro "PNG_ARM_NEON" and try to compile the sources in android NDK, I get these link errors:
/libpng/pngrutil.c:3730: undefined reference to `png_read_filter_row_up_neon'
/libpng/pngrutil.c:3730: undefined reference to `png_read_filter_row_sub4_neon'
/libpng/pngrutil.c:3730: undefined reference to `png_read_filter_row_avg4_neon'
/libpng/pngrutil.c:3730: undefined reference to `png_read_filter_row_paeth4_neon'
/libpng/pngrutil.c:3730: undefined reference to `png_read_filter_row_sub3_neon'
/libpng/pngrutil.c:3730: undefined reference to `png_read_filter_row_avg3_neon'
/libpng/pngrutil.c:3730: undefined reference to `png_read_filter_row_paeth3_neon'
I found that these functions are declared in "pngpriv.h", but couldn't find the implementations in any source file.
Is the "NEON Optimization" already available for use in current version of libpng or just "TODO"?