Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

New Forums: Nexus Player | Nexus 9
Like Tree3Likes
  • 1 Post By Marky.Vasconcelos
  • 1 Post By Marky.Vasconcelos
  • 1 Post By Marky.Vasconcelos

test: Reply
 
LinkBack Thread Tools
Old January 4th, 2011, 07:49 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Dec 2010
Posts: 9
 
Device(s): Motorola Milestone (Android 2.1)
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default NDK - Using static libraries don't find headers

PS: There's another two simpler questions at the end of this post, I want to know those too.

Hi.. i'm wrapping a native API to Android by NDK.

But when building it don't find the header files.

I have the following structure.

<project>/jni
Android.mk
Code:
LOCAL_PATH := $(call my-dir)

include $(call all-subdir-makefiles)

LOCAL_PATH :=/home/marcos/dev/workspace/rmsdk.native.wraper/jni

include $(CLEAR_VARS)

LOCAL_LDLIBS := -llog

LOCAL_MODULE    := ndk1
LOCAL_SRC_FILES := native.c DelegateDRMProcessorClient.cpp
LOCAL_STATIC_LIBRARY := adept cryptopenssl dp expat fonts hobbes jpeg mschema png t3 xml zlib

include $(BUILD_SHARED_LIBRARY)
<project>/jni/prereqs/
Android.mk (Used to call all subdirs Android.mk files)
Code:
LOCAL_PATH := $(call my-dir)
include $(call all-subdir-makefiles)
include $(CLEAR_VARS)
<project>/jni/prereqs/<lib>/
Android.mk
Code:
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    :=dp
LOCAL_SRC_FILES :=libdp.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include

include $(PREBUILT_STATIC_LIBRARY)
And there's a include folder on each <lib> folder.


Why when compiling I still get a
"/home/marcos/dev/workspace/rmsdk.native.wraper/jni/DelegateDRMProcessorClient.h:18:20: error: dp_all.h: No such file or directory"

Another simple questions that I need to know too.

1 In the main Android.mk file I wrote the line:
"LOCAL_PATH :=/home/marcos/dev/workspace/rmsdk.native.wraper/jni"
Cause after entering the call all-subdir my path goes wrong and do not find the native.c file (it searchs at ndk home, idk why)

2 How do I execute a @echo in a Android.mk file? It's possible?

Thank you,
Marcos Vasconcelos

Advertisements
Marky.Vasconcelos is offline  
Reply With Quote
sponsored links
Old January 4th, 2011, 11:21 AM   #2 (permalink)
New Member
Thread Author (OP)
 
Join Date: Dec 2010
Posts: 9
 
Device(s): Motorola Milestone (Android 2.1)
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

I have another problem now.

I get it works copying the include folders to jni/include-all and change my Android.mk to the following
(And the 1 little question too)

Code:
LOCAL_PATH := $(call my-dir)

MY_PATH := $(LOCAL_PATH)

include $(call all-subdir-makefiles)

LOCAL_PATH := $(MY_PATH)

include $(CLEAR_VARS)

LOCAL_LDLIBS := -llog -ldl
LOCAL_MODULE    := rmsdk-wrapper
LOCAL_SRC_FILES := curlnetprovider.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include-all
LOCAL_STATIC_LIBRARY := curl

