# Can't install pkgconf due to lack of strndup function



## BadJanitah (Jun 4, 2013)

I am attempting to build devel/pkgconf from the ports collection (to replace pkg-config) on a FreeBSD 7.1-RELEASE-p6 system, but running into an error because there is no strndup function.  This is what I get:


```
dependency.c: In function 'pkg_dependency_add':
dependency.c:45: warning: implicit declaration of function 'strndup'
dependency.c:45: warning: incompatible implicit declaration of built-in function 'strndup'
cc -O2 -fno-strict-aliasing -pipe -DLIBDIR=\"/usr/local/lib\" -DINCLUDEDIR=\"/usr/local/include\" -DPKG_DEFAULT_PATH=\"/usr/local/libdata/pkgconfig:/usr/libdata/pkgconfig\" -DSYSTEM_INCLUDEDIR=\"/usr/include\" -DSYSTEM_LIBDIR=\"/usr/lib\" -Wall -Wextra -Wformat=2 -std=gnu99 -D_FORTIFY_SOURCE=2 -c queue.c -o queue.o
cc  -o pkgconf main.o cache.o pkg.o bsdstubs.o getopt_long.o fragment.o argvsplit.o fileio.o tuple.o dependency.o queue.o
dependency.o(.text+0x1a2): In function `pkg_dependency_parse_str':
: undefined reference to `strndup'
dependency.o(.text+0x39b): In function `pkg_dependency_parse_str':
: undefined reference to `strndup'
dependency.o(.text+0x4ab): In function `pkg_dependency_parse_str':
: undefined reference to `strndup'
*** Error code 1

Stop in /usr/ports/devel/pkgconf/work/pkgconf-0.9.2.
*** Error code 1

Stop in /usr/ports/devel/pkgconf.
```

From what I've read, this function wasn't incorporated until 7.2.  This is a customer's server, so upgrading is not a possibility right now.

I've tried installing the devel/libstrfunc port and linking to that in the Makefile of pkgconf and was unsuccessful, but I was very likely doing it wrong.

Does anyone have any suggestions on how I might fix this?  Or am I out of luck until I can upgrade the system to 7.2 or newer?

Thanks in advance for your time.


----------



## kpa (Jun 4, 2013)

The whole 7.X line of FreeBSD is now end of life so you're very much on your own if you decide to try to hack together something that makes devel/pkgconf work. Even if you manage to solve this problem I'm sure you will run into other problems with other ports that will no longer build on 7.X. 

I'm curious, why is upgrading to for example 8.3 out of the question?


----------



## BadJanitah (Jun 4, 2013)

kpa said:
			
		

> The whole 7.X line of FreeBSD is now end of life so you're very much on your own if you decide to try to hack together something that makes devel/pkgconf work. Even if you manage to solve this problem I'm sure you will run into other problems with other ports that will no longer build on 7.X.
> 
> I'm curious, why is upgrading to for example 8.3 out of the question?



Thanks for your response.

Upgrading isn't out of the question, it's just not something I can do without coordinating a maintenance window with the customer.  Not a big deal at all, I was just hoping there was a quicker fix for it, and I was also personally curious if it could be done.


----------

