You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ben Collins-Sussman <su...@collab.net> on 2002/07/19 20:28:04 UTC

[PATCH] link againt iconv on bsd

I'm finally able to build HEAD of svn against HEAD of apr and
apr-util on my FreeBSD system.

Even though HAVE_ICONV was #defined by apr-util (which causes the
apr_xlate routines to start calling iconv() routines), I was getting
link errors when linking svn binaries:  "iconv_open not defined".

It turned out the simple problem was a lack of '-liconv' on the link
line.  On linux, the iconv routines are part of libc.  On BSD, it's a
3rd party library.

So this patch just adds -liconv to the main set of $APRUTIL_LIBS.
Don't ask me how many hours it took me to figure this out.  >:-(

Is there a better way to do this?

Index: apu-iconv.m4
===================================================================
RCS file: /home/cvs/apr-util/build/apu-iconv.m4,v
retrieving revision 1.3
diff -u -r1.3 apu-iconv.m4
--- apu-iconv.m4	19 Jul 2002 17:08:40 -0000	1.3
+++ apu-iconv.m4	19 Jul 2002 20:27:49 -0000
@@ -19,7 +19,8 @@
 fi
 AC_SUBST(have_iconv)
 APR_FLAG_HEADERS(iconv.h)
-
+APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
+APR_ADDTO(APRUTIL_LIBS,[-liconv])
 ])dnl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] link againt iconv on bsd

Posted by Justin Erenkrantz <je...@apache.org>.
On Fri, Jul 19, 2002 at 04:40:54PM -0500, William A. Rowe, Jr. wrote:
> At 04:34 PM 7/19/2002, Justin Erenkrantz wrote:
> 
> >No need to check the funcs when we know we have a separate library.
> >We might need to wrap all this with a AC_CHECK_HEADER to ensure we
> >have an iconv.h, but I'm not 100% sure if all libc impls have an
> >iconv.h.
> 
> Ben's point is that he already knows iconv is NOT present in all libc
> implementations, specifically, his.

I mean "iconv.h" is in the includes path not the iconv funcs in
libc.

Ben's patch adds -liconv to ALL platforms.  Bzzt.

My suggestion changes it so that we only add -liconv where we
need it.  -- justin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] link againt iconv on bsd

Posted by Justin Erenkrantz <je...@apache.org>.
On Fri, Jul 19, 2002 at 04:40:54PM -0500, William A. Rowe, Jr. wrote:
> At 04:34 PM 7/19/2002, Justin Erenkrantz wrote:
> 
> >No need to check the funcs when we know we have a separate library.
> >We might need to wrap all this with a AC_CHECK_HEADER to ensure we
> >have an iconv.h, but I'm not 100% sure if all libc impls have an
> >iconv.h.
> 
> Ben's point is that he already knows iconv is NOT present in all libc
> implementations, specifically, his.

I mean "iconv.h" is in the includes path not the iconv funcs in
libc.

Ben's patch adds -liconv to ALL platforms.  Bzzt.

My suggestion changes it so that we only add -liconv where we
need it.  -- justin

Re: [PATCH] link againt iconv on bsd

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 04:34 PM 7/19/2002, Justin Erenkrantz wrote:

>No need to check the funcs when we know we have a separate library.
>We might need to wrap all this with a AC_CHECK_HEADER to ensure we
>have an iconv.h, but I'm not 100% sure if all libc impls have an
>iconv.h.

Ben's point is that he already knows iconv is NOT present in all libc
implementations, specifically, his.

Bill



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] link againt iconv on bsd

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 04:34 PM 7/19/2002, Justin Erenkrantz wrote:

>No need to check the funcs when we know we have a separate library.
>We might need to wrap all this with a AC_CHECK_HEADER to ensure we
>have an iconv.h, but I'm not 100% sure if all libc impls have an
>iconv.h.

Ben's point is that he already knows iconv is NOT present in all libc
implementations, specifically, his.

Bill



Re: [PATCH] link againt iconv on bsd

Posted by Branko Čibej <br...@xbc.nu>.
Branko Čibej wrote:

> Probably should check for the libc iconv first, and have_iconv must 
> always have a value; so tis would become:
>
> AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [
>  AC_CHECK_LIB(iconv, iconv, [
>    APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
>    APR_ADDTO(APRUTIL_LIBS,[-liconv])
>    have_iconv="1"
>  ],
>  [ have_iconv="0" ]
> ])


Yikes, and don't forget the missing ')' in the line before last.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] link againt iconv on bsd

