Bug 36254

Summary: Conflicting function definition with standard libraries
Product: Ports & Packages Reporter: Jerome Mainka <mainka>
Component: Individual Port(s)Assignee: Dirk Meyer <dinoex>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Jerome Mainka 2002-03-24 16:10:01 UTC
the function strnstr defined in libs/libwww/HTReader.c:80 is already defined in /usr/include/string.h:93

A make in /usr/ports/print/teTeX doesn't succeed

Fix: apply the patch
How-To-Repeat: # cd /usr/ports/print/teTeX
# make
Comment 1 Miguel Mendez 2002-03-24 16:16:25 UTC
On Sun, Mar 24, 2002 at 08:04:54AM -0800, Jerome Mainka wrote:
> 
> the function strnstr defined in libs/libwww/HTReader.c:80 is already defined in /usr/include/string.h:93


Unfortunately, that will break compilation of the port on older systems,
where that function it's not part of libc. My humble suggestion:

Put a check like this in the port makefile:
.if ${OSVERSION} < 440003 || ${OSVERSION} >= 500000 && ${OSVERSION} <
500027
CFLAGS+=       -DNEED_STRNSTR
.endif

Then, patch the source code and surround that function with and #ifdef
NEED_STRNSTR

Cheers,
-- 
        Miguel Mendez - flynn@energyhq.homeip.net
        GPG Public Key :: http://energyhq.homeip.net/files/pubkey.txt
        EnergyHQ :: http://www.energyhq.tk
        FreeBSD - The power to serve!
Comment 2 Alan Eldridge 2002-03-24 20:35:34 UTC
On Sun, Mar 24, 2002 at 08:04:54AM -0800, Jerome Mainka wrote:
>
>>Number:         36254
>>Category:       ports
>>Synopsis:       Conflicting function definition with standard libraries
>>Environment:
>FreeBSD gandalf 4.5-STABLE FreeBSD 4.5-STABLE #0: Sun Mar 24 12:38:05 CET 2002
>>Description:
>the function strnstr defined in libs/libwww/HTReader.c:80 is already defined in /usr/include/string.h:93
>
>A make in /usr/ports/print/teTeX doesn't succeed

On the surface, this PR and patch are not correct.

1. teTex should not be using the libwww in its own tree; according to the
Makefile, it should be using the installed port, instead.

Problem is with submitter's system; need to see full configure and 
make logs to determine what actually happened.

2. Ignoring the fact that the implicated code should not be used anyway,
the suggested patch would be wrong in any event for the following reasons:

2a. Prototype doesn't match, disregarding constness, the one in
<string.h>, which is (const char *,const char*, size_t); the two
functions are not the same. That is, the code should not compile 
correctly if the function is removed.

2b. If the function *could* be removed, which it can't, the correct 
way of removing the function would be to use the preprocessor
to remove it. This eliminates the patch's dependence on the exact
function implementation.

-- 
AlanE
"When the going gets weird, the weird turn pro." - HST
Comment 3 Alan Eldridge 2002-03-24 20:45:29 UTC
On Sun, Mar 24, 2002 at 12:40:09PM -0800, Alan Eldridge wrote:
 
> 1. teTex should not be using the libwww in its own tree; according to the
> Makefile, it should be using the installed port, instead.
> 
> Problem is with submitter's system; need to see full configure and 
> make logs to determine what actually happened.

I am using 4.5-STABLE from 3/11 myself, and the port correctly builds,
and does not use the internal libwww code, so problem being submitter's
configuration is confirmed.
-- 
AlanE
"When the going gets weird, the weird turn pro." - HST
Comment 4 Jerome Mainka 2002-03-24 20:55:25 UTC
Thanks to Alan Elridge, I reinstalled the libwww port. Seems that the 
previous
installation was broken. Afterwards, the teTeX compilation went like a 
charm.

Sorry for the false alert.

Jerome Mainka
Comment 5 Dirk Meyer freebsd_committer freebsd_triage 2002-03-30 06:35:20 UTC
State Changed
From-To: open->closed

User error, No further action requiered.