Dear Paolo,
compiling libgst on FreeBSD caued a compilation error on FreeBSD. --- a/libgst/cint.c +++ b/libgst/cint.c @@ -396,6 +396,8 @@ my_putenv (const char *str) return (putenv (clone)); } +extern char **environ; + static char ** get_environ (void) { and running the Grease tests caused a segfault. This is due FreeBSD GNU libiconv doesn't understand 'utf8' it must be 'UTF-8' and the calls to iconv_open do not check the return value, e.g it is (iconv_t) -1 in case of error. diff --git a/packages/iconv/iconv.c b/packages/iconv/iconv.c index 80c97c6..3125a3c 100644 --- a/packages/iconv/iconv.c +++ b/packages/iconv/iconv.c @@ -74,6 +74,9 @@ iconvWrapper (iconv_t handle, OOP readBufferOOP, int readPos, gst_object bytesLeft, readBuffer, writeBuffer; + //if (handle == (iconv_t) -1) + // return 0; + readBuffer = OOP_TO_OBJ (readBufferOOP); inbuf = &STRING_OOP_AT (readBuffer, readPos); inbytesleft = readCount; @@ -92,11 +95,33 @@ iconvWrapper (iconv_t handle, OOP readBufferOOP, int readPos, return (save_errno != EILSEQ); } +iconv_t my_iconv_open(const char *_tocode, const char *_fromcode) +{ + const char *fromcode = _fromcode; + const char *tocode = _tocode; + if (strcmp(tocode, "utf8") == 0) + tocode = "UTF-8"; + if (strcmp(fromcode, "utf8") == 0) + fromcode = "UTF-8"; + + iconv_t res = iconv_open(tocode, fromcode); + if (res == (iconv_t) -1) + printf("Got error for '%s' '%s'\n", tocode, fromcode); + return res; +} + +int my_iconv_close(iconv_t cd) +{ + if (cd != (iconv_t) -1) + iconv_close(cd); + return 0; +} + void gst_initModule (VMProxy * proxy) { vmProxy = proxy; - vmProxy->defineCFunc ("iconv_open", iconv_open); - vmProxy->defineCFunc ("iconv_close", iconv_close); + vmProxy->defineCFunc ("iconv_open", my_iconv_open); + vmProxy->defineCFunc ("iconv_close", my_iconv_close); vmProxy->defineCFunc ("iconvWrapper", iconvWrapper); } and the complex test is failing in raisedTo but I didn't debug this one. So how should we move forward on these two issues? _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
Il 10/05/2013 07:53, Holger Hans Peter Freyther ha scritto:
> Dear Paolo, > > compiling libgst on FreeBSD caued a compilation error on FreeBSD. > > --- a/libgst/cint.c > +++ b/libgst/cint.c > @@ -396,6 +396,8 @@ my_putenv (const char *str) > return (putenv (clone)); > } > > +extern char **environ; > + > static char ** > get_environ (void) > { > > Please add AC_CHECK_DECL to configure.ac, and guard this by #ifdef HAVE_DECL_ENVIRON. > and running the Grease tests caused a segfault. This is due FreeBSD > GNU libiconv doesn't understand 'utf8' it must be 'UTF-8' and the > calls to iconv_open do not check the return value, e.g it is > (iconv_t) -1 in case of error. > > diff --git a/packages/iconv/iconv.c b/packages/iconv/iconv.c > index 80c97c6..3125a3c 100644 > --- a/packages/iconv/iconv.c > +++ b/packages/iconv/iconv.c > @@ -74,6 +74,9 @@ iconvWrapper (iconv_t handle, OOP readBufferOOP, int readPos, > > gst_object bytesLeft, readBuffer, writeBuffer; > > + //if (handle == (iconv_t) -1) > + // return 0; > + > readBuffer = OOP_TO_OBJ (readBufferOOP); > inbuf = &STRING_OOP_AT (readBuffer, readPos); > inbytesleft = readCount; > @@ -92,11 +95,33 @@ iconvWrapper (iconv_t handle, OOP readBufferOOP, int readPos, > return (save_errno != EILSEQ); > } > > +iconv_t my_iconv_open(const char *_tocode, const char *_fromcode) > +{ > + const char *fromcode = _fromcode; > + const char *tocode = _tocode; > + if (strcmp(tocode, "utf8") == 0) > + tocode = "UTF-8"; > + if (strcmp(fromcode, "utf8") == 0) > + fromcode = "UTF-8"; > + > + iconv_t res = iconv_open(tocode, fromcode); > + if (res == (iconv_t) -1) > + printf("Got error for '%s' '%s'\n", tocode, fromcode); > + return res; > +} > + > +int my_iconv_close(iconv_t cd) > +{ > + if (cd != (iconv_t) -1) > + iconv_close(cd); > + return 0; > +} > + > void > gst_initModule (VMProxy * proxy) > { > vmProxy = proxy; > - vmProxy->defineCFunc ("iconv_open", iconv_open); > - vmProxy->defineCFunc ("iconv_close", iconv_close); > + vmProxy->defineCFunc ("iconv_open", my_iconv_open); > + vmProxy->defineCFunc ("iconv_close", my_iconv_close); > vmProxy->defineCFunc ("iconvWrapper", iconvWrapper); > } Please do this in the Smalltalk code instead... we can generalize it to a list of aliases later. > > and the complex test is failing in raisedTo but I didn't debug this one. So how > should we move forward on these two issues? Paolo _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
2013-12-14 Holger Hans Peter Freyther <[hidden email]>
* configure.ac: Check for environ with AC_CHECK_DECLS. 2013-12-14 Holger Hans Peter Freyther <[hidden email]> * cint.c: Fix the compilation on FreeBSD. --- ChangeLog | 4 ++++ configure.ac | 3 +++ libgst/ChangeLog | 4 ++++ libgst/cint.c | 8 ++++++++ 4 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7b6f5e8..ea47151 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-12-14 Holger Hans Peter Freyther <[hidden email]> + + * configure.ac: Check for environ with AC_CHECK_DECLS. + 2013-12-08 Holger Hans Peter Freyther <[hidden email]> * kernel/Regex.st: Check for isEmpty of the Interval before diff --git a/configure.ac b/configure.ac index 2d69fe0..dbc75a6 100644 --- a/configure.ac +++ b/configure.ac @@ -369,6 +369,9 @@ if test "$ac_cv_func__NSGetEnviron" = yes; then environ variable.]) fi +dnl FreeBSD does provide an environ but it is not declared in the headers +AC_CHECK_DECLS([environ]) + AC_SEARCH_LIBS([nanosleep], [rt]) if test "$ac_cv_search_nanosleep" != no; then AC_DEFINE(HAVE_NANOSLEEP, 1, diff --git a/libgst/ChangeLog b/libgst/ChangeLog index 19fce63..2195e3f 100644 --- a/libgst/ChangeLog +++ b/libgst/ChangeLog @@ -1,3 +1,7 @@ +2013-12-14 Holger Hans Peter Freyther <[hidden email]> + + * cint.c: Fix the compilation on FreeBSD. + 2013-11-30 Holger Hans Peter Freyther <[hidden email]> * gst-parse.c: Check if currentClass is nil before calling diff --git a/libgst/cint.c b/libgst/cint.c index 9dd441e..510cc46 100644 --- a/libgst/cint.c +++ b/libgst/cint.c @@ -396,6 +396,14 @@ my_putenv (const char *str) return (putenv (clone)); } +/* + * On FreeBSD and other BSDs there is the environ but it is not + * declared in header. Import it like this. + */ +#if !HAVE_DECL_ENVIRON +extern char **environ; +#endif + static char ** get_environ (void) { -- 1.8.4.rc3 _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
Free forum by Nabble | Edit this page |