Open-TEE / opentee-android

Android code/libraries for deploying and running Open TEE code
https://github.com/Open-TEE
Apache License 2.0
50 stars 24 forks source link

libtee submodule issue (tee_shared_data_types.h not found) #5

Open ambihelical opened 8 years ago

ambihelical commented 8 years ago

The gradle build was not finding tee_shared_data_types.h, so I investigated: The git submodule references otsservice/src/main/jni/libtee This is a symlink to ../../../..opentee/src/main/jni/libtee Which resolves to opentee/src/main/jni/libtee in the opentee-android repo.

git submodule update --init didn't do anything so I ended up doing this:

cd opentee/src/main/jni
git clone https://github.com/Open-TEE/libtee.git

I don't know why the submodule is set up like this, or why it didn't update (doesn't like the symlink?), but this was a workaround that allowed the gradle build to succeed.

Git is version 2.9.3.

YangRongAtGit commented 8 years ago

Hello ambihelical,

I had the same problem when I tried to use the opentee-android. The header file tee_shared_data_types.h and tee_client_api.h are missing from the folder opentee-android/otservice/src/main/jni/

To fix that, I suppose you have the original Open-TEE project somewhere. The missing header files are in the original Open-TEE project. So you could create soft links in the folder opentee-android/otservice/src/main/jni/

ln -s /home/<Open-TEE project path>/libtee/include/tee_client_api.h ln -s /home/<Open-TEE project path>/libtee/include/tee_shared_data_types.h

Then, go back the android studio, Sync -> Clean project ->Rebuild Project. The good news is the header file missing problem should gone. Bad news is: you will have errors

Error:(34, 21) error: '__android_log' was not declared in this scope
Information:(84, 5) in expansion of macro 'LOGD'
Warning:(35, 79) warning: format '%s' expects argument of type 'char*', but argument 10 has type 'void*' [-Wformat=]
Information:(91, 9) in expansion of macro 'LOGI'
Error:(34, 35) error: expected ';' before '_print'
Information:(102, 5) in expansion of macro 'LOGD'
Error:(34, 21) error: '__android_log' was not declared in this scope
Information:(107, 5) in expansion of macro 'LOGD'
Error:(34, 35) error: expected ';' before '_print'
Information:(110, 9) in expansion of macro 'LOGD'
Error:(34, 35) error: expected ';' before '_print'
Information:(113, 5) in expansion of macro 'LOGD'
Error:(34, 21) error: '__android_log' was not declared in this scope
Information:(122, 5) in expansion of macro 'LOGD'
...

I have not figured out how to fix those errors. By some reasons, the library log is not linked. I tried to add ndk block in build.gradle (Module:otservice) and include ldLibs: 'log'. But that does not fix the problem.

If you find out how to fix the link error, please let me know :)

Thanks and gl.

ambihelical commented 8 years ago

I didn't have any problem after I cloned the libtee.git repo in the right place, as I indicated in my post. The real problem is that the submodule is not configured correctly, as far as I can tell. I'm not using Android Studio though, so this may be different. Good luck.