Android NDK: Linking "error: undefined reference to" GLES functions - android-ndk

So I have the following on my Android.mk....
...
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include /Users/myname/Development/Android/android-ndk-r8c/platforms/android-14/arch-arm/usr/include
...
LOCAL_LDLIBS := -ldl -lGLESv1_CM -llog
However, when I try running ndk-build I get the following....
/Users/myname/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/libSDL.a(SDL_render_gles.o): in function GLES_CreateRenderer:jni/SDL/src/render/opengles/SDL_render_gles.c:189: error: undefined reference to 'glDisableClientState'
collect2: ld returned 1 exit status
This of course appears to be an issue linking, however, the compiler worked just fine. I am confused as to why the linking wouldn't work but the compilation would. Anyonw know how I could fix it?
From ndk-build V=1 >Build.log Output
UPDATE:
Ok so I am taking the code found here this compiles fine, however, I am trying to upgrade to PRBoom+ so I dl the code from here and tweak the Android.mk to include the new classes. Once this is done it seems to compile fine, however, it fails to properly link. There are two main errors I see...
First is involving multiple definitions, however, the original (compiled linked fine) code had the same multiple definitions....
/Users/me/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/objs-debug/prboom_jni/w_mmap.o: multiple definition of 'W_InitCache'
The other type is the OpenGL issues...
/Users/me/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/libSDL.a(SDL_render_gles.o): in function GLES_ResetState:/Users/jackiegleason/Development/Code/prboom4android-base/jni/SDL/src/render/opengles/SDL_render_gles.c:181: error: undefined reference to 'glDisable'
If I copy everything back (using the prboom4android code) everything compiles and links just fine.
Here is a diff of the 2 Android.mk files...
< LOCAL_C_INCLUDES:= $(LOCAL_PATH) $(LOCAL_PATH)/include $(LOCAL_PATH)/../SDL_net/include $(LOCAL_PATH)/../SDL/include $(LOCAL_PATH)/MUSIC $(LOCAL_PATH)/MUSIC/include $(LOCAL_PATH)/TEXTSCREEN $(LOCAL_PATH)/TEXTSCREEN/include
---
> LOCAL_C_INCLUDES:= $(LOCAL_PATH) $(LOCAL_PATH)/include $(LOCAL_PATH)/../SDL_net/include $(LOCAL_PATH)/../SDL/include
28c28
< f_finale.c p_enemy.c p_spec.c r_plane.c w_mmap.c i_capture.c \
---
> f_finale.c p_enemy.c p_spec.c r_plane.c w_mmap.c \
31,36c31,33
< m_bbox.c p_inter.c p_tick.c r_things.c z_zone.c s_advsound.c memio.c \
< d_client.c i_video.c i_network.c i_system.c PCSOUND/pcsound.c PCSOUND/pcsound_sdl.c SDL/i_sshot.c \
< i_main.c sc_man.c SDL/i_sound.c jni_doom.c mus2mid.c pcm2wav.c e6y.c SDL/i_joy.c \
< r_screenmultiply.c hu_tracers.c i_smp.c g_overflow.c i_pcsound.c \
< MUSIC/dbopl.c MUSIC/flplayer.c MUSIC/portmidiplayer.c MUSIC/midifile.c MUSIC/opl_queue.c MUSIC/vorbisplayer.c MUSIC/dumbplayer.c MUSIC/oplplayer.c MUSIC/madplayer.c MUSIC/opl.c \
< TEXTSCREEN/txt_button.c TEXTSCREEN/txt_separator.c TEXTSCREEN/txt_gui.c TEXTSCREEN/txt_widget.c TEXTSCREEN/txt_checkbox.c TEXTSCREEN/txt_radiobutton.c TEXTSCREEN/txt_inputbox.c TEXTSCREEN/txt_spinctrl.c TEXTSCREEN/txt_window.c TEXTSCREEN/txt_desktop.c TEXTSCREEN/txt_scrollpane.c TEXTSCREEN/txt_io.c TEXTSCREEN/txt_strut.c TEXTSCREEN/txt_window_action.c TEXTSCREEN/txt_dropdown.c TEXTSCREEN/txt_sdl.c TEXTSCREEN/txt_label.c TEXTSCREEN/txt_table.c
---
> m_bbox.c p_inter.c p_tick.c r_things.c z_zone.c \
> d_client.c i_video.c i_network.c i_system.c \
> i_main.c i_sound.c jni_doom.c mmus2mid.c pcm2wav.c

Yes, I could download your Build.log.
Your build uses APP_PLATFORM = android-3, which does not have the necessary GL libraries. You can set APP_PLATFORM = android-14 in your Application.mk, or set the target platform for your Android project (Eclipse will update the project.properties file).
You should not add the android-14 includes manually in your Android.mk. When you have correct APP_PLATFORM, the include path will be adjusted accordingly.

