I'm trying to compile a source code which was originally written for FreeBSD
and since strlcpy isn't included in the linux GlibC , I'm now stopped at this stage.
GCC has suggested that I can use strncpy but I don't want to actually change the source code.
Do I need to re-compile my LibC ?
Any help is appreciated.
The best solution to port BSD applications is libbsd; and it's already packaged for most systems.
On Debian-based systems the development package is named libbsd-dev
.
You can compile unmodified BSD source code by adding the following to your CFLAGS:
-DLIBBSD_OVERLAY -I/usr/include/bsd
, and linking with -lbsd
.
However, instead of hardcoding those values, you should use pkg-config
with the libbsd-overlay
package if you intend to distribute your build system.