libiconv and libcharset

5,540 views
Skip to first unread message

Nate Lyman

unread,
Oct 15, 2010, 5:03:34 PM10/15/10
to android-ndk
I'm working on compiling a c++ library that uses libiconv. I have
successfully (I think) compiled both libcharset and well as libiconv.

When I'm trying to build my final library it gives me the following
errors:


./out/apps/sdk/armeabi/libiconv.a(iconv.o): In function
`iconv_canonicalize':
/Users/***/Documents/Projects/AndroidSDK/trunk/apps/iconv/lib/iconv.c:
543: undefined reference to `locale_charset'
./out/apps/sdk/armeabi/libiconv.a(iconv.o): In function
`libiconv_open_into':
/Users/***/Documents/Projects/AndroidSDK/trunk/apps/iconv/lib/
iconv_open1.h:167: undefined reference to `locale_charset'
/Users/***/Documents/Projects/AndroidSDK/trunk/apps/iconv/lib/
iconv_open1.h:91: undefined reference to `locale_charset'
/Users/***/Documents/Projects/AndroidSDK/trunk/apps/iconv/lib/
iconv_open1.h:117: undefined reference to `locale_charset'
/Users/***/Documents/Projects/AndroidSDK/trunk/apps/iconv/lib/
iconv_open1.h:193: undefined reference to `locale_charset'
./out/apps/sdk/armeabi/libiconv.a(iconv.o):/Users/***/Documents/
Projects/AndroidSDK/trunk/apps/iconv/lib/iconv_open1.h:167: more
undefined references to `locale_charset' follow
collect2: ld returned 1 exit status


Any insight would be extremely helpful. Has anyone successfully built
libiconv using the Android NDK?

Gauthier B

unread,
Oct 15, 2010, 6:51:27 PM10/15/10
to andro...@googlegroups.com
Yes I did, here are my makefile :


LOCAL_PATH:= /
APP_PATH:= ${NDK}/$(call my-dir)
 
include $(CLEAR_VARS)
 
LOCAL_MODULE    := libiconv
 
LOCAL_CFLAGS    := \
    -Wno-multichar \
    -D_ANDROID \
    -DLIBDIR="c" \
    -DBUILDING_LIBICONV \
    -DIN_LIBRARY \
    -I${LIBS}/COMMON/libiconv-1.13.1/include/ \
    -I${LIBS}/COMMON/libiconv-1.13.1/lib/ \
    -I${LIBS}/COMMON/libiconv-1.13.1/
 
LOCAL_SRC_FILES := \
     ${LIBS}/COMMON/libiconv-1.13.1/lib/iconv.c \
     ${LIBS}/COMMON/libiconv-1.13.1/libcharset/lib/localcharset.c \
     ${LIBS}/COMMON/libiconv-1.13.1/lib/relocatable.c \
     
include $(BUILD_STATIC_LIBRARY)
 
LOCAL_LDLIBS    := -llog


So i compiled libcharset into libiconv.

-
ggp


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


Gauthier B

unread,
Oct 15, 2010, 6:52:08 PM10/15/10
to andro...@googlegroups.com
-are+is

;)

Gauthier B

unread,
Oct 15, 2010, 6:54:11 PM10/15/10
to andro...@googlegroups.com
Or you can add -lcharset to your libiconv makefile.

Nate Lyman

unread,
Oct 15, 2010, 7:14:36 PM10/15/10
to andro...@googlegroups.com
Thank you!  After a couple of tweaks for my environment it worked perfectly.  Thanks!


Nate

ama...@gmail.com

unread,
Nov 4, 2013, 1:20:27 AM11/4/13
to andro...@googlegroups.com
I know this post is quite old, but in case anyone is still watching I'm getting:

localcharset.c: In function 'get_charset_aliases':
localcharset.c:136:15: error: 'LIBDIR' undeclared (first use in this function)
localcharset.c:136:15: note: each undeclared identifier is reported only once

It appears none of the defines are working.  Anyone know why that might be?  Thanks.
Reply all
Reply to author
Forward
0 new messages