Re: [Vala] Vala HEAD is broken on MacOSX



On Tue, Mar 15, 2011 at 2:58 PM, pancake <pancake youterm com> wrote:
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).

If this is added to POSIX then some of the future macosx version will
have it. But my current version (10.6.4) still does not have it.

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)

Some projects have "compat" directory that include missing
implementations, something like

#ifdef __APPLE__
  .... implement strnlen here ..
#endif

I am not sure how to add this kind of code to *.vapi file.

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 <anatol pomozov gmail com> 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
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list

_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]