Related

Yocto - building application using wpa-supplicant library (libwpa_client)

I've got a C++ application in a Yocto build that requires the library file libwpa_client.so. This file is provided by wpa-supplicant. I brute forced installation of this file into my Yocto image as the wpa-supplicant recipe wasn't doing it for me. I'm now trying to figure out the proper way to pull this library file in during an autotools build.
The bb recipe for the C++ application includes:
DESCRIPTION = "My C++ Application recipe"
LICENSE = "CLOSED"
PACKAGES = "\
${PN} \
${PN}-dev \
${PN}-dbg \
"
DEPENDS = " libegt sqlite3-native libgpiod wpa-supplicant"
# Add for gpiod.h
RDEPENDS_${PN} = "libgpiod wpa-supplicant"
RDEPENDS_${PN}-dev = "libgpiod wpa-supplicant"
RDEPENDS_${PN}-dbg = "libgpiod wpa-supplicant"
....
& in the configure.ac I have:
PKG_CHECK_MODULES(LIBGPIOD, [libgpiod >= 1.0], [], [
AC_MSG_ERROR(libgpiod not found. This is required.)
])
# note libwpa_client has no version number, just libwpa_client.so
PKG_CHECK_MODULES(LIBWPA_CLIENT, [libwpa_client], [], [
AC_MSG_ERROR(libwpa_client not found. This is required.)
])
Using this produces the output:
Wno-long-long -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi
| checking if libc contains libintl... yes
| checking libintl.h usability... yes
| checking libintl.h presence... yes
| checking for libintl.h... yes
| checking for libegt >= 1.3... yes
| checking for libgpiod >= 1.0... yes
| checking for libwpa_client... no
| configure: error: libwpa_client not found. This is required.
| NOTE: The following config.log files may provide further information.
My application builds fine if I manually specify lwpa_client in Makefile.am as follows:
CUSTOM_LDADD = $(LIBEGT_LIBS) $(top_builddir)/external/libsqlite3.la $(LIBGPIOD_LIBS) $(LIBWPA_CLIENT_LIBS) -lwpa_client
But my questions is how should I properly do this?
Many thanks,

MAKE fails to find ft2build.h (freetype2 header) -freetype(2.8.1) is installed properly

I am Trying to compile 'xplanet' R224 (latest version) on Ubuntu 18.04
MAKE fails to find ft2build.h (freetype2 header) I have 'freetype'(2.8.1) installed properly and all the files are there. I have searched stackoverflow and found many people with the same problem (ft2build.h not found) yet no consensus on why or what the solution is.
Any help is appreciated.
MAKE ERROR MESSAGE:
In file included from getTextRenderer.cpp:8:0:
TextRendererFT2.h:4:10: fatal error: ft2build.h: No such file or directory
#include <ft2build.h>
compilation terminated.
Makefile:458: recipe for target 'getTextRenderer.o' failed
make[3]: *** [getTextRenderer.o] Error 1
MY INSTALLED FREETYPE FILES:
ls /usr/include/freetype2/freetype/config
ftconfig.h ftheader.h ftmodule.h ftoption.h ftstdlib.h
ls /usr/include/freetype2/freetype
config ftautoh.h ftbzip2.h ftcid.h ftgasp.h ftimage.h ftlzw.h ftmoderr.h ftpfr.h ftstroke.h ftttdrv.h ttnameid.h
freetype.h ftbbox.h ftcache.h fterrdef.h ftglyph.h ftincrem.h ftmac.h ftotval.h ftrender.h ftsynth.h fttypes.h tttables.h
ft2build.h ftbdf.h ftcffdrv.h fterrors.h ftgxval.h ftlcdfil.h ftmm.h ftoutln.h ftsizes.h ftsystem.h ftwinfnt.h tttags.h
ftadvanc.h ftbitmap.h ftchapters.h ftfntfmt.h ftgzip.h ftlist.h ftmodapi.h ftpcfdrv.h ftsnames.h fttrigon.h t1tables.h ttunpat.h
ls /usr/include/freetype2
freetype ft2build.h
MAKEFILE INCLUDES THESE LINES:
FREETYPE2_CFLAGS = -I/usr/include/freetype2 -I/usr/include/libpng16
FREETYPE2_LIBS = -lfreetype
FREETYPE_CFLAGS =
FREETYPE_LIBS =
They have there a mix of FREETYPE and FREETYPE2 variables for some reason. I managed to make it compile with those changes:
In src/libdisplay/Makefile.am:
--- src/libdisplay/Makefile.am.old 2022-02-27 22:21:56.089575296 +0100
+++ src/libdisplay/Makefile.am 2022-02-27 22:22:13.424197851 +0100
## -26,7 +26,7 ##
EXTRA_libdisplay_a_SOURCES = DisplayMacAqua.cpp DisplayMacAqua.h DisplayMSWin.cpp DisplayMSWin.h TextRendererFT2.cpp TextRendererFT2.h TextRendererPangoFT2.cpp TextRendererPangoFT2.h DisplayX11.cpp DisplayX11.h vroot.h TimerMacAqua.cpp TimerMacAqua.h TimerX11.cpp TimerX11.h
-AM_CPPFLAGS = -I#top_srcdir#/src #X_CFLAGS# #FREETYPE_CFLAGS#
+AM_CPPFLAGS = -I#top_srcdir#/src #X_CFLAGS# #FREETYPE2_CFLAGS#
if USE_AR
libdisplay_a_AR = $(AR) cru
In src/Makefile.am:
--- src/Makefile.am.old 2022-02-27 22:22:02.953029931 +0100
+++ src/Makefile.am 2022-02-27 22:22:31.438766211 +0100
## -8,7 +8,7 ##
parsegeom = ParseGeom.c ParseGeom.h
endif
-AM_CPPFLAGS = -DDATADIR=\"$(datadir)#separator#xplanet\" #X_CFLAGS# #FREETYPE_CFLAGS#
+AM_CPPFLAGS = -DDATADIR=\"$(datadir)#separator#xplanet\" #X_CFLAGS# #FREETYPE2_CFLAGS#
AM_LDFLAGS = #xplanet_LDFLAGS#
xplanet_SOURCES = \
## -72,5 +72,5 ##
libprojection/libprojection.a \
libsgp4sdp4/libsgp4sdp4.a \
#GRAPHICS_LIBS# #CSPICE_LIBS# #X_LIBS# \
- #XSS_LIBS# #FREETYPE_LIBS# #AQUA_LIBS# \
+ #XSS_LIBS# #FREETYPE2_LIBS# #AQUA_LIBS# \
#LIBICONV# #LIBCHARSET#
The solution above was completely successful. FREETYPE2 was misspelled in three places as FREETYPE in "src/Makefile.am" Installation had no further problems
Molly
Feb 27 at 22:50

