undefined reference when building ports-mgmt/pkg in a jail

I'm running jails on FreeBSD 8.3 and I can't build ports-mgmt/pkg from within a jail. I'm trying this:

# cd /usr/ports/ports-mgmt/pkg
# make clean build

...and it fails with the following error:

Code:
cc -O2 -pipe -fno-strict-aliasing  -I/var/ports/basejail/usr/ports/ports-mgmt/pkg/work/pkg-1.0.11/pkg-static/../libpkg -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 audit.o autoremove.o backup.o check.o clean.o create.o delete.o event.o info.o install.o main.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 -L/var/ports/basejail/usr/ports/ports-mgmt/pkg/work/pkg-1.0.11/pkg-static/../libpkg  -lpkg  -larchive  -lutil  -lpthread  -lsbuf  -lfetch  -lssl  -lcrypto  -lmd  -lz  -lbz2  -llzma  -L/var/ports/basejail/usr/ports/ports-mgmt/pkg/work/pkg-1.0.11/pkg-static/../external/sqlite -L/var/ports/basejail/usr/ports/ports-mgmt/pkg/work/pkg-1.0.11/pkg-static/../external/libyaml  -lyaml -lsqlite3  -larchive  -lsbuf  -lfetch  -lpthread  -lelf  -lssl  -lcrypto  -lmd  -lz  -lbz2  -llzma -ledit  -lncursesw -ljail
/var/ports/basejail/usr/ports/ports-mgmt/pkg/work/pkg-1.0.11/pkg-static/../external/sqlite/libsqlite3.a(shell.o)(.text+0x509d): In function `process_input':
: undefined reference to `readline'
/var/ports/basejail/usr/ports/ports-mgmt/pkg/work/pkg-1.0.11/pkg-static/../external/sqlite/libsqlite3.a(shell.o)(.text+0x5299): In function `process_input':
: undefined reference to `add_history'
/var/ports/basejail/usr/ports/ports-mgmt/pkg/work/pkg-1.0.11/pkg-static/../external/sqlite/libsqlite3.a(shell.o)(.text+0x5cb5): In function `sqlite3_shell':
: undefined reference to `read_history'
/var/ports/basejail/usr/ports/ports-mgmt/pkg/work/pkg-1.0.11/pkg-static/../external/sqlite/libsqlite3.a(shell.o)(.text+0x5cce): In function `sqlite3_shell':
: undefined reference to `stifle_history'
/var/ports/basejail/usr/ports/ports-mgmt/pkg/work/pkg-1.0.11/pkg-static/../external/sqlite/libsqlite3.a(shell.o)(.text+0x5cd6): In function `sqlite3_shell':
: undefined reference to `write_history'
*** Error code 1
1 error
*** Error code 2
1 error
*** Error code 1

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

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

Note that pkg builds fine in the host system, it's only in jails that it breaks. I use ezjail to create and update the jails.
 
That works, installing pkg-1.0.2 in the jail.

But if I want to update other packages in the jail using portmaster the first thing it does is try to upgrade to pkg-1.0.11:

Code:
===>>> The following actions will be taken if you choose to proceed:
	Upgrade pkg-1.0.2 to pkg-1.0.11
	Upgrade portmaster-3.14_9 to portmaster-3.16
	Upgrade libiconv-1.14 to libiconv-1.14_1
	Upgrade pkgconf-0.8.12 to pkgconf-0.9.1_2
	Upgrade gettext-0.18.1.1 to gettext-0.18.1.1_1
	Upgrade libxml2-2.7.8_5 to libxml2-2.8.0_1

===>>> Proceed? y/n [y]

Which fails with the same error as before.

I can work around this by specifying [cmd=]portmaster -a -x pkg[/cmd], but I'd prefer to find a way to build this package cleanly.
 
If you're not going to use packages why are you installing pkgng in the first place?

I really recommend setting up a build server, build your own packages and then use pkgng to install them.
 
There are many advantages to using PKGNG even if you build your own ports. Proper dependency tracking and a solid sqlite3 database that is very resilient to corruption issues compared to the old /var/db/pkg database to name a few.
 
After 10-15 years of not having PKGNG I really never had any issues with the 'old' system. And if you use portmaster I doubt it will get messy. It never did on any of my systems.

But, granted, pkgng is a big improvement. And if you really want to use it I highly recommend setting up your own repository. It's kind of pointless to have to compile the same ports for all the jails (or machines) you have over and over again.
 
On my other FreeBSD systems the switch to PKGNG was painless and I found it has benefits even when still using ports.

I was hoping I could avoid the effort of setting up a separate build server, but that's something I will look at if it's going to make my life easier in the long run.
 
Back
Top