Help needed for Linker error while building cryptopp for android (armeabi-v7a)

254 views
Skip to first unread message

Ninad Deshmukh

unread,
Feb 4, 2021, 2:27:38 PM2/4/21
to Crypto++ Users
Hi
I am new to Crypto++ 
I was trying to build Crypto++ for android using documentation here: https://github.com/noloader/cryptopp-android

Note: Build succeeded for arm64-v8a and linker fails for armeabi-v7a
I am not able to resolve following linker errors:


ld: error: undefined symbol: CryptoPP::CPU_ProbeARMv7()
>>> referenced by cpu.cpp:1014 (./../cryptopp\cpu.cpp:1014)
>>>               cpu.o:(CryptoPP::DetectArmFeatures()) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::CPU_ProbeNEON()
>>> referenced by cpu.cpp:1015 (./../cryptopp\cpu.cpp:1015)
>>>               cpu.o:(CryptoPP::DetectArmFeatures()) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::CPU_ProbeCRC32()
>>> referenced by cpu.cpp:1016 (./../cryptopp\cpu.cpp:1016)
>>>               cpu.o:(CryptoPP::DetectArmFeatures()) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::CPU_ProbePMULL()
>>> referenced by cpu.cpp:1017 (./../cryptopp\cpu.cpp:1017)
>>>               cpu.o:(CryptoPP::DetectArmFeatures()) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::CPU_ProbeAES()
>>> referenced by cpu.cpp:1018 (./../cryptopp\cpu.cpp:1018)
>>>               cpu.o:(CryptoPP::DetectArmFeatures()) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::CPU_ProbeSHA1()
>>> referenced by cpu.cpp:1019 (./../cryptopp\cpu.cpp:1019)
>>>               cpu.o:(CryptoPP::DetectArmFeatures()) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::CPU_ProbeSHA256()
>>> referenced by cpu.cpp:1020 (./../cryptopp\cpu.cpp:1020)
>>>               cpu.o:(CryptoPP::DetectArmFeatures()) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::ARIA_UncheckedSetKey_Schedule_NEON(unsigned char*, unsigned int*, unsigned int)
>>> referenced by aria.cpp:182 (./../cryptopp\aria.cpp:182)
>>>               aria.o:(CryptoPP::ARIA::Base::UncheckedSetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::ARIA_ProcessAndXorBlock_NEON(unsigned char const*, unsigned char*, unsigned char const*, unsigned int*)
>>> referenced by aria.cpp:293 (./../cryptopp\aria.cpp:293)
>>>               aria.o:(CryptoPP::ARIA::Base::ProcessAndXorBlock(unsigned char const*, unsigned char const*, unsigned char*) const) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::BLAKE2_Compress32_NEON(unsigned char const*, CryptoPP::BLAKE2s_State&)
>>> referenced by blake2.cpp:686 (./../cryptopp\blake2.cpp:686)
>>>               blake2.o:(CryptoPP::BLAKE2s::Compress(unsigned char const*)) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::BLAKE2_Compress64_NEON(unsigned char const*, CryptoPP::BLAKE2b_State&)
>>> referenced by blake2.cpp:709 (./../cryptopp\blake2.cpp:709)
>>>               blake2.o:(CryptoPP::BLAKE2b::Compress(unsigned char const*)) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::ChaCha_OperateKeystream_NEON(unsigned int const*, unsigned char const*, unsigned char*, unsigned int)
>>> referenced by chacha.cpp:142 (./../cryptopp\chacha.cpp:142)
>>>               chacha.o:((anonymous namespace)::ChaCha_OperateKeystream(CryptoPP::KeystreamOperation, unsigned int*, unsigned int&, unsigned int&, unsigned int, unsigned char*, unsigned char const*, unsigned int)) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::GCM_Xor16_NEON(unsigned char*, unsigned char const*, unsigned char const*)
>>> referenced by gcm.cpp:214 (./../cryptopp\gcm.cpp:214)
>>>               gcm.o:(CryptoPP::GCM_Base::SetKeyWithoutResync(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a
>>> referenced by gcm.cpp:276 (./../cryptopp\gcm.cpp:276)
>>>               gcm.o:(CryptoPP::GCM_Base::SetKeyWithoutResync(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a
>>> referenced by gcm.cpp:277 (./../cryptopp\gcm.cpp:277)
>>>               gcm.o:(CryptoPP::GCM_Base::SetKeyWithoutResync(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::LEA_Enc_AdvancedProcessBlocks_NEON(unsigned int const*, unsigned int, unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int)
>>> referenced by lea.cpp:875 (./../cryptopp\lea.cpp:875)
>>>               lea.o:(CryptoPP::LEA::Enc::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::LEA_Dec_AdvancedProcessBlocks_NEON(unsigned int const*, unsigned int, unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int)
>>> referenced by lea.cpp:892 (./../cryptopp\lea.cpp:892)
>>>               lea.o:(CryptoPP::LEA::Dec::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::SIMON128_Enc_AdvancedProcessBlocks_NEON(unsigned long long const*, unsigned int, unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int)
>>> referenced by simon.cpp:472 (./../cryptopp\simon.cpp:472)
>>>               simon.o:(CryptoPP::SIMON128::Enc::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::SIMON128_Dec_AdvancedProcessBlocks_NEON(unsigned long long const*, unsigned int, unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int)
>>> referenced by simon.cpp:493 (./../cryptopp\simon.cpp:493)
>>>               simon.o:(CryptoPP::SIMON128::Dec::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::SPECK128_Enc_AdvancedProcessBlocks_NEON(unsigned long long const*, unsigned int, unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int)
>>> referenced by speck.cpp:454 (./../cryptopp\speck.cpp:454)
>>>               speck.o:(CryptoPP::SPECK128::Enc::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

ld: error: undefined symbol: CryptoPP::SPECK128_Dec_AdvancedProcessBlocks_NEON(unsigned long long const*, unsigned int, unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int)
>>> referenced by speck.cpp:475 (./../cryptopp\speck.cpp:475)
>>>               speck.o:(CryptoPP::SPECK128::Dec::AdvancedProcessBlocks(unsigned char const*, unsigned char const*, unsigned char*, unsigned int, unsigned int) const) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [C:/Users/XXXXXX/AppData/Local/Android/Sdk/ndk/22.0.6917172/build//../build/core/build-binary.mk:741: obj/local/armeabi-v7a/cryptest.exe] Error 1

Any hint, suggestions please?

Regards
Ninad D

Ninad Deshmukh

unread,
Feb 4, 2021, 2:41:07 PM2/4/21
to Crypto++ Users
Hi All,

I see for most of the errors below function definitions are already available in code files.
But its no compiled because of #ifdef , not sure how to fix this..

Regards
Ninad D

Jeffrey Walton

unread,
Feb 4, 2021, 3:33:57 PM2/4/21
to Crypto++ Users List
On Thu, Feb 4, 2021 at 2:27 PM Ninad Deshmukh <nin...@gmail.com> wrote:
>
> Hi
> I am new to Crypto++
> I was trying to build Crypto++ for android using documentation here: https://github.com/noloader/cryptopp-android
>
> Note: Build succeeded for arm64-v8a and linker fails for armeabi-v7a
> I am not able to resolve following linker errors:
>
>
> ld: error: undefined symbol: CryptoPP::CPU_ProbeARMv7()
> >>> referenced by cpu.cpp:1014 (./../cryptopp\cpu.cpp:1014)
> >>> cpu.o:(CryptoPP::DetectArmFeatures()) in archive ./obj/local/armeabi-v7a/libcryptopp_static.a

I believe there are better instructions for using Android.mk at
https://www.cryptopp.com/wiki/Android.mk.

Jeff

Ninad Deshmukh

unread,
Feb 5, 2021, 5:26:49 AM2/5/21
to Crypto++ Users
Hi

Thanks Jeff for reply!
I went through https://www.cryptopp.com/wiki/Android.mk, it mentions to use cryptopp-android (I am using this as mentioned above)

Undefined symbols -functions (linker issues) reported by compiler are already available in source files but guarded with #ifdefs
Note: I am using Crypto++ Master and cryptopp-android Master as mentioned in documentation without any change.

I am able to create a build for arm64-v8a but, while building for armeabi-v7a, it gives linker issues

Any idea?

Regards
Ninad D

Jeffrey Walton

unread,
Feb 5, 2021, 5:29:45 AM2/5/21
to Crypto++ Users List
On Fri, Feb 5, 2021 at 5:26 AM Ninad Deshmukh <nin...@gmail.com> wrote:
>
> Thanks Jeff for reply!
> I went through https://www.cryptopp.com/wiki/Android.mk, it mentions to use cryptopp-android (I am using this as mentioned above)
>
> Undefined symbols -functions (linker issues) reported by compiler are already available in source files but guarded with #ifdefs
> Note: I am using Crypto++ Master and cryptopp-android Master as mentioned in documentation without any change.
>
> I am able to create a build for arm64-v8a but, while building for armeabi-v7a, it gives linker issues
>
> Any idea?

Did you run make_neon.sh per
https://www.cryptopp.com/wiki/Android.mk#make_neon.sh?

Jeff

Ninad Deshmukh

unread,
Feb 5, 2021, 8:12:47 AM2/5/21
to Crypto++ Users
Thank you very much Jeff.
it built properly without errors.

make_neon.sh, I somehow missed that one.
it clearly mentions in documentation.

Jeffrey Walton

unread,
Feb 5, 2021, 10:25:20 AM2/5/21
to Crypto++ Users List
On Fri, Feb 5, 2021 at 8:12 AM Ninad Deshmukh <nin...@gmail.com> wrote:
>
> Thank you very much Jeff.
> it built properly without errors.
>
> make_neon.sh, I somehow missed that one.
> it clearly mentions in documentation.

I added the make_neon.sh section last night. The script was already
included on the page, but the page never gave you a prescriptive
recipe for what to do with it.

Jeff

Jeffrey Walton

unread,
Feb 6, 2021, 2:50:58 PM2/6/21
to Crypto++ Users
I added a new section that builds a test shared object at https://www.cryptopp.com/wiki/Android.mk#test_shared.so. It may be helpful to you.


Jeff
Reply all
Reply to author
Forward
0 new messages