# /usr/bin/ld: cannot find XX under 8.4-PRERELEASE



## marforic (Mar 12, 2014)

Hi,
I'm having some problems compiling/installing a few things (at the moment: ports-mgmt/pkg and world (trying to upgrade to 9.2). The problem lies in the linker (or so I think). For example, running `make install` for ports-mgmt/pkg results in the following:


```
===>  Building for pkg-1.2.6
===> libpkg (all)
Warning: Object directory not changed from original /usr/ports/ports-mgmt/pkg/work/pkg-1.2.6/libpkg
===> pkg (all)
Warning: Object directory not changed from original /usr/ports/ports-mgmt/pkg/work/pkg-1.2.6/pkg
cc -static -O2 -pipe -fno-strict-aliasing  -DPORTSDIR=\"/usr/ports\" -I../libpkg  -I/usr/ports/ports-mgmt/pkg/work/pkg-1.2.6/pkg/../external/uthash  -I/usr/ports/ports-mgmt/pkg/work/pkg-1.2.6/pkg/../external/expat/lib -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wno-pointer-sign -static  -o pkg-static add.o annotate.o audit.o autoremove.o backup.o check.o clean.o config.o convert.o create.o delete.o event.o info.o install.o lock.o main.o plugins.o progressmeter.o query.o register.o repo.o rquery.o update.o upgrade.o search.o set.o shlib.o updating.o utils.o version.o which.o fetch.o shell.o stats.o ssh.o -L/usr/ports/ports-mgmt/pkg/work/pkg-1.2.6/pkg/../libpkg  -lpkg  -ledit  -larchive  -lutil  -lpthread  -lsbuf  -lfetch  -lssl  -lcrypto  -lmd  -lz  -lbz2  -llzma -ljail -lelf -larchive  -lsbuf  -lfetch  -lpthread  -lssl  -lcrypto  -lmd  -lz  -lbz2  -llzma -ledit  -lncursesw
/usr/bin/ld: cannot find -larchive
*** Error code 1
1 error
*** Error code 2
1 error
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop in /usr/ports/ports-mgmt/pkg.
*** Error code 1

Stop in /usr/ports/ports-mgmt/pkg.
```

As I said, I'm running 8.4-PRERELEASE:


```
> uname -a
FreeBSD my_host 8.4-PRERELEASE FreeBSD 8.4-PRERELEASE #1: Fri May 10 16:19:54 CEST 2013     root@my_host:/usr/obj/usr/src/sys/GENERIC  i386
```

And the weird thing about `/usr/bin/ld` not finding *-larchive* is that `ldconfig -r` gives this:


```
> ldconfig -r | grep "larchive"
    60:-larchive.5 => /usr/lib/libarchive.so.5
    417:-larchive.14 => /usr/local/lib/libarchive.so.14
    589:-larchive.4 => /usr/local/lib/compat/libarchive.so.4
```

Similarly, when trying to `make buildworld` (in /usr/src) I reach a point where the linker cannot find *-lutil*, yet again:


```
> ldconfig -r | grep "lutil"
    7:-lutil.8 => /lib/libutil.so.8
    193:-lgailutil.18 => /usr/local/lib/libgailutil.so.18
    666:-lutil.7 => /usr/local/lib/compat/libutil.so.7
```

So, what could possibly be wrong with my system?

Thanks a lot for the help!

Best,

~C


----------



## SirDice (Mar 13, 2014)

Why are you still running a -PRERELEASE? FreeBSD 8.4-RELEASE came out in June 2013.


----------



## marforic (Mar 14, 2014)

Indeed, upgrading to 8.4-RELEASE fixed the issue.
Thanks for the help (though subtle )

~C


----------

