[strongSwan] undefined reference to vstr functions while building strongswan for Android

Indhu BC indhubc at gmail.com
Tue Jul 9 00:42:00 CEST 2013


Hi,

I'm trying to build strongswan for Android following
http://wiki.strongswan.org/projects/strongswan/wiki/AndroidVPNClient. I'm
not able to build libstrongswan.so because the linker is not able to find
vstr* definitions used inside printf_hook.c. Here is the error message:

/home/indu/adt/adt-bundle-linux-x86_64-20130522/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
./obj/local/armeabi/objs/strongswan/utils/printf_hook.o: in function
vstr_fmt_add_handler:jni/strongswan/src/libstrongswan/utils/printf_hook.c:185:
error: undefined reference to 'vstr_fmt_add'

Many more similar symbols (starting with 'vstr') are missing. I have copy
pasted only one error line here.

Using the -n switch of ndk-build, I was able to get the g++ command being
invoked:

/home/indu/adt/adt-bundle-linux-x86_64-20130522/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
-Wl,-soname,libstrongswan.so -shared
--sysroot=/home/indu/adt/adt-bundle-linux-x86_64-20130522/ndk/platforms/android-14/arch-arm
./obj/local/armeabi/objs/strongswan/library.o
./obj/local/armeabi/objs/strongswan/asn1/asn1.o
./obj/local/armeabi/objs/strongswan/asn1/asn1_parser.o
./obj/local/armeabi/objs/strongswan/asn1/oid.o
./obj/local/armeabi/objs/strongswan/bio/bio_reader.o
./obj/local/armeabi/objs/strongswan/bio/bio_writer.o
./obj/local/armeabi/objs/strongswan/collections/blocking_queue.o
./obj/local/armeabi/objs/strongswan/collections/enumerator.o
./obj/local/armeabi/objs/strongswan/collections/hashtable.o
./obj/local/armeabi/objs/strongswan/collections/linked_list.o
./obj/local/armeabi/objs/strongswan/crypto/crypters/crypter.o
./obj/local/armeabi/objs/strongswan/crypto/hashers/hasher.o
./obj/local/armeabi/objs/strongswan/crypto/proposal/proposal_keywords.o
./obj/local/armeabi/objs/strongswan/crypto/proposal/proposal_keywords_static.o
./obj/local/armeabi/objs/strongswan/crypto/prfs/prf.o
./obj/local/armeabi/objs/strongswan/crypto/prfs/mac_prf.o
./obj/local/armeabi/objs/strongswan/crypto/pkcs5.o
./obj/local/armeabi/objs/strongswan/crypto/rngs/rng.o
./obj/local/armeabi/objs/strongswan/crypto/prf_plus.o
./obj/local/armeabi/objs/strongswan/crypto/signers/signer.o
./obj/local/armeabi/objs/strongswan/crypto/signers/mac_signer.o
./obj/local/armeabi/objs/strongswan/crypto/crypto_factory.o
./obj/local/armeabi/objs/strongswan/crypto/crypto_tester.o
./obj/local/armeabi/objs/strongswan/crypto/diffie_hellman.o
./obj/local/armeabi/objs/strongswan/crypto/aead.o
./obj/local/armeabi/objs/strongswan/crypto/transform.o
./obj/local/armeabi/objs/strongswan/credentials/credential_factory.o
./obj/local/armeabi/objs/strongswan/credentials/builder.o
./obj/local/armeabi/objs/strongswan/credentials/cred_encoding.o
./obj/local/armeabi/objs/strongswan/credentials/keys/private_key.o
./obj/local/armeabi/objs/strongswan/credentials/keys/public_key.o
./obj/local/armeabi/objs/strongswan/credentials/keys/shared_key.o
./obj/local/armeabi/objs/strongswan/credentials/certificates/certificate.o
./obj/local/armeabi/objs/strongswan/credentials/certificates/crl.o
./obj/local/armeabi/objs/strongswan/credentials/certificates/ocsp_response.o
./obj/local/armeabi/objs/strongswan/credentials/containers/container.o
./obj/local/armeabi/objs/strongswan/credentials/containers/pkcs12.o
./obj/local/armeabi/objs/strongswan/credentials/ietf_attributes/ietf_attributes.o
./obj/local/armeabi/objs/strongswan/credentials/credential_manager.o
./obj/local/armeabi/objs/strongswan/credentials/sets/auth_cfg_wrapper.o
./obj/local/armeabi/objs/strongswan/credentials/sets/ocsp_response_wrapper.o
./obj/local/armeabi/objs/strongswan/credentials/sets/cert_cache.o
./obj/local/armeabi/objs/strongswan/credentials/sets/mem_cred.o
./obj/local/armeabi/objs/strongswan/credentials/sets/callback_cred.o
./obj/local/armeabi/objs/strongswan/credentials/auth_cfg.o
./obj/local/armeabi/objs/strongswan/database/database.o
./obj/local/armeabi/objs/strongswan/database/database_factory.o
./obj/local/armeabi/objs/strongswan/fetcher/fetcher.o
./obj/local/armeabi/objs/strongswan/fetcher/fetcher_manager.o
./obj/local/armeabi/objs/strongswan/eap/eap.o
./obj/local/armeabi/objs/strongswan/ipsec/ipsec_types.o
./obj/local/armeabi/objs/strongswan/networking/host.o
./obj/local/armeabi/objs/strongswan/networking/host_resolver.o
./obj/local/armeabi/objs/strongswan/networking/packet.o
./obj/local/armeabi/objs/strongswan/networking/tun_device.o
./obj/local/armeabi/objs/strongswan/pen/pen.o
./obj/local/armeabi/objs/strongswan/plugins/plugin_loader.o
./obj/local/armeabi/objs/strongswan/plugins/plugin_feature.o
./obj/local/armeabi/objs/strongswan/processing/jobs/job.o
./obj/local/armeabi/objs/strongswan/processing/jobs/callback_job.o
./obj/local/armeabi/objs/strongswan/processing/processor.o
./obj/local/armeabi/objs/strongswan/processing/scheduler.o
./obj/local/armeabi/objs/strongswan/resolver/resolver_manager.o
./obj/local/armeabi/objs/strongswan/resolver/rr_set.o
./obj/local/armeabi/objs/strongswan/selectors/traffic_selector.o
./obj/local/armeabi/objs/strongswan/threading/thread.o
./obj/local/armeabi/objs/strongswan/threading/thread_value.o
./obj/local/armeabi/objs/strongswan/threading/mutex.o
./obj/local/armeabi/objs/strongswan/threading/semaphore.o
./obj/local/armeabi/objs/strongswan/threading/rwlock.o
./obj/local/armeabi/objs/strongswan/threading/spinlock.o
./obj/local/armeabi/objs/strongswan/utils/utils.o
./obj/local/armeabi/objs/strongswan/utils/chunk.o
./obj/local/armeabi/objs/strongswan/utils/debug.o
./obj/local/armeabi/objs/strongswan/utils/enum.o
./obj/local/armeabi/objs/strongswan/utils/identification.o
./obj/local/armeabi/objs/strongswan/utils/lexparser.o
./obj/local/armeabi/objs/strongswan/utils/optionsfrom.o
./obj/local/armeabi/objs/strongswan/utils/capabilities.o
./obj/local/armeabi/objs/strongswan/utils/backtrace.o
./obj/local/armeabi/objs/strongswan/utils/printf_hook.o
./obj/local/armeabi/objs/strongswan/utils/settings.o
./obj/local/armeabi/objs/strongswan/plugins/fips_prf/fips_prf.o
./obj/local/armeabi/objs/strongswan/plugins/fips_prf/fips_prf_plugin.o
./obj/local/armeabi/objs/strongswan/plugins/hmac/hmac.o
./obj/local/armeabi/objs/strongswan/plugins/hmac/hmac_plugin.o
./obj/local/armeabi/objs/strongswan/plugins/nonce/nonce_nonceg.o
./obj/local/armeabi/objs/strongswan/plugins/nonce/nonce_plugin.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_crl.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_crypter.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_diffie_hellman.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_ec_diffie_hellman.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_ec_private_key.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_ec_public_key.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_gcm.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_hasher.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_hmac.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_pkcs12.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_pkcs7.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_plugin.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_rng.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_rsa_private_key.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_rsa_public_key.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_sha1_prf.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_util.o
./obj/local/armeabi/objs/strongswan/plugins/openssl/openssl_x509.o
./obj/local/armeabi/objs/strongswan/plugins/pem/pem_builder.o
./obj/local/armeabi/objs/strongswan/plugins/pem/pem_encoder.o
./obj/local/armeabi/objs/strongswan/plugins/pem/pem_plugin.o
./obj/local/armeabi/objs/strongswan/plugins/pkcs1/pkcs1_builder.o
./obj/local/armeabi/objs/strongswan/plugins/pkcs1/pkcs1_encoder.o
./obj/local/armeabi/objs/strongswan/plugins/pkcs1/pkcs1_plugin.o
./obj/local/armeabi/objs/strongswan/plugins/pkcs8/pkcs8_builder.o
./obj/local/armeabi/objs/strongswan/plugins/pkcs8/pkcs8_plugin.o
./obj/local/armeabi/objs/strongswan/plugins/pubkey/pubkey_cert.o
./obj/local/armeabi/objs/strongswan/plugins/pubkey/pubkey_plugin.o
./obj/local/armeabi/objs/strongswan/plugins/random/random_plugin.o
./obj/local/armeabi/objs/strongswan/plugins/random/random_rng.o
./obj/local/armeabi/objs/strongswan/plugins/xcbc/xcbc.o
./obj/local/armeabi/objs/strongswan/plugins/xcbc/xcbc_plugin.o
jni/vstr/arm/libvstr.a -lgcc ./obj/local/armeabi/libcrypto.so
-no-canonical-prefixes  -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro
-Wl,-z,now   -lc -lm -o ./obj/local/armeabi/libstrongswan.so

I see that 'jni/vstr/arm/libvstr.a' is indeed getting passed. I did a nm on
the archive file and found out that the symbol is indeed present.

indu at ubuntu:~/git/strongswan/src/frontends/android/jni/vstr/arm$ nm
libvstr.a | grep vstr_fmt_add
0000000000000430 T vstr_fmt_add

I don't understand why linker is not able to find the symbol. I tried to
place the .a file before the .o files in the above command; that didn't
work. Could someone please point out what I'm missing?

Thanks,
Indu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strongswan.org/pipermail/users/attachments/20130708/8dae33bb/attachment.html>


More information about the Users mailing list