coda
coda copied to clipboard
Can't build on FreeBSD
On FreeBSD 12-CURRENT, trying to build it (with either make or gmake) fails like this:
gmake[4]: Entering directory '/usr/home/trasz/git/coda/coda-src/auth2'
/bin/sh ../../libtool --tag=CC --mode=link cc -g -O2 -I/usr/local/include -Wall -fno-exceptions -rdynamic -L/usr/local/lib -L/usr/local/lib -o au au.o libauser.la ../../coda-src/kerndep/libkerndep.la ../
../coda-src/util/libutil.la ../../lib-src/base/libbase.la -L/home/trasz/git/coda/lib-src/rpc2/rpc2-src -lrpc2 -lse -L/home/trasz/git/coda/lib-src/lwp/src -llwp -lkvm
libtool: link: cc -g -O2 -I/usr/local/include -Wall -fno-exceptions -rdynamic -o au au.o -L/usr/local/lib ./.libs/libauser.a ../../coda-src/kerndep/.libs/libkerndep.a ../../coda-src/util/.libs/libutil.a ../.
./lib-src/base/.libs/libbase.a -L/home/trasz/git/coda/lib-src/rpc2/rpc2-src -lrpc2 -lse -L/home/trasz/git/coda/lib-src/lwp/src -llwp -lkvm
./.libs/libauser.a(auth2.helper.o): In function `pack_struct_SecretToken':
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:19: undefined reference to `pack_bytes'
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:21: undefined reference to `pack_integer'
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:23: undefined reference to `pack_integer'
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:25: undefined reference to `pack_integer'
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:27: undefined reference to `pack_integer'
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:29: undefined reference to `pack_integer'
./.libs/libauser.a(auth2.helper.o):/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:31: more undefined references to `pack_integer' follow
./.libs/libauser.a(auth2.helper.o): In function `pack_struct_SecretToken':
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:35: undefined reference to `pack_encryptionKey'
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:37: undefined reference to `pack_integer'
./.libs/libauser.a(auth2.helper.o): In function `unpack_struct_SecretToken':
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:44: undefined reference to `unpack_bytes'
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:46: undefined reference to `unpack_integer'
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:48: undefined reference to `unpack_integer'
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:50: undefined reference to `unpack_integer'
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:52: undefined reference to `unpack_integer'
/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:54: undefined reference to `unpack_integer'
./.libs/libauser.a(auth2.helper.o):/usr/home/trasz/git/coda/coda-src/auth2/auth2.helper.c:56: more undefined references to `unpack_integer' follow
[etc, lots of other missing pack_ and unpack_ symbols]
odd, these pack and unpack helper functions should have been linked as part of librpc2. Maybe building the rpc2 library failed and it is now trying to link with a system installed (older) version of the library.
Bingo, that's it - libraries from older versions in /usr/local/lib/. Still, it shouldn't try to link against those, should it?
Correct, it should try to use the 'uninstalled' package config file at lib-src/rpc2/rpc2-uninstalled.pc
, but looking at that now I don't think it really does anything to force linking against the locally built version. It just adds a search path with '-L' and crosses it's fingers that it is searched before any system paths (or /usr/local/lib
).
Is there any way to make sure the correct search path is inserted in the linker command line before the system paths?
I wish I knew. I thought the current approach would do it, but looking at the link line it looks like -I/usr/local/include
and -L/usr/local/lib -L/usr/local/lib
(listed twice it seems) are somehow added to the link line before the more specific paths for the lwp
and rpc2
libraries. I have no idea why it would even need to search /usr/local
unless it happens to be for one of the readline or ncurses libraries.
The coda-src/auth2/Makefile.am
doesn't show why the /usr/local
paths would be added, everything goes through AM_CPPFLAGS and LDADD correctly. The generated makefile uses
au$(EXEEXT): ...
@rm -f au$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(au_OBJECTS) $(au_LDADD) $(LIBS)
And walking down the chain of macros it looks like /usr/local/
was for some reason specifically added to either AM_CFLAGS/AM_LDFLAGS
or CFLAGS/LDFLAGS
. We cannot supersede those search paths because the au_LDADD
variable we control will always be later in the linker command line.