[strongSwan] Strongswan 4.6.2 support with Android GB

Kushagra Bhatnagar kbhatnagar at sta.samsung.com
Wed May 9 01:16:32 CEST 2012


Hi Tobias,

Added few more observations after my previous morning reply.
Thanks for the reply. Please find below updates from my side.

>> 1. Build the vstr static library by following the wiki
>>   pages (on strongswan.org).

> You built this with droid-gcc?  Did you use the build script?  Are the 
> static library and the Android.mk for libvstr in place withing the 
> Android source tree?

Yes

>> 3. Change all the libvstr path to the appropriate path where
>>    libvstr.a is present.

> Where did you change this?  Are you referring to the libvstr_PATH 
> variable in the top level Android.mk file?

Yes, basically in the following file /external/strongswan4.6.2/Android.mk

>> 4. Also run following commands in /external/strongswan4.6.2 folder
>>    ./configure, make and make distclean.

> That's only needed if you build from the git repository, building from 
> the tarball should work without this step.

I repeat the whole process once again from scratch and this time I didn't perform this step.

>> 5. Added appropriate module names in core.mk file.

> I think that's not needed for Ginger Bread, only ICS (4.0) requires this.

I repeat the whole process once again from scratch and this time I didn't perform this step.

>> Looks like linker is not able to read the static library "libvstr.a". 
>> Is the "libvstr.a" library is compatible with android?

> Hm, with the provided Android.mk on the wiki (vstr.mk which is moved 
> by the vstr.build script to the location specified in that script) the 
> static library should be converted to a dynamic library which is what 
> strongSwan should be linked against.

When I compile the full android code base. As per Android.mk (vstr.mk) both the static (libvstr-static) and shared (libvstr.so) library gets generated in android/out folder.
Compilation is all successful, problem occured while generating libstrongswan library. While linking the files present in libstrongswan-intermediaries folder (printf_hook.c) error occurs as "undefined reference to functions present in libvstr.a library".
I observe that before generating libstrongswan, both libvstr-static and libvstr.so is generated properly.
Below is the snippet of the error.

prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/test/obj/SHARED_LIBRARIES/libstrongswan_intermediates/printf_hook.o: in function vstr_wrapper_vfprintf:external/strongswan-4.6.3/src/libstrongswan/printf_hook.c:296: error: undefined reference to 'vstr_make_base'

I would like to mention that I didn't make any changes in the Android GB default kernel. By any chance is this the cause of error. Is changing the kernel code as per wiki link is also a mandatory step.

While building vstr library using the below set of steps as mentioned on wiki pages.

cd vstr-1.0.15
patch -p1 < ../vstr.patch
. ../vstr.build

I observe following errors in the vstr build.

/home/mrunal/TEST_PROJ/SRC/android/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/../libexec/gcc/arm-eabi/4.2.1/collect2 -X -L/home/mrunal/TEST_PROJ/SRC/android/out/target/product/test/obj/lib -L/home/mrunal/TEST_PROJ/SRC/android/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1 -L/home/mrunal/TEST_PROJ/SRC/android/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/../lib/gcc -L/home/mrunal/TEST_PROJ/SRC/android/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/../../../../arm-eabi/lib -T /home/mrunal/TEST_PROJ/SRC/android/build/core/armelf.x -dynamic-linker /system/bin/linker --gc-sections -z nocopyreloc --no-undefined -rpath-link=/home/mrunal/TEST_PROJ/SRC/android/out/target/product/test/obj/lib -rpath /system/lib /home/mrunal/TEST_PROJ/SRC/android/out/target/product/test/obj/lib/crtbegin_dynamic.o /home/mrunal/TEST_PROJ/SRC/android/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/libgcc.a /home/mrunal/TEST_PROJ/SRC/android/out/target/product/test/obj/lib/crtend_android.o -lc -lm
/home/mrunal/TEST_PROJ/SRC/android/out/target/product/test/obj/lib/crtbegin_dynamic.o: In function `_start':
(.text+0x14): undefined reference to `main'
collect2: ld returned 1 exit status
configure:3613: $? = 1

configure:3876: droid-gcc -c -DUSE_RESTRICTED_HEADERS -Wall -O2  conftest.c >&5
conftest.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'me'

Does above error indicates that libvstr.a build is not proper that’s why libvstr.so build is also not proper and then finally while building Android codebase, linker is not able to link the libvstr library.

Thanks in advance.

Regards,
-Kushagra


More information about the Users mailing list