Posted by Albert Chin <su...@thewrittenword.com>.
On Sat, Jul 20, 2002 at 12:29:46AM +0200, Branko Cibej wrote:
> Probably should check for the libc iconv first, and have_iconv must 
> always have a value; so tis would become:
> 
> AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [
>   AC_CHECK_LIB(iconv, iconv, [
>     APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
>     APR_ADDTO(APRUTIL_LIBS,[-liconv])
>     have_iconv="1"
>   ],
>   [ have_iconv="0" ]
> ])

This won't work with GNU libiconv. Pull down the source for libxml and
look at how they do it then steal it. Don't assume that "iconv" is the
name of a valid function in -liconv. #include <iconv.h> first to
handle redefinitions of iconv.

>From libiconv 1.8 build on Solaris 7:
  $ nm libiconv.so | grep iconv
  ...
  [801]   |    131348|      56|FUNC |GLOB |0    |8      |libiconv
  [811]   |    131420|      20|FUNC |GLOB |0    |8      |libiconv_close
  [803]   |    130096|    1252|FUNC |GLOB |0    |8      |libiconv_open
  [828]   |    131456|     308|FUNC |GLOB |0    |8      |libiconvctl
  [817]   |    131940|     404|FUNC |GLOB |0    |8      |libiconvlist

>From <iconv.h>
  ...
  #ifndef LIBICONV_PLUG
  #define iconv libiconv
  #endif
  ...

-- 
albert chin (china@thewrittenword.com)

Re: [PATCH] link againt iconv on bsd

Posted by Branko Čibej <br...@xbc.nu>.
Branko Čibej wrote:

> Probably should check for the libc iconv first, and have_iconv must 
> always have a value; so tis would become:
>
> AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [
>  AC_CHECK_LIB(iconv, iconv, [
>    APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
>    APR_ADDTO(APRUTIL_LIBS,[-liconv])
>    have_iconv="1"
>  ],
>  [ have_iconv="0" ]
> ])


Yikes, and don't forget the missing ')' in the line before last.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


Re: [PATCH] link againt iconv on bsd

Posted by Albert Chin <su...@thewrittenword.com>.
On Sat, Jul 20, 2002 at 12:29:46AM +0200, Branko Cibej wrote:
> Probably should check for the libc iconv first, and have_iconv must 
> always have a value; so tis would become:
> 
> AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [
>   AC_CHECK_LIB(iconv, iconv, [
>     APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
>     APR_ADDTO(APRUTIL_LIBS,[-liconv])
>     have_iconv="1"
>   ],
>   [ have_iconv="0" ]
> ])

This won't work with GNU libiconv. Pull down the source for libxml and
look at how they do it then steal it. Don't assume that "iconv" is the
name of a valid function in -liconv. #include <iconv.h> first to
handle redefinitions of iconv.

Re: [PATCH] link againt iconv on bsd

Posted by Branko Čibej <br...@xbc.nu>.
Justin Erenkrantz wrote:

>On Fri, Jul 19, 2002 at 03:28:04PM -0500, Ben Collins-Sussman wrote:
>  
>
>>So this patch just adds -liconv to the main set of $APRUTIL_LIBS.
>>Don't ask me how many hours it took me to figure this out.  >:-(
>>
>>Is there a better way to do this?
>>
>>Index: apu-iconv.m4
>>===================================================================
>>RCS file: /home/cvs/apr-util/build/apu-iconv.m4,v
>>retrieving revision 1.3
>>diff -u -r1.3 apu-iconv.m4
>>--- apu-iconv.m4	19 Jul 2002 17:08:40 -0000	1.3
>>+++ apu-iconv.m4	19 Jul 2002 20:27:49 -0000
>>@@ -19,7 +19,8 @@
>> fi
>> AC_SUBST(have_iconv)
>> APR_FLAG_HEADERS(iconv.h)
>>-
>>+APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
>>+APR_ADDTO(APRUTIL_LIBS,[-liconv])
>>    
>>
>
>The correct thing to do is to replace the AC_CHECK_LIB and
>AC_CHECK_FUNCS with:
>
>AC_CHECK_LIB(iconv, iconv, [
> APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
> APR_ADDTO(APRUTIL_LIBS,[-liconv])
> have_iconv="1"
>], [
> AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [ have_iconv="0" ]
>])
>
>No need to check the funcs when we know we have a separate library.
>We might need to wrap all this with a AC_CHECK_HEADER to ensure we
>have an iconv.h, but I'm not 100% sure if all libc impls have an
>iconv.h.
>  
>

Probably should check for the libc iconv first, and have_iconv must 
always have a value; so tis would become:

AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [
  AC_CHECK_LIB(iconv, iconv, [
    APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
    APR_ADDTO(APRUTIL_LIBS,[-liconv])
    have_iconv="1"
  ],
  [ have_iconv="0" ]
])



-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


Re: [PATCH] link againt iconv on bsd

Posted by Branko Čibej <br...@xbc.nu>.
Justin Erenkrantz wrote:

