Subject: pkg/33160: databases/myodbc's library cannot resolv strndup on BSD system
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <oshima-ya@yagoto-urayama.jp>
List: pkgsrc-bugs
Date: 03/28/2006 14:00:00
>Number:         33160
>Category:       pkg
>Synopsis:       databases/myodbc's library cannot resolv strndup on BSD system
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 28 14:00:00 +0000 2006
>Originator:     Yasushi Oshima
>Release:        NetBSD 3.99.17
>Organization:
>Environment:
NetBSD 3.99.17 amd64
>Description:
Myodbc's library uses strndup function.
However, there is only in GNU libc. BSD's libc does not have it.
So, that symbol is not resolved when linking client program that uses libmyodbc.

% nm libmyodbc3-3.51.12.so | grep strndup
                 U strndup

>How-To-Repeat:
make install in databases/myodbc.

>Fix:
Myodbc has strndup() in its own source for some platforms.

Apply patch as follows:

--- util/MYODBCUtil.h.orig      2005-10-10 04:33:40.000000000 +0900
+++ util/MYODBCUtil.h
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/param.h>
 
 #ifdef WIN32
 #include <windows.h>

--- util/MYODBCUtilReadDataSourceStr.c.orig     2005-10-10 04:33:40.000000000 +0900
+++ util/MYODBCUtilReadDataSourceStr.c
@@ -20,7 +20,7 @@
 
 #include "MYODBCUtil.h"
 
-#if defined(__APPLE__) || defined(WIN32) || defined(__sparc)
+#if defined(__APPLE__) || defined(WIN32) || defined(__sparc) || defined(BSD)
 char *strndup( const char *s, size_t n )
 {
     size_t nAvail;


then,

% nm libmyodbc3-3.51.12.so | grep strndup
000000000001a480 T strndup