# Can't build pkg



## djmentos (Dec 16, 2018)

Hello all,

after upgrade to 12.0 I'm no more able to build ports-mgmt/pkg:

```
--- pkg ---
libtool: link: cc -D_BSD_SOURCE -I../libpkg -I../libpkg -I../compat -I../external/libucl/klib -I../external/uthash -I../external/expat/lib -DGITHASH=\"\" -w -O3 -pipe -fstack-protector -Wno-error -fstack-protector -fno-strict-aliasing -Wall -Wno-unused-function -D_BSD_SOURCE -DINET6=1 -fstack-protector -Wl,--enable-new-dtags -o .libs/pkg pkg-add.o pkg-alias.o pkg-annotate.o pkg-audit.o pkg-autoremove.o pkg-backup.o pkg-check.o pkg-clean.o pkg-config.o pkg-convert.o pkg-create.o pkg-delete.o pkg-event.o pkg-fetch.o pkg-globals.o pkg-info.o pkg-install.o pkg-lock.o pkg-main.o pkg-plugins.o pkg-query.o pkg-register.o pkg-repo.o pkg-rquery.o pkg-search.o pkg-set.o pkg-shell.o pkg-shlib.o pkg-ssh.o pkg-stats.o pkg-update.o pkg-updating.o pkg-upgrade.o pkg-utils.o pkg-version.o pkg-which.o  ../libpkg/.libs/libpkg.so ../compat/.libs/libbsd_compat.a -lutil -lssl -lcrypto -lm -lelf -ljail -larchive -lz -lbz2 -llzma -Wl,-rpath -Wl,/usr/local/lib
/usr/bin/ld: error: undefined symbol: arc4random_stir
>>> referenced by main.c
>>>               pkg-main.o:(main)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [pkg] Error code 1

make[5]: stopped in /usr/ports/ports-mgmt/pkg/work/pkg-1.10.5/src
--- pkg-static ---
/usr/bin/ld: error: undefined symbol: arc4random_stir
>>> referenced by main.c
>>>               pkg-main.o:(main)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [pkg-static] Error code 1

make[5]: stopped in /usr/ports/ports-mgmt/pkg/work/pkg-1.10.5/src
2 errors

make[5]: stopped in /usr/ports/ports-mgmt/pkg/work/pkg-1.10.5/src
*** [all-recursive] Error code 1

make[4]: stopped in /usr/ports/ports-mgmt/pkg/work/pkg-1.10.5
1 error

make[4]: stopped in /usr/ports/ports-mgmt/pkg/work/pkg-1.10.5
*** [all] Error code 2

make[3]: stopped in /usr/ports/ports-mgmt/pkg/work/pkg-1.10.5
1 error

make[3]: stopped in /usr/ports/ports-mgmt/pkg/work/pkg-1.10.5
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/ports-mgmt/pkg
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/ports-mgmt/pkg
*** Error code 1
```

How can I resolve that?


----------



## Glass (Dec 16, 2018)

Have you tried a binary install:

`pkg-static install -f pkg`


----------



## djmentos (Dec 17, 2018)

The binary works fine, but Id like to compile it using ports collection. I'm using ports in my whole system and now I'm not able to recompile some staff while it depends on pkg.


----------



## ShelLuser (Dec 17, 2018)

What's in your /etc/make.conf?  If something is in there: have you tried moving this out of the way and then trying to rebuild? (be sure to start clean)


----------



## twllnbrck (Dec 17, 2018)

FreeBSD doesn't include a tool for updating a largely port-managed system, but there are add-on tools like ports-mgmt/portupgrade or ports-mgmt/portmaster. E.g., when you have portmaster configured you can run `portmaster -af` to update all ports. The problem is these 3rd party tools aren't maintained by FreeBSD and you are responsible for fixing problems.
BTW, if you need so much customization, build your own repository with ports-mgt/poudriere instead of using the ports tree.


----------



## djmentos (Dec 17, 2018)

ShelLuser said:


> What's in your /etc/make.conf?  If something is in there: have you tried moving this out of the way and then trying to rebuild? (be sure to start clean)



That was a good idea. There were few old entries I have added in the past. Thanks!


----------

