Regular expression support in Android

1,569 views
Skip to first unread message

pm_10

unread,
Jun 19, 2010, 8:27:57 PM6/19/10
to android-ndk
I'm trying to compile for POSIX regular expression functions in
Android & somehow my variables & functions get resolved by regex.h
present in android-8 directory at android-ndk-r4\build\platforms
\android-8\arch-arm\usr\include\regex.h but while loading - the
corresponding code cannot be located to make the executable. -

<...>/file_parse.c:82: undefined reference to `regcomp'
<...>/file_parse.c:84: undefined reference to `regexec'
collect2: ld returned 1 exit status

any help would be greatly appreciated.

Onur Cinar

unread,
Jun 20, 2010, 1:41:52 AM6/20/10
to android-ndk

Hi,

Yes looks like the header is available but the libc does not include
the implementations for these functions.

Looks like the best alternative is to download the glibc source code
from (http://ftp.gnu.org/gnu/glibc/) and then including the regcomp.c
and regexec.c into your library directly for now.

I'm hoping that it will resolve the issue for now.

Regards,

-onur
---
www.zdo.com

David Turner

unread,
Jun 20, 2010, 11:01:50 AM6/20/10
to andro...@googlegroups.com
Oops, it's probably a packaging error. The Froyo C library *does* include the regex functions.
I guess I didn't properly update the binary in the NDK platforms directory.

I'll try to fix this in a later release. In the meantime, please grab the sources from the OpenBSD
tree (they are in src/lib/libc/regex/), since that's what is being used in Froyo, and include them to
your project.

Sorry about that.
 
--
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.


David Turner

unread,
Jun 20, 2010, 11:02:28 AM6/20/10
to andro...@googlegroups.com
On Sat, Jun 19, 2010 at 10:41 PM, Onur Cinar <onur....@gmail.com> wrote:

Hi,

Yes looks like the header is available but the libc does not include
the implementations for these functions.

Looks like the best alternative is to download the glibc source code
from (http://ftp.gnu.org/gnu/glibc/) and then including the regcomp.c
and regexec.c into your library directly for now.

I don't know if the GLibc regex is licensed under the BSD or LGPL. If the latter,
this is probably not a good advice for a lot of people !
 
I'm hoping that it will resolve the issue for now.

Regards,

-onur


On Jun 19, 5:27 pm, pm_10 <pmalhotr...@gmail.com> wrote:
> I'm trying to compile for POSIX regular expression functions in
> Android & somehow my variables & functions get resolved by regex.h
> present in android-8 directory at android-ndk-r4\build\platforms
> \android-8\arch-arm\usr\include\regex.h but while loading - the
> corresponding code cannot be located to make the executable. -
>
> <...>/file_parse.c:82: undefined reference to `regcomp'
> <...>/file_parse.c:84: undefined reference to `regexec'
> collect2: ld returned 1 exit status
>
> any help would be greatly appreciated.

---
www.zdo.com

Onur Cinar

unread,
Jun 20, 2010, 10:39:23 PM6/20/10
to android-ndk

Hi David,

> > I don't know if the GLibc regex is licensed under the BSD or LGPL. If the
>
> latter,
> this is probably not a good advice for a lot of people !

It is LGPL, so it needs to be linked as a dynamic library outside the
actual code for closed code applications. But if everything else is
coming from OpenBSD, then actually there is no reason to use glibc.
Thanks for that info.

Regards,

-onur


---
www.zdo.com

pm_10

unread,
Jun 21, 2010, 4:31:00 AM6/21/10
to android-ndk

Thanks Guys.

Regards,
pm_10
Reply all
Reply to author
Forward
0 new messages