Subject: Re: FreeBSD 5.0 (again), undefined reference to mkstemps()
To: Aron Stansvik <>
From: Brian A. Seklecki <>
List: current-users
Date: 10/30/2003 09:39:12
On Tue, 2003-10-28 at 18:47, Aron Stansvik wrote:
> Hey, me again. Thanks for the quick fix last time. Now I have another
> problem.
> My build fails at when linking the "cpp" target, saying:
> /usr/home/elvis/misc/netbsd/src/gnu/usr.bin/gcc3/libiberty/obj/libiberty.a(make-temp-file.o):

Most of the time, when an object/symbol is missing on a foriegn build,
you can get around it by pulling in $OBJDIR/lib/libc/mkstemps.o into the
directory that is failing and then re-running the command with that .o
file as an additional argument.

This helped me get around the strlcpy problem with bin/sh/* on Linux
(which lacks)


> In function `make_temp_file':
> make-temp-file.o(.text+0x246): undefined reference to `mkstemps'
> collect2: ld returned 1 exit status
> The failed command is:
> /usr/home/elvis/misc/netbsd/src/obj/tooldir.FreeBSD-5.0-RELEASE-i386/bin/i386--netbsdelf-gcc
> -o cpp -nostdlib
> -Wl,-rpath-link,/usr/home/elvis/misc/netbsd/dest/lib:/usr/home/elvis/misc/netbsd/dest/usr/lib
> -L/usr/home/elvis/misc/netbsd/dest/lib
> /usr/home/elvis/misc/netbsd/dest/usr/lib/crt0.o
> /usr/home/elvis/misc/netbsd/dest/usr/lib/crti.o
> /usr/home/elvis/misc/netbsd/dest/usr/lib/crtbegin.o cppspec.o
> -L/usr/home/elvis/misc/netbsd/src/gnu/usr.bin/gcc3/frontend/obj
> -lfrontend
> -L/usr/home/elvis/misc/netbsd/src/gnu/usr.bin/gcc3/libiberty/obj
> -liberty -L/usr/home/elvis/misc/netbsd/dest/usr/lib
> -L/usr/home/elvis/misc/netbsd/dest/usr/lib -lgcc -lc -lgcc
> /usr/home/elvis/misc/netbsd/dest/usr/lib/crtend.o
> /usr/home/elvis/misc/netbsd/dest/usr/lib/crtn.o
> which surprises me, since mkstemps() is a standard C library function,
> and the above command includes the -lc flag. I'm not a good programmer
> myself, but maybe there's someone out there with FreeBSD 5.x who knows
> better than me what the problem is.
> Thanks in advance.
> Sincerely,
> Aron Stansvik
> --
> unemployed