>On Fri, Jul 19, 2002 at 03:28:04PM -0500, Ben Collins-Sussman wrote:
>  
>
>>So this patch just adds -liconv to the main set of $APRUTIL_LIBS.
>>Don't ask me how many hours it took me to figure this out.  >:-(
>>
>>Is there a better way to do this?
>>
>>Index: apu-iconv.m4
>>===================================================================
>>RCS file: /home/cvs/apr-util/build/apu-iconv.m4,v
>>retrieving revision 1.3
>>diff -u -r1.3 apu-iconv.m4
>>--- apu-iconv.m4	19 Jul 2002 17:08:40 -0000	1.3
>>+++ apu-iconv.m4	19 Jul 2002 20:27:49 -0000
>>@@ -19,7 +19,8 @@
>> fi
>> AC_SUBST(have_iconv)
>> APR_FLAG_HEADERS(iconv.h)
>>-
>>+APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
>>+APR_ADDTO(APRUTIL_LIBS,[-liconv])
>>    
>>
>
>The correct thing to do is to replace the AC_CHECK_LIB and
>AC_CHECK_FUNCS with:
>
>AC_CHECK_LIB(iconv, iconv, [
> APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
> APR_ADDTO(APRUTIL_LIBS,[-liconv])
> have_iconv="1"
>], [
> AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [ have_iconv="0" ]
>])
>
>No need to check the funcs when we know we have a separate library.
>We might need to wrap all this with a AC_CHECK_HEADER to ensure we
>have an iconv.h, but I'm not 100% sure if all libc impls have an
>iconv.h.
>  
>

Probably should check for the libc iconv first, and have_iconv must 
always have a value; so tis would become:

AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [
  AC_CHECK_LIB(iconv, iconv, [
    APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
    APR_ADDTO(APRUTIL_LIBS,[-liconv])
    have_iconv="1"
  ],
  [ have_iconv="0" ]
])



-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] link againt iconv on bsd

Posted by Justin Erenkrantz <je...@apache.org>.
On Fri, Jul 19, 2002 at 02:58:21PM -0700, Blair Zajac wrote:
> The libc one.  To get svn to pass make check, I had to remove SUNWhuccd.
> 
> So we probably want to check if iconv works in libc, and if it doesn't,
> then go looking for -lconv.

+1 - my thought as well.  -- justin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] link againt iconv on bsd

Posted by Justin Erenkrantz <je...@apache.org>.
On Fri, Jul 19, 2002 at 02:58:21PM -0700, Blair Zajac wrote:
> The libc one.  To get svn to pass make check, I had to remove SUNWhuccd.
> 
> So we probably want to check if iconv works in libc, and if it doesn't,
> then go looking for -lconv.

+1 - my thought as well.  -- justin

Re: [PATCH] link againt iconv on bsd

Posted by Blair Zajac <bl...@orcaware.com>.
Justin Erenkrantz wrote:
> 
> On Fri, Jul 19, 2002 at 02:54:47PM -0700, Blair Zajac wrote:
> > Yes, on Solaris 8 if you have the SUNWhuccd package installed, which
> > is for Chinese language support.
> 
> Which one is functional?  -- justin

The libc one.  To get svn to pass make check, I had to remove SUNWhuccd.

So we probably want to check if iconv works in libc, and if it doesn't,
then go looking for -lconv.

Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

Re: [PATCH] link againt iconv on bsd

Posted by Blair Zajac <bl...@orcaware.com>.
Justin Erenkrantz wrote:
> 
> On Fri, Jul 19, 2002 at 02:54:47PM -0700, Blair Zajac wrote:
> > Yes, on Solaris 8 if you have the SUNWhuccd package installed, which
> > is for Chinese language support.
> 
> Which one is functional?  -- justin

The libc one.  To get svn to pass make check, I had to remove SUNWhuccd.

So we probably want to check if iconv works in libc, and if it doesn't,
then go looking for -lconv.

Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] link againt iconv on bsd

Posted by Justin Erenkrantz <je...@apache.org>.
On Fri, Jul 19, 2002 at 02:54:47PM -0700, Blair Zajac wrote:
> Yes, on Solaris 8 if you have the SUNWhuccd package installed, which
> is for Chinese language support.

Which one is functional?  -- justin

Re: [PATCH] link againt iconv on bsd

Posted by Justin Erenkrantz <je...@apache.org>.
On Fri, Jul 19, 2002 at 02:54:47PM -0700, Blair Zajac wrote:
> Yes, on Solaris 8 if you have the SUNWhuccd package installed, which
> is for Chinese language support.

Which one is functional?  -- justin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] link againt iconv on bsd

