Not able to compile openssl for android - android

I am trying to compile openssl for android and facing some issues. I am following the steps given in this link.
I am using NDK version r20 and OpenSSL 1.1.1c and on a linux machine.
I am facing two issues:
(1) I am able to compile libs for “android-arm” architecture but getting the below errors while compiling sample application.
./libcrypto.so: error: undefined reference to ‘sigdelset’
./libcrypto.so: error: undefined reference to ‘sigfillset’
./libcrypto.so: error: undefined reference to ‘tcgetattr’
./libcrypto.so: error: undefined reference to ‘tcsetattr’
apps/ocsp.o:ocsp.c:function ocsp_main: error: undefined reference to ‘signal’
apps/ocsp.o:ocsp.c:function ocsp_main: error: undefined reference to ‘signal’
apps/ocsp.o:ocsp.c:function ocsp_main: error: undefined reference to ‘signal’
apps/ocsp.o:ocsp.c:function ocsp_main: error: undefined reference to ‘signal’
apps/ocsp.o:ocsp.c:function process_responder: error: undefined reference to ‘__FD_SET_chk’
apps/ocsp.o:ocsp.c:function process_responder: error: undefined reference to ‘__FD_SET_chk’
apps/s_client.o:s_client.c:function s_client_main: error: undefined reference to ‘__FD_SET_chk’
apps/s_client.o:s_client.c:function s_client_main: error: undefined reference to ‘__FD_SET_chk’
apps/s_client.o:s_client.c:function s_client_main: error: undefined reference to ‘__FD_ISSET_chk’
apps/s_client.o:s_client.c:function s_client_main: error: undefined reference to ‘__FD_ISSET_chk’
apps/s_client.o:s_client.c:function s_client_main: error: undefined reference to ‘__FD_ISSET_chk’
apps/s_client.o:s_client.c:function s_client_main: error: undefined reference to ‘__FD_ISSET_chk’
apps/speed.o:speed.c:function speed_main: error: undefined reference to ‘atof’
apps/speed.o:speed.c:function speed_main: error: undefined reference to ‘atof’
apps/speed.o:speed.c:function speed_main: error: undefined reference to ‘atof’
apps/speed.o:speed.c:function speed_main: error: undefined reference to ‘atof’
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(2) I am not able to compile for any other architecture. If I change architecture to “android-arm64” (or any other), I am getting the below errors while compiling library.
crypto/aes/aesv8-armx.S:5:1: error: Unknown arch name
.arch armv8-a+crypto
^
crypto/aes/aesv8-armx.S:17:2: error: invalid instruction, did you mean: stc, stm, str, swp, tst?
stp x29,x30,[sp,#-16]!
^
crypto/aes/aesv8-armx.S:18:6: error: operand must be a register in range [r0, r15]
add x29,sp,#0
^
crypto/aes/aesv8-armx.S:19:6: error: operand must be a register in range [r0, r12] or r14
mov x3,#-1
^
I am changing the architecture by changing the “architecture=android-arm” in the “file-launcher-sh”. Do I need to modify any other variables/macros?

You built openssl for a newer API level than your app, so the library is not compatible with your app. Here's how I build openssl with r20:
$ export ANDROID_NDK=/path/to/ndk
$ export PATH=$ANDROID_NDK/toolchains/llvm/prebuilt/$HOST/bin:$PATH
$ path/to/openssl/Configure android-$ARCH -D__ANDROID_API__=$MINSDKVERSION --prefix=$INSTALLPATH --openssldir=$INSTALLPATH shared
$ make SHLIB_EXT=.so install_sw

I just had to open new putty for each new architecture.
I think somehow few of the configurations/variables exported for one architecture are not getting updated when I re-run the script with new architecture.

Add the compiler flag "no-asm" to ./Configure
./Configure no-asm no-shared android-$ARCH -D__ANDROID_API__=$MINSDKVERSION --prefix=$INSTALLPATH --openssldir=$INSTALLPATH shared

Related

NCurses 6.0 Compilation Error Using Android-NDK

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.

Undefined reference to isfinite

I had following error when done cross compilation for android.
Cross compiler used SDK/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi'
./libgpsd.a(libgpsd_core.o):libgpsd_core.c:function gpsd_poll: error: undefined reference to '__isfinite'
./libgpsd.a(libgpsd_core.o):libgpsd_core.c:function gpsd_poll: error: undefined reference to '__isfinite'
./libgpsd.a(libgpsd_core.o):libgpsd_core.c:function gpsd_poll: error: undefined reference to '__isfinite'
./libgpsd.a(libgpsd_core.o):libgpsd_core.c:function gpsd_poll: error: undefined reference to '__isfinite'
The function infinite() is part of C99. Add LOCAL_CFLAGS += -std=c99 to your Android.mk. See question How to set standard c99 for compile android NDK project

android kernel for ascend mate with linker error

I made a port from a kernel from 4.1 to 4.4, but I get this errors, I know that this error is by the linker, but I have no idea about where find the error because these files are already compiled, sorry for my bad english, this is the comand and the result in the terminal, thanks in advance:
richy#richy-Aspire-V5-572P:~/Lollipop/kernel/mt_4.4$ make -k ARCH=arm zImage
CHK include/linux/version.h
CHK include/generated/utsrelease.h
make[1]: 'include/generated/mach-types.h' is up to date.
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
drivers/built-in.o:felica_gpio.c:function felica_remove: warning: relocation refers to discarded section
drivers/built-in.o:felica_gpio.c:function felica_remove: warning: relocation refers to discarded section
arch/arm/mach-k3v2/built-in.o:iomux.c:function get_active_block_table.part.0: error: undefined reference to 'g_current_board_id'
arch/arm/mach-k3v2/built-in.o:k3v2_clocks_init_data_cs_60M.c:function iomux_debug_show: error: undefined reference to 'g_current_board_id'
arch/arm/mach-k3v2/built-in.o:k3v2_clocks_init_data_cs_60M.c:function iomux_debug_set: error: undefined reference to 'g_current_board_id'
arch/arm/mach-k3v2/built-in.o:k3v2_clocks_init_data_cs_60M.c:function pmulowpower: error: undefined reference to 'get_battery_removable'
arch/arm/mach-k3v2/built-in.o:k3v2_clocks_init_data_cs_60M.c:function pmulowpower: error: undefined reference to 'get_battery_removable'
arch/arm/mach-k3v2/built-in.o:k3v2_clocks_init_data_cs_60M.c:function pmulowpowerall: error: undefined reference to 'get_battery_removable'
arch/arm/mach-k3v2/built-in.o:k3v2_clocks_init_data_cs_60M.c:function pmulowpowerall: error: undefined reference to 'get_battery_removable'
arch/arm/mach-k3v2/built-in.o:board-k3v2oem1.c:wl18xx_device: error: undefined reference to 'wilink_pdata'
drivers/built-in.o:mipi_jdi_OTM1282B.c:function mipi_jdi_panel_off: error: undefined reference to 'rmi_f01_glove_switch_read'
drivers/built-in.o:mipi_jdi_OTM1282B.c:function mipi_jdi_panel_off: error: undefined reference to 'rmi_fc'
drivers/built-in.o:es305.c:function es305_set_pathid: error: undefined reference to 'is_smartpa_support'
drivers/built-in.o:synaptics_SO340010.c:function synaptics_thread_irq_handler: error: undefined reference to 'time_finger_up'
drivers/built-in.o:synaptics_SO340010.c:function synaptics_thread_irq_handler: error: undefined reference to 'touch_is_pressed'
drivers/built-in.o:felica_gpio.c:function felica_remove: warning: relocation refers to discarded section
drivers/built-in.o:modemctl.c:function modemctl_init: error: undefined reference to 'is_modem_switch_support'
drivers/built-in.o:mipi_jdi_OTM1282B.c:function jdi_probe: error: undefined reference to 'get_touchkey_enable'
drivers/built-in.o:hi6421-regulator.c:function hi6421_regulator_probe: error: undefined reference to 'get_pmu_out26m_enable'
drivers/built-in.o:synaptics_SO340010.c:function touchkey_probe: error: undefined reference to 'get_touchkey_enable'
Makefile:907: recipe for target '.tmp_vmlinux1' failed
make: *** [.tmp_vmlinux1] Error 1
make: Target 'zImage' not remade because of errors.
I read somewhere about this and I fix it, just I've added the definition of these variables or functions, cause the "extern"s don't works for itselfs, i.e.
for the line:
arch/arm/mach-k3v2/built-in.o:iomux.c:function get_active_block_table.part.0: error: undefined reference to 'g_current_board_id'
just is add to the file iomux.c the global
"type" g_current_board_id;
or in the case of functions:
"type" functionname(type args) {}
and that is all

Undefined reference error when using .a static library in Qt creator for android

I'm new to Qt and now I'm using Qt creator to develop android application in Win7 OS.
The problem is when I try to call function in the .a library provided by an external company, there are undefined reference errors.
I've already told him my ndk revision and android cpu architecture, and then he re-compiled and gave me this .a file.
My Qt version is Qt 5.3.2 for Android, and the ndk is r10d.
The error message:
D:/android/tools/android-ndk-r10/sources/cxx-stl/stlport/stlport/stl/_alloc.h:158: error: undefined reference to 'std::__node_alloc::_M_allocate(unsigned int&)'
D:/android/tools/android-ndk-r10/sources/cxx-stl/stlport/stlport/stl/_alloc.h:161: error: undefined reference to 'std::__node_alloc::_M_deallocate(void*, unsigned int)'
Makefile:79: recipe for target 'libuntitled.so' failed
D:/android/tools/android-ndk-r10/sources/cxx-stl/stlport/stlport/stl/_vector.h:41: error: undefined reference to 'std::__stl_throw_length_error(char const*)'
D:/android/tools/android-ndk-r10/sources/cxx-stl/stlport/stlport/stl/_vector.h:41: error: undefined reference to 'std::__stl_throw_length_error(char const*)'
D:/android/tools/android-ndk-r10/sources/cxx-stl/stlport/stlport/stl/_vector.h:41: error: undefined reference to 'std::__stl_throw_length_error(char const*)'
D:/android/tools/android-ndk-r10/sources/cxx-stl/stlport/stlport/stl/_vector.h:41: error: undefined reference to 'std::__stl_throw_length_error(char const*)'
collect2.exe: eooro: ld returned 1 exit status
The strange thing is that my ndk wasn't even installed in this directory!
Can any figure out why the errors occured?

Apportable Errors With iOS app conversion

I am running the command "apportable load" in the directory of my x-code project for an app that is working on the iOS simulator. I have x-code 5.0.2 and when I try to update apportable it says it is the newest version.
I am sorry for the extent of the error output as it may be difficult to read. I notice some errors that are picking out the sound effects and that they cannot be referenced.
Why are the references to settings such as CCScreenModeFixed not identified when they come directly from the spritebuilder interface? Does apportable support sound effects, if so why can't it find mine?
/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/AppDelegate.m:58: error: undefined
reference to 'CCSetupScreenMode'
/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/AppDelegate.m:58: error: undefined
reference to 'CCScreenModeFixed'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(AppDelegate.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/AppDelegate.m:function
L_OBJC_CLASSLIST_REFERENCES_$_22: error: undefined reference to
'OBJC_CLASS_$_CCBReader'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(AppDelegate.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/AppDelegate.m:function
OBJC_METACLASS_$_AppController: error: undefined reference to
'OBJC_METACLASS_$_CCAppDelegate'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(AppDelegate.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/AppDelegate.m:function
OBJC_CLASS_$_AppController: error: undefined reference to
'OBJC_CLASS_$_CCAppDelegate' /Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Gameplay.m:186: error: undefined
reference to 'clampf'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Gameplay.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Gameplay.m:function
L_OBJC_CLASSLIST_REFERENCES_$_: error: undefined reference to
'OBJC_CLASS_$_OALSimpleAudio'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Gameplay.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Gameplay.m:function
L_OBJC_CLASSLIST_REFERENCES_$_73: error: undefined reference to
'OBJC_CLASS_$_CCBReader'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Gameplay.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Gameplay.m:function
L_OBJC_CLASSLIST_REFERENCES_$_122: error: undefined reference to
'OBJC_CLASS_$_CCDirector'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Gameplay.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Gameplay.m:function
L_OBJC_CLASSLIST_REFERENCES_$_133: error: undefined reference to
'OBJC_CLASS_$_CCActionMoveBy'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Gameplay.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Gameplay.m:function
L_OBJC_CLASSLIST_REFERENCES_$_138: error: undefined reference to
'OBJC_CLASS_$_CCActionSequence'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Gameplay.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Gameplay.m:function
L_OBJC_CLASSLIST_REFERENCES_$_141: error: undefined reference to
'OBJC_CLASS_$_CCActionEaseBounce'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Gameplay.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Gameplay.m:function
OBJC_METACLASS_$_Gameplay: error: undefined reference to
'OBJC_METACLASS_$_CCNode'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Gameplay.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Gameplay.m:function
OBJC_CLASS_$_Gameplay: error: undefined reference to
'OBJC_CLASS_$_CCNode'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Goal.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Goal.m:function
OBJC_METACLASS_$_Goal: error: undefined reference to
'OBJC_METACLASS_$_CCNode'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Goal.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Goal.m:function OBJC_CLASS_$_Goal:
error: undefined reference to 'OBJC_CLASS_$_CCNode'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Hiss.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Hiss.m:function
OBJC_METACLASS_$_Hiss: error: undefined reference to
'OBJC_METACLASS_$_CCNode'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(Hiss.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/Hiss.m:function OBJC_CLASS_$_Hiss:
error: undefined reference to 'OBJC_CLASS_$_CCNode'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(MainScene.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/MainScene.m:function
L_OBJC_CLASSLIST_REFERENCES_$_: error: undefined reference to
'OBJC_CLASS_$_CCBReader'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(MainScene.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/MainScene.m:function
L_OBJC_CLASSLIST_REFERENCES_$_1: error: undefined reference to
'OBJC_CLASS_$_CCDirector'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(MainScene.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/MainScene.m:function
L_OBJC_CLASSLIST_REFERENCES_$_6: error: undefined reference to
'OBJC_CLASS_$_OALSimpleAudio'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(MainScene.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/MainScene.m:function
OBJC_METACLASS_$_MainScene: error: undefined reference to
'OBJC_METACLASS_$_CCNode'
/Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/com.apportable.Eltie/Eltie/libEltie.a(MainScene.m.o):/Users/mateusz/Documents/SpriteBuilder
Games/Eltie.spritebuilder/Source/MainScene.m:function
OBJC_CLASS_$_MainScene: error: undefined reference to
'OBJC_CLASS_$_CCNode' ninja: build stopped: subcommand failed. Error:
command failed:
/Users/mateusz/.apportable/SDK/toolchain/macosx/ninja/ninja
--no-strip-ansi-escapes -j 8 /Users/mateusz/.apportable/SDK/Build/android-armeabi-debug/Eltie/Eltie-debug.apk
Okay, I figured it out with the help of the answer from this question: static libs with apportable
I did not have the cocos2d library added in the target dependencies section of the build phases tab in x-code. When I added it apportable had no issues finding the undefined types given from spritebuilder and cocos2d.

Categories

Resources