Just fyi.. It was originally a gnu extension ( as reported in my archlinux 
manpage) but its defined as posix now. Netbsd, openbsd and freebsd have this 
(only recent versions).

The place for this should be glib. But looks like glibc have some sse 
optimizations for this function.. And that would make run vala programs slower 
on linux86.. (theorically... I would be happy to see some benchmarks)

On 15/03/2011, at 22:51, pancake <[email protected]> wrote:

> I just reported this in the irc few hours ago. The commit was in 10th of 
> february. And jurg ha no plans to remove that claiming for optimization 
> issues.
> 
> So the idea would be to fix this on the affected platforms:
> 
> Osx, iphone and windows.
> 
> I have just appended the inline definition of strnlen into the system's 
> string.h include file. This is just a hack..
> 
> Any idea? Any program compiled against glib-2.0.vapi will suffer the same 
> issue.
> 
> On 15/03/2011, at 20:57, Anatol Pomozov <[email protected]> wrote:
> 
>> Hi,
>> 
>> I just tried to compile HEAD from git and it is broken on MacOSX.
>> 
>> Here is the error:
>> 
>> CCLD   libvala-0.12.la
>> Undefined symbols:
>> "_strnlen", referenced from:
>>     _string_substring in valaccodebasemodule.o
>>     _string_substring in valaccodemethodmodule.o
>>     _string_substring in valadovabasemodule.o
>>     _string_substring in valagirwriter.o
>>     _vala_attribute_get_string in libvalacore.a(valaattribute.o)
>>     _string_substring in libvalacore.a(valaclass.o)
>>     _string_substring in libvalacore.a(valacodecontext.o)
>>     _string_substring in libvalacore.a(valagirparser.o)
>>     _string_substring in libvalacore.a(valagenieparser.o)
>>     _string_substring in libvalacore.a(valageniescanner.o)
>>     _string_substring in libvalacore.a(valaintegerliteral.o)
>>     _string_substring in libvalacore.a(valainterface.o)
>>     _string_substring in libvalacore.a(valamarkupreader.o)
>>     _string_substring in libvalacore.a(valamethod.o)
>>     _string_substring in libvalacore.a(valaparser.o)
>>     _string_substring in libvalacore.a(valascanner.o)
>>     _string_substring in libvalacore.a(valasourcefile.o)
>>     _vala_string_literal_eval in libvalacore.a(valastringliteral.o)
>> ld: symbol(s) not found
>> collect2: ld returned 1 exit status
>> 
>> 
>> The reason is that strnlen is not defined on macosx (at least on
>> 10.6.4 + xcode 3). The easiest way is to implement it on this platform
>> as
>> 
>> size_t strnlen(const char *s, size_t n)
>> {
>> const char *p = (const char *)memchr(s, 0, n);
>> return(p ? p-s : n);
>> }
>> _______________________________________________
>> vala-list mailing list
>> [email protected]
>> http://mail.gnome.org/mailman/listinfo/vala-list
>> 
> _______________________________________________
> vala-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/vala-list
> 
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to