Posted by Blair Zajac <bl...@orcaware.com>.
Bill Tutt wrote:
> 
> Didn't someone else recently complain about Solaris having both
> libiconv, and a libc iconv? Ick.

Yes, on Solaris 8 if you have the SUNWhuccd package installed, which
is for Chinese language support.

Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

Re: [PATCH] link againt iconv on bsd

Posted by Blair Zajac <bl...@orcaware.com>.
Bill Tutt wrote:
> 
> Didn't someone else recently complain about Solaris having both
> libiconv, and a libc iconv? Ick.

Yes, on Solaris 8 if you have the SUNWhuccd package installed, which
is for Chinese language support.

Blair

-- 
Blair Zajac <bl...@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

RE: [PATCH] link againt iconv on bsd

Posted by Bill Tutt <ra...@lyra.org>.
Didn't someone else recently complain about Solaris having both
libiconv, and a libc iconv? Ick.

Bill
----
Do you want a dangerous fugitive staying in your flat?
No.
Well, don't upset him and he'll be a nice fugitive staying in your flat.
 




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

RE: [PATCH] link againt iconv on bsd

Posted by Bill Tutt <ra...@lyra.org>.
Didn't someone else recently complain about Solaris having both
libiconv, and a libc iconv? Ick.

Bill
----
Do you want a dangerous fugitive staying in your flat?
No.
Well, don't upset him and he'll be a nice fugitive staying in your flat.
 




Re: [PATCH] link againt iconv on bsd

Posted by Justin Erenkrantz <je...@apache.org>.
On Fri, Jul 19, 2002 at 03:28:04PM -0500, Ben Collins-Sussman wrote:
> So this patch just adds -liconv to the main set of $APRUTIL_LIBS.
> Don't ask me how many hours it took me to figure this out.  >:-(
> 
> Is there a better way to do this?
> 
> Index: apu-iconv.m4
> ===================================================================
> RCS file: /home/cvs/apr-util/build/apu-iconv.m4,v
> retrieving revision 1.3
> diff -u -r1.3 apu-iconv.m4
> --- apu-iconv.m4	19 Jul 2002 17:08:40 -0000	1.3
> +++ apu-iconv.m4	19 Jul 2002 20:27:49 -0000
> @@ -19,7 +19,8 @@
>  fi
>  AC_SUBST(have_iconv)
>  APR_FLAG_HEADERS(iconv.h)
> -
> +APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
> +APR_ADDTO(APRUTIL_LIBS,[-liconv])

The correct thing to do is to replace the AC_CHECK_LIB and
AC_CHECK_FUNCS with:

AC_CHECK_LIB(iconv, iconv, [
 APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
 APR_ADDTO(APRUTIL_LIBS,[-liconv])
 have_iconv="1"
], [
 AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [ have_iconv="0" ]
])

No need to check the funcs when we know we have a separate library.
We might need to wrap all this with a AC_CHECK_HEADER to ensure we
have an iconv.h, but I'm not 100% sure if all libc impls have an
iconv.h.

HTH.  -- justin

Re: [PATCH] link againt iconv on bsd

Posted by Justin Erenkrantz <je...@apache.org>.
On Fri, Jul 19, 2002 at 03:28:04PM -0500, Ben Collins-Sussman wrote:
> So this patch just adds -liconv to the main set of $APRUTIL_LIBS.
> Don't ask me how many hours it took me to figure this out.  >:-(
> 
> Is there a better way to do this?
> 
> Index: apu-iconv.m4
> ===================================================================
> RCS file: /home/cvs/apr-util/build/apu-iconv.m4,v
> retrieving revision 1.3
> diff -u -r1.3 apu-iconv.m4
> --- apu-iconv.m4	19 Jul 2002 17:08:40 -0000	1.3
> +++ apu-iconv.m4	19 Jul 2002 20:27:49 -0000
> @@ -19,7 +19,8 @@
>  fi
>  AC_SUBST(have_iconv)
>  APR_FLAG_HEADERS(iconv.h)
> -
> +APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
> +APR_ADDTO(APRUTIL_LIBS,[-liconv])

The correct thing to do is to replace the AC_CHECK_LIB and
AC_CHECK_FUNCS with:

AC_CHECK_LIB(iconv, iconv, [
 APR_ADDTO(APRUTIL_EXPORT_LIBS,[-liconv])
 APR_ADDTO(APRUTIL_LIBS,[-liconv])
 have_iconv="1"
], [
 AC_CHECK_FUNCS(iconv, [ have_iconv="1" ], [ have_iconv="0" ]
])

No need to check the funcs when we know we have a separate library.
We might need to wrap all this with a AC_CHECK_HEADER to ensure we
have an iconv.h, but I'm not 100% sure if all libc impls have an
iconv.h.

HTH.  -- justin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org