undefined reference to dss_ functions

I am new to fortran and cmake, so I'm sure there is a simple fix I am missing!
error message:
100%] Linking Fortran executable dynamicmpm
CMakeFiles/dynamicmpm.dir/Solver.FOR.o: In function `modsolver_mp_createprofiledss_':
Solver.FOR:(.text+0x1143): undefined reference to `dss_create_'
Solver.FOR:(.text+0x11a8): undefined reference to `dss_define_structure_'
Solver.FOR:(.text+0x1471): undefined reference to `dss_reorder_'
CMakeFiles/dynamicmpm.dir/Solver.FOR.o: In function `modsolver_mp_solveequations_':
Solver.FOR:(.text+0x35ec): undefined reference to `dss_factor_real_d__'
Solver.FOR:(.text+0x361d): undefined reference to `dss_solve_real_d_'
CMakeFiles/dynamicmpm.dir/Solver.FOR.o: In function `modsolver_mp_destroyequations_':
Solver.FOR:(.text+0x4495): undefined reference to `dss_delete_'
CMakeFiles/dynamicmpm.dir/Solver.FOR.o: In function `modsolver_mp_initialisereducedsolution_':
Solver.FOR:(.text+0x5a58): undefined reference to `dss_create_'
Solver.FOR:(.text+0x5abd): undefined reference to `dss_define_structure_'
Solver.FOR:(.text+0x606d): undefined reference to `dss_reorder_'
I included use mkl_dss at the top of the Solver.FOR file
inside the cmakefile:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(MPM)
enable_language (Fortran)
set(CMAKE_Fortran_COMPILER_ID "GNU")
add_compile_options(-nologo -O2 -ldl -assume buffered_io -fpp -Dinternal_release
-reentrancy threaded -free -warn all -real_size 64 -Qauto -fp:strict
-fp:constant -libs:static -threads -Qmkl:sequential -Qm64
-fmax-identifier-length=63 -ffree-form -ffree-line-length-none -fdefault-real-8)
set(SRCS MOHRStrainSoftening.FOR getversion.for GlobalConstants.FOR mkl_dss.f90 String.for
Feedback.for FileIO.for MatrixMath.FOR timing.for ISORT.FOR GeoMath.FOR Counters.FOR
ElemCalcTETRA.FOR ReadCalculationData.FOR ElemCalcQUAD.FOR InitialiseKernel.FOR
ElemCalcTRI.FOR ReadMaterialData.FOR ElemCalc.FOR Particle.FOR MeshInfo.FOR
ElemConnections.FOR RotBoundCond.FOR ReadGeometryData.FOR InitialiseElementType.for
Solver.FOR MPMData.FOR WriteMPMData.FOR WriteVTKASCII.FOR TwoLayerFormulation.FOR
MPMDYNUnsatConsolidation.FOR WriteVTKBinary.FOR MPMStrainSmoothing.FOR WriteVTKOutput.FOR
MPMDYNConsolidation.FOR MPMStresses.FOR MPMDynContact.FOR MPMDynViscousBoundary.FOR
WriteTestData.FOR Liquid.FOR WriteVTK2Layer.FOR ReadMPMData.FOR RigidBody.f WriteNodalData.FOR
MPMMeshAdjustment.FOR MPMEmptyElements.FOR WriteResultData.FOR MPMConvPhase.FOR
ErrorHandler.for AdjustParticleDiscretisation.FOR MPMExcavation.FOR MPMInit.FOR MPMDYNBTSig.FOR
LagrangianPhase.FOR MPMDYNStresses.FOR MPMDYNConvPhase.FOR MPMQuasiStaticImplicit.FOR
MPMDynamicExplicit.FOR Kernel.for GetStrain.FOR Anura3D.for FORMDE.FOR BuildLoad.FOR
BuildDElastic.FOR MOHR.FOR BuildBJacDet.FOR PRNSTR.FOR GetPrinStress.FOR)
add_executable(dynamicmpm ${SRCS})
I'm sure I am just not linking it properly but I can't seem to find the mistake. I include mkl_dss.f90 in SRCS and have the appropriate use statement in SOLVER.FOR
I am including a link to my previous SO post in case that might be useful:
Executable file does not exist after compiling Fortran code

Fatel Error Android NDK adding Eigen/Dense

I'm using this library for attendance monitoring app. https://github.com/Lauszus/FaceRecognitionApp
I extracted SDKs to OpenCV-android-sdk & Eigen3
I'm using following commands to set environment variables:
setx OPENCV_ANDROID_SDK C:/Users/...(my path)../OpenCV-android-sdk/sdk
setx EIGEN3_DIR /path/to/eigen3 C:/Users/...(my path).../Eigen3
echo %C:/Users/...(my path)../OpenCV-android-sdk/sdk% %C:/Users/...(my path).../eigen-eigen-67e894c6cd8f%
My Android.mk fie:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_INSTALL_MODULES := on
include $(OPENCV_ANDROID_SDK)C:/Users/Amey/AndroidStudioProjects/DevAttendance/FaceRecognitionApp/app/src/main/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk
LOCAL_MODULE := face-lib
LOCAL_SRC_FILES += $(LOCAL_PATH)/face-lib.cpp $(LOCAL_PATH)/FaceRecognitionLib/Facebase.cpp
LOCAL_SRC_FILES += $(LOCAL_PATH)/FaceRecognitionLib/Eigenfaces.cpp $(LOCAL_PATH)/FaceRecognitionLib/Fisherfaces.cpp
LOCAL_SRC_FILES += $(LOCAL_PATH)/FaceRecognitionLib/PCA.cpp $(LOCAL_PATH)/FaceRecognitionLib/LDA.cpp
LOCAL_C_INCLUDES += $(EIGEN3_DIR) $(LOCAL_PATH)/FaceRecognitionLib/RedSVD/include
LOCAL_LDLIBS += -llog -ldl
LOCAL_CPPFLAGS += -std=gnu++11 -frtti -fexceptions
include $(BUILD_SHARED_LIBRARY)
I'm getting following error:
Information:Gradle tasks [:app:assembleDebug]
C:\Users\Amey\AndroidStudioProjects\DevAttendance\FaceRecognitionApp\app\src\main\cpp\face-lib.cpp
Error:(20, 10) fatal error: 'Eigen/Dense' file not found
Information:BUILD FAILED
Information:Total time: 2.354 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

how solve this error: g++ :error: unrecognized argument in option '-mtune=cortex-a15.cortex-a7'

I decide to Compilie Qt5.8 on XU4 by this guide :
http://freecode.hu/sbcomp/2016/08/15/compiling-qt-5-8-on-odroid-xu4/
but in step 4 , i get this error:
make:warning:file '/usr/include/string.h' has modification time 1e+07 s in the future
g++-4.8.real:error:unrecognized argument in option '-mtune=cortex-a15.cortex-a7'
g++-4.8.real:note:valid argumentd to '-mtune=' are: arm1020e ....
please help me to solve this error,
Thanks for all.
after one hour,i solved my problem by editing qmake.config file:
changing this line which that tutorial said:
QMAKE_CFLAGS += -mcpu=cortex-a15 -mfpu=neon-vfpv4 -mtune=cortex-a15.cortex-a7 -mfloat-abi=hard
to this :
QMAKE_CFLAGS += -mcpu=cortex-a15 -mfpu=neon-vfpv4 -mtune=cortex-a15 -mtune=cortex-a7 -mfloat-abi=hard

Resources