include $(BUILD_SHARED_LIBRARY)
The problem now is when compiling I get the following error
Code:
marcos@marcos-AY675AA-AC4-s5320br:~/dev/workspace/rmsdk.native.wraper$ ndk-build
SharedLibrary  : librmsdk-wrapper.so
/home/marcos/dev/workspace/rmsdk.native.wraper/obj/local/armeabi/objs/rmsdk-wrapper/curlnetprovider.o: In function `~CurlStream':
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:119: undefined reference to `curl_easy_cleanup'
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:122: undefined reference to `curl_slist_free_all'
/home/marcos/dev/workspace/rmsdk.native.wraper/obj/local/armeabi/objs/rmsdk-wrapper/curlnetprovider.o: In function `CurlStream::bytesReady(unsigned int, dp::Data const&, bool)':
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:212: undefined reference to `dp::String::String(char const*)'
/home/marcos/dev/workspace/rmsdk.native.wraper/obj/local/armeabi/objs/rmsdk-wrapper/curlnetprovider.o: In function `CurlStream::writer_callback(void*, unsigned int, unsigned int)':
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:404: undefined reference to `dp::Data::Data(unsigned char const*, unsigned int)'
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:418: undefined reference to `dp::Data::Data(unsigned char const*, unsigned int)'
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:389: undefined reference to `curl_easy_pause'
/home/marcos/dev/workspace/rmsdk.native.wraper/obj/local/armeabi/objs/rmsdk-wrapper/curlnetprovider.o: In function `CurlStream::perform()':
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:251: undefined reference to `curl_easy_perform'
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:262: undefined reference to `dp::Data::Data(unsigned char const*, unsigned int)'
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:257: undefined reference to `dp::String::String(char const*)'
/home/marcos/dev/workspace/rmsdk.native.wraper/obj/local/armeabi/objs/rmsdk-wrapper/curlnetprovider.o: In function `CurlStream::requestBytes(unsigned int, unsigned int)':
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:166: undefined reference to `curl_easy_pause'
/home/marcos/dev/workspace/rmsdk.native.wraper/obj/local/armeabi/objs/rmsdk-wrapper/curlnetprovider.o: In function `CurlStream':
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:53: undefined reference to `curl_easy_init'
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:63: undefined reference to `curl_easy_setopt'
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:64: undefined reference to `curl_easy_setopt'
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:65: undefined reference to `curl_easy_setopt'
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:103: undefined reference to `curl_easy_setopt'
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:104: undefined reference to `curl_easy_setopt'
/home/marcos/dev/workspace/rmsdk.native.wraper/obj/local/armeabi/objs/rmsdk-wrapper/curlnetprovider.o:/home/marcos/dev/workspace/rmsdk.native.wraper/jni/curlnetprovider.cpp:105: more undefined references to `curl_easy_setopt' follow
To fix it I try add the import-module command do the Android.mk

$(call import-module,curl)

And now I got the following error.

Code:
Android NDK: /home/marcos/dev/workspace/rmsdk.native.wraper/jni/prereqs/zlib/Android.mk: Cannot find module with tag 'curl' in import path    
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?    
/home/marcos/dev/workspace/rmsdk.native.wraper/jni/Android.mk:11: *** Android NDK: Aborting.    .  Stop.
Anyone can help? I think my Android.mk files are wrong.
lullabee likes this.
Marky.Vasconcelos is offline  
Reply With Quote
Old January 4th, 2011, 11:59 AM   #3 (permalink)
New Member
Thread Author (OP)
 
Join Date: Dec 2010
Posts: 9
 
Device(s): Motorola Milestone (Android 2.1)
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

Another issue.. I wrote a Application.mk and add a APP_MODULES to list my modules, and forgot the main module witch has this problem.

My surprise running is get the following result:

Code:
marcos@marcos-AY675AA-AC4-s5320br:~/dev/workspace/rmsdk.native.wraper$ ndk-build
Prebuilt       : libadept.a <= jni/prereqs/adept/
Prebuilt       : libcryptopenssl.a <= jni/prereqs/cryptopenssl/
Prebuilt       : libcurl.a <= jni/prereqs/curl/
Prebuilt       : libdp.a <= jni/prereqs/dp/
Prebuilt       : libexpat.a <= jni/prereqs/expat/
Prebuilt       : libfonts.a <= jni/prereqs/fonts/
Prebuilt       : libhobbes.a <= jni/prereqs/hobbes/
Prebuilt       : libjpeg.a <= jni/prereqs/jpeg/
Prebuilt       : libmschema.a <= jni/prereqs/mschema/
Prebuilt       : libpng.a <= jni/prereqs/png/
Prebuilt       : libt3.a <= jni/prereqs/t3/
Prebuilt       : libxml.a <= jni/prereqs/xml/
Prebuilt       : libzlib.a <= jni/prereqs/zlib/
And it never happened before, I think this should execute every time before building the main module, but it looks like it wont.

Anyone know if there's a way to order my modules build?
lullabee likes this.
Marky.Vasconcelos is offline  
Reply With Quote
Old January 4th, 2011, 12:12 PM   #4 (permalink)
New Member
Thread Author (OP)
 
Join Date: Dec 2010
Posts: 9
 
Device(s): Motorola Milestone (Android 2.1)
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

Okay, this is LOCAL_STATIC_LIBRARIES, not LOCAL_STATIC_LIBRARY, this works now.
lullabee likes this.
Marky.Vasconcelos is offline  
Reply With Quote
The Following User Says Thank You to Marky.Vasconcelos For This Useful Post:
lullabee (August 10th, 2012)
Old August 10th, 2012, 03:54 PM   #5 (permalink)
New Member
 
Join Date: Aug 2012
Posts: 1
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you for your thread,
You solved all my problems one by one !
lullabee is offline  
Reply With Quote
Reply
Tags
ndk, ndk-build


